[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-texinfo] texi2dvi: Preserve foo.log
From: |
Akim Demaille |
Subject: |
Re: [help-texinfo] texi2dvi: Preserve foo.log |
Date: |
Fri, 24 Jun 2005 09:29:08 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
>>> "Karl" == Karl Berry <address@hidden> writes:
> I think clean = tidy + mostlyclean.
> By mostlyclean you mean removing the tidy dir at the end? Yeah, I can
> agree with that, after moving the main output file to the main dir of
> course. I'd say don't bother with the log. If people want the log,
> they shouldn't use --clean. The log by itself is kind of unlikely to be
> helpful anyway.
> So maybe we have the following:
> --tidy, which runs TeX in a temp dir and leaves stuff around
> (use when actively maintaining a doc),
> --clean, which runs TeX in a temp dir and removes the temp dir at the end,
> (use to just get the output, eg, running texi2dvi --pdf in some
> distribution you download)
> and --build=local, which runs TeX in the local dir and leaves all the
> files. (It uses a temp dir for those other purposes and removes
> it at the end, but that's kind of irrelevant.)
> Wdyt?
That's what I was aiming for. And I'm fine with letting the log
down. Here is the corresponding patch, with some undergoing cleaning.
Index: ChangeLog
from Akim Demaille <address@hidden>
* util/texi2dvi (tex, bibtex, texindex): Move their computation to...
(run_tex, run_bibtex, run_texindex): here, to clarify.
(move_to_dest): New.
(run_tex): Use it to copy the result back.
Don't bother exporting the log.
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.54
diff -u -u -r1.54 texi2dvi
--- util/texi2dvi 10 Jun 2005 13:44:47 -0000 1.54
+++ util/texi2dvi 24 Jun 2005 07:27:35 -0000
@@ -317,6 +319,29 @@
echo "$_res"
}
+# move_to_dest FILE
+# -----------------
+# Move the FILE to the place where the user expects it. FILE can be
+# the principal output (in which case -o directly apply), or an auxiliary
+# file with the same base name.
+move_to_dest ()
+{
+ _file_noext=`echo "$1" | sed 's/\.[^.]*$//'`
+ _file_ext=`echo "$1" | sed 's/^.*\.//'`
+ _out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
+ _out_ext=`echo "$oname" | sed 's/^.*\.//'`
+
+ case $tidy:$oname in
+ true:) _dest=$orig_pwd;;
+ false:) _dest=;;
+ *:*) _dest=$_out_noext.$_file_ext;;
+ esac
+ if test -n "$_dest"; then
+ verbose "Copying $1 to $_dest"
+ cp -p "$1" "$_dest"
+ fi
+}
+
## ----------------------- ##
## Running the TeX suite. ##
@@ -328,6 +353,19 @@
# and logs.
run_tex ()
{
+ case $language:$oformat in
+ latex:pdf) tex=${PDFLATEX:-pdflatex};;
+ latex:dvi) tex=${LATEX:-latex};;
+ texinfo:pdf) tex=$PDFTEX;;
+ texinfo:dvi)
+ # MetaPost also uses the TEX environment variable. If the user
+ # has set TEX=latex for that reason, don't bomb out.
+ case $TEX in
+ *latex) tex=tex;; # don't bother trying to find etex
+ *) tex=$TEX
+ esac
+ esac
+
# Note that this will be used via an eval: quote properly.
cmd=$tex
@@ -349,21 +387,9 @@
verbose "Running $cmd ..."
if eval "$cmd" >&5; then
- # Update the actual output.
- case $tidy:$oname in
- true:) dest=$orig_pwd;;
- false:) dest=;;
- *:*) dest=$oname;;
- esac
- if test -n "$dest"; then
- verbose "Copying $oformat file from `pwd` to $dest"
- cp -p "./$filename_noext.$oformat" "$dest"
- fi
+ move_to_dest "$filename_noext.$oformat"
else
- $tidy &&
- cp "$filename_noext.log" "$orig_pwd"
- fatal 1 "$tex exited with bad status, quitting." \
- "see $filename_noext.log for errors."
+ fatal 1 "$tex exited with bad status, quitting."
fi
}
@@ -389,6 +415,11 @@
# easier, though we take the risk to match false messages.
run_bibtex ()
{
+ case $language in
+ latex) bibtex=${BIBTEX:-bibtex};;
+ texinfo) bibtex=;;
+ esac
+
if test -n "$bibtex" \
&& test -r "$filename_noext.aux" \
&& test -r "$filename_noext.log" \
@@ -420,6 +451,10 @@
# that if the index files are out of date or nonexistent.
run_index ()
{
+ case $language in
+ latex) texindex=${MAKEINDEX:-makeindex};;
+ texinfo) texindex=${TEXINDEX:-texindex};;
+ esac
index_files=`get_index_files $orig_xref_files`
if test -n "$texindex" && test -n "$index_files"; then
verbose "Running $texindex $index_files ..."
@@ -767,7 +802,7 @@
# An auxiliary directory used for all the auxiliary tasks involved
# in compiling this document.
- t2ddir=`$clean && echo ${TMPDIR:-/tmp}/`$filename_noext.t2d
+ t2ddir=$filename_noext.t2d
# Remove it at exit if clean mode.
$clean &&
trap "cd / && rm -rf $t2ddir" 0 1 2 15
@@ -832,34 +867,14 @@
# Assume a LaTeX file. LaTeX needs bibtex and uses latex for
# compilation. No makeinfo.
language=latex
- bibtex=${BIBTEX:-bibtex}
makeinfo= # no point in running makeinfo on latex source.
- texindex=${MAKEINDEX:-makeindex}
textra_cmd=1i
- if test $oformat = dvi; then
- tex=${LATEX:-latex}
- else
- tex=${PDFLATEX:-pdflatex}
- fi
;;
*)
- # Assume a Texinfo file. Texinfo files need makeinfo, texindex and tex.
+ # Assume a Texinfo file.
language=texinfo
- bibtex=
- texindex=${TEXINDEX:-texindex}
textra_cmd='/address@hidden/a'
- if test $oformat = dvi; then
- # MetaPost also uses the TEX environment variable. If the user
- # has set TEX=latex for that reason, don't bomb out.
- if echo $TEX | grep 'latex$' >&6; then
- tex=tex # don't bother trying to find etex
- else
- tex=$TEX
- fi
- else
- tex=$PDFTEX
- fi
# Unless required by the user, makeinfo expansion is wanted only
# if texinfo.tex is too old.
if test "$expand" = t; then
- [help-texinfo] texi2dvi: Preserve foo.log, Akim Demaille, 2005/06/21
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Akim Demaille, 2005/06/21
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Karl Berry, 2005/06/21
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Akim Demaille, 2005/06/22
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Karl Berry, 2005/06/22
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Akim Demaille, 2005/06/22
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Karl Berry, 2005/06/22
- Re: [help-texinfo] texi2dvi: Preserve foo.log,
Akim Demaille <=
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Karl Berry, 2005/06/24
- Re: [help-texinfo] texi2dvi: Preserve foo.log, Akim Demaille, 2005/06/24