texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo update (Thu Nov 10 19:22:01 EST 2005)


From: Karl Berry
Subject: texinfo update (Thu Nov 10 19:22:01 EST 2005)
Date: Thu, 10 Nov 2005 19:22:12 -0500

Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.544
retrieving revision 1.545
diff -c -r1.544 -r1.545
*** ChangeLog   10 Nov 2005 23:36:04 -0000      1.544
--- ChangeLog   11 Nov 2005 00:02:30 -0000      1.545
***************
*** 1,3 ****
--- 1,36 ----
+ 2005-11-10  Akim Demaille  <address@hidden>
+ 
+       Make the naming conventions more consistent and shorter.
+       * util/texi2dvi (oformat): Rename as...
+       (out_lang): this.
+       (filename_input, filename_src, filename_xtr, filename_rcd,
+       filename_noext, filename_dir, filename_dir_abs): Rename as...
+       (in_input, in_src, in_xtr, in_rcd, in_noext, in_dir, in_dir_abs)
+       this.
+       (in_base, out_name, out_dir, out_dir_abs, out_base, out_noext): New.
+       (output_base_name): New.
+       (move_to_dest): Use it.
+       (run_tex): Catch invalid calls.
+       Be robust to inclusion in subdirs.
+       (run_bibtex): Simplify when this is not a LaTeX file.
+       (run_tex_suite): cycle is local.
+       (input_file_name_decode): New, extracted from the main loop.
+       Some variables are now local.
+ 
+       Use the output file name as root for the t2d directory name.
+       * util/texi2dvi (t2ddir): Use $out_noext, no $in_noext.
+       * util/texi2dvi.test: Adjust.
+ 
+       Be robust to inclusion in subdirs.
+       * util/texi2dvi (run_tex): Look for \include of files in subdirs.
+       (run_bibtex): Citations might be in another aux file.
+ 
+       Support html.
+       * util/texi2dvi (run_to_html): New.
+       (run_conversion): New, extracted from the main loop.
+       Support --html.
+ 
+ 
  2005-11-10  Karl Berry  <address@hidden>
  
        * doc/texinfo.txi (Def Cmd Template): mismatched example and output.
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.65
retrieving revision 1.66
diff -c -r1.65 -r1.66
*** util/texi2dvi       24 Oct 2005 00:33:43 -0000      1.65
--- util/texi2dvi       11 Nov 2005 00:02:31 -0000      1.66
***************
*** 1,6 ****
  #! /bin/sh
  # texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
! # $Id: texi2dvi,v 1.65 2005/10/24 00:33:43 karl Exp $
  #
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
  # 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
--- 1,6 ----
  #! /bin/sh
  # texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
! # $Id: texi2dvi,v 1.66 2005/11/11 00:02:31 karl Exp $
  #
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
  # 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
***************
*** 32,38 ****
  unset RUNNING_KSH
  
  # This string is expanded by rcs automatically when this file is checked out.
! rcs_revision='$Revision: 1.65 $'
  rcs_version=`set - $rcs_revision; echo $2`
  program=`echo $0 | sed -e 's!.*/!!'`
  version="texi2dvi (GNU Texinfo 4.8) $rcs_version
--- 32,38 ----
  unset RUNNING_KSH
  
  # This string is expanded by rcs automatically when this file is checked out.
! rcs_revision='$Revision: 1.66 $'
  rcs_version=`set - $rcs_revision; echo $2`
  program=`echo $0 | sed -e 's!.*/!!'`
  version="texi2dvi (GNU Texinfo 4.8) $rcs_version
***************
*** 141,147 ****
  escape="\\"
  expand=         # t for expansion via makeinfo
  miincludes=     # makeinfo include path
! oformat=dvi
  oname=          # --output
  quiet=false     # by default let the tools' message be displayed
  recode=false
--- 141,147 ----
  escape="\\"
  expand=         # t for expansion via makeinfo
  miincludes=     # makeinfo include path
! out_lang=dvi
  oname=          # --output
  quiet=false     # by default let the tools' message be displayed
  recode=false
***************
*** 327,332 ****
--- 327,347 ----
    echo "$res"
  }
  
+ 
+ # output_base_name FILE
+ # ---------------------
+ # The name of the FILE possibly renamed to satisfy --output.
+ output_base_name ()
+ {
+   case $oname in
+     '') echo "$1";;
+      *) local out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
+       local file_ext=`echo "$1" | sed 's/^.*\.//'`
+       echo "$out_noext.$file_ext"
+       ;;
+   esac
+ }
+ 
  # move_to_dest FILE
  # -----------------
  # Move the FILE to the place where the user expects it.  FILE can be
***************
*** 334,349 ****
  # file with the same base name.
  move_to_dest ()
  {
-   local file_noext=`echo "$1" | sed 's/\.[^.]*$//'`
-   local file_ext=`echo "$1" | sed 's/^.*\.//'`
-   local out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
-   local out_ext=`echo "$oname" | sed 's/^.*\.//'`
    local dest
  
    case $tidy:$oname in
      true:)  dest=$orig_pwd;;
      false:) dest=;;
!     *:*)    dest=$out_noext.$file_ext;;
    esac
    if test ! -f "$1"; then
      fatal 1 "no such file or directory: $1"
--- 349,360 ----
  # file with the same base name.
  move_to_dest ()
  {
    local dest
  
    case $tidy:$oname in
      true:)  dest=$orig_pwd;;
      false:) dest=;;
!     *:*)    dest=$(output_base_name "$1");;
    esac
    if test ! -f "$1"; then
      fatal 1 "no such file or directory: $1"
***************
*** 395,401 ****
  xref_files_save ()
  {
    # Save copies of auxiliary files for later comparison.
!   xref_files_orig=`xref_files_get  "$filename_noext"`
    if test -n "$xref_files_orig"; then
      verbose "Backing up xref files: $xref_files_orig"
      cp $xref_files_orig "$work_bak"
--- 406,412 ----
  xref_files_save ()
  {
    # Save copies of auxiliary files for later comparison.
!   xref_files_orig=`xref_files_get  "$in_noext"`
    if test -n "$xref_files_orig"; then
      verbose "Backing up xref files: $xref_files_orig"
      cp $xref_files_orig "$work_bak"
***************
*** 413,424 ****
    # subdirs, since texi2dvi does not try to compare xref files in
    # subdirs.  Performing xref files test is still good since LaTeX
    # does not report changes in xref files.
!   grep "Rerun to get" "$filename_noext.log" >&6 2>&1 &&
      return 0
  
    # If old and new lists don't at least have the same file list,
    # then one file or another has definitely changed.
!   xref_files_new=`xref_files_get  "$filename_noext"`
    verbose "Original xref files = $xref_files_orig"
    verbose "New xref files      = $xref_files_new"
    test "x$xref_files_orig" != "x$xref_files_new" &&
--- 424,435 ----
    # subdirs, since texi2dvi does not try to compare xref files in
    # subdirs.  Performing xref files test is still good since LaTeX
    # does not report changes in xref files.
!   grep "Rerun to get" "$in_noext.log" >&6 2>&1 &&
      return 0
  
    # If old and new lists don't at least have the same file list,
    # then one file or another has definitely changed.
!   xref_files_new=`xref_files_get  "$in_noext"`
    verbose "Original xref files = $xref_files_orig"
    verbose "New xref files      = $xref_files_new"
    test "x$xref_files_orig" != "x$xref_files_new" &&
***************
*** 445,468 ****
  
  # run_tex ()
  # ----------
! # Run TeX as "$tex $filename_input", taking care of errors and logs.
  run_tex ()
  {
!   case $language:$oformat in
      latex:dvi)   tex=${LATEX:-latex};;
      latex:pdf)   tex=${PDFLATEX:-pdflatex};;
-     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
  
    # If possible, make TeX report error locations in GNU format.
    if test "${tex_help:+set}" != set; then
--- 456,494 ----
  
  # run_tex ()
  # ----------
! # Run TeX as "$tex $in_input", taking care of errors and logs.
  run_tex ()
  {
!   case $language:$out_lang in
      latex:dvi)   tex=${LATEX:-latex};;
      latex:pdf)   tex=${PDFLATEX:-pdflatex};;
      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;;
!     texinfo:pdf) tex=$PDFTEX;;
! 
!     *) fatal 1 "$out_lang not supported for $language";;
!   esac
! 
!   # Beware of aux files in subdirectories that require the
!   # subdirectory to exist.
!   case $language:$tidy in
!     latex:true)
!        sed -n 's|^[ ]*\\include{\(.*\)/.*}.*|\1|p' $in_input |
!        sort -u |
!        while read d
!        do
!        ensure_dir "$work_build/$d"
!        done
!        ;;
    esac
  
    # Note that this will be used via an eval: quote properly.
!   local cmd=$tex
  
    # If possible, make TeX report error locations in GNU format.
    if test "${tex_help:+set}" != set; then
***************
*** 487,511 ****
    # TeX's \input does not support white spaces in file names.  Our
    # intensive use of absolute file names makes this worse: the
    # enclosing directory names may include white spaces.  Improve the
!   # situation using a symbolic link.  Do not alter filename_input.
!   case $tidy:`func_dirname "$filename_input"` in
      true:*' '*)
!       _run_tex_file_name=`basename "$filename_input"`
        if test ! -f "$_run_tex_file_name"; then
!       verbose ln -sf "$filename_input"
          ln -sf "$_run_tex_file_name"
        fi
        cmd="$cmd '$_run_tex_file_name'"
        ;;
  
      *)
!       cmd="$cmd '$filename_input'"
        ;;
    esac
  
    verbose "Running $cmd ..."
    if eval "$cmd" >&5; then
!     move_to_dest "$filename_noext.$oformat"
    else
      fatal 1 "$tex exited with bad status, quitting."
    fi
--- 513,537 ----
    # TeX's \input does not support white spaces in file names.  Our
    # intensive use of absolute file names makes this worse: the
    # enclosing directory names may include white spaces.  Improve the
!   # situation using a symbolic link.  Do not alter in_input.
!   case $tidy:`func_dirname "$in_input"` in
      true:*' '*)
!       _run_tex_file_name=`basename "$in_input"`
        if test ! -f "$_run_tex_file_name"; then
!       verbose ln -sf "$in_input"
          ln -sf "$_run_tex_file_name"
        fi
        cmd="$cmd '$_run_tex_file_name'"
        ;;
  
      *)
!       cmd="$cmd '$in_input'"
        ;;
    esac
  
    verbose "Running $cmd ..."
    if eval "$cmd" >&5; then
!     move_to_dest "$in_noext.$out_lang"
    else
      fatal 1 "$tex exited with bad status, quitting."
    fi
***************
*** 535,560 ****
  {
    case $language in
      latex)   bibtex=${BIBTEX:-bibtex};;
!     texinfo) bibtex=;;
    esac
  
    # "Citation undefined" is for LaTeX, "Undefined citation" for btxmac.tex.
!   if test -n "$bibtex" \
!      && test -r "$filename_noext.aux" \
!      && test -r "$filename_noext.log" \
!      && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
!           || grep '.*Undefined citation' "$filename_noext.log" \
!           || grep 'No file .*\.bbl\.' "$filename_noext.log") \
          >&6 2>&1; \
    then
      # If using the bibunits package, we might have to run bibtex
      # on subfiles.
!     for f in "$filename_noext".aux bu[0-9]*.aux
      do
        if test -s "$f" && \
           (grep '^\\bibstyle[{]' "$f"   \
            && grep '^\\bibdata[{]' "$f" \
!           && grep '^\\citation[{]' "$f") >&6 2>&1; then
          verbose "Running $bibtex $f ..."
          $bibtex "$f" >&5 ||
            fatal 1 "$bibtex exited with bad status, quitting."
--- 561,589 ----
  {
    case $language in
      latex)   bibtex=${BIBTEX:-bibtex};;
!     texinfo) return;;
    esac
  
    # "Citation undefined" is for LaTeX, "Undefined citation" for btxmac.tex.
!   if test -r "$in_noext.aux" \
!      && test -r "$in_noext.log" \
!      && (grep 'Warning:.*Citation.*undefined' "$in_noext.log" \
!           || grep '.*Undefined citation' "$in_noext.log" \
!           || grep 'No file .*\.bbl\.' "$in_noext.log") \
          >&6 2>&1; \
    then
      # If using the bibunits package, we might have to run bibtex
      # on subfiles.
!     for f in "$in_noext".aux bu[0-9]*.aux
      do
        if test -s "$f" && \
           (grep '^\\bibstyle[{]' "$f"   \
            && grep '^\\bibdata[{]' "$f" \
!         ## The following line is suspicious: fails when there
!         ## are citations in sub aux files.  We need to be
!         ## smarter in this case.
!           ## && grep '^\\citation[{]' "$f"
!         ) >&6 2>&1; then
          verbose "Running $bibtex $f ..."
          $bibtex "$f" >&5 ||
            fatal 1 "$bibtex exited with bad status, quitting."
***************
*** 588,600 ****
  # ---------------
  run_thumbpdf ()
  {
!   if test $oformat = pdf \
!      && test -r "$filename_noext.log" \
!      && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
    then
      thumbpdf=${THUMBPDF:-thumbpdf}
!     verbose "Running $thumbpdf $filename_noext ..."
!     if $thumbpdf "$filename_noext" >&5; then
        run_tex
      else
        report "$thumbpdf exited with bad status." \
--- 617,629 ----
  # ---------------
  run_thumbpdf ()
  {
!   if test $out_lang = pdf \
!      && test -r "$in_noext.log" \
!      && grep 'thumbpdf\.sty'  "$in_noext.log" >&6 2>&1; \
    then
      thumbpdf=${THUMBPDF:-thumbpdf}
!     verbose "Running $thumbpdf $in_noext ..."
!     if $thumbpdf "$in_noext" >&5; then
        run_tex
      else
        report "$thumbpdf exited with bad status." \
***************
*** 604,616 ****
  }
  
  
! # run_tex_suite
! # -------------
  # Run the TeX tools until a fix point is reached.
  run_tex_suite ()
  {
    # Count the number of cycles.
!   cycle=0
  
    while :; do
      cycle=`expr $cycle + 1`
--- 633,645 ----
  }
  
  
! # run_tex_suite ()
! # ----------------
  # Run the TeX tools until a fix point is reached.
  run_tex_suite ()
  {
    # Count the number of cycles.
!   local cycle=0
  
    while :; do
      cycle=`expr $cycle + 1`
***************
*** 716,738 ****
      fi
  
      if test -n "$makeinfo"; then
!       # filename_src: the file with macros expanded.
        # Use the same basename to generate the same aux file names.
        work_src=$workdir/src
        ensure_dir "$work_src"
!       filename_src=$work_src/$filename_noext.$ext
  
!       verbose "Macro-expanding $command_line_filename to $filename_src ..."
        sed "$comment_iftex" "$command_line_filename" \
!         | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
            -o /dev/null --macro-expand=- \
!         | sed "$uncomment_iftex" >"$filename_src"
        # Continue only if everything succeeded.
        if test $? -ne 0 \
!          || test ! -r "$filename_src"; then
          verbose "Expansion failed, ignored...";
        else
!         filename_input=$filename_src
        fi
      fi
      ;;
--- 745,767 ----
      fi
  
      if test -n "$makeinfo"; then
!       # in_src: the file with macros expanded.
        # Use the same basename to generate the same aux file names.
        work_src=$workdir/src
        ensure_dir "$work_src"
!       in_src=$work_src/$in_base
  
!       verbose "Macro-expanding $command_line_filename to $in_src ..."
        sed "$comment_iftex" "$command_line_filename" \
!         | $makeinfo --footnote-style=end -I "$in_dir" $miincludes \
            -o /dev/null --macro-expand=- \
!         | sed "$uncomment_iftex" >"$in_src"
        # Continue only if everything succeeded.
        if test $? -ne 0 \
!          || test ! -r "$in_src"; then
          verbose "Expansion failed, ignored...";
        else
!         in_input=$in_src
        fi
      fi
      ;;
***************
*** 754,765 ****
    if test -n "$textra"; then
      # _xtr.  The file with the user's extra commands.
      work_xtr=$workdir/xtr
!     filename_xtr=$work_xtr/$filename_noext.$ext
      ensure_dir "$work_xtr"
      verbose "Inserting extra commands: $textra"
      sed "$textra_cmd\\
! $textra" "$filename_input" >"$filename_xtr"
!     filename_input=$filename_xtr
    fi
  }
  
--- 783,794 ----
    if test -n "$textra"; then
      # _xtr.  The file with the user's extra commands.
      work_xtr=$workdir/xtr
!     in_xtr=$work_xtr/$in_base
      ensure_dir "$work_xtr"
      verbose "Inserting extra commands: $textra"
      sed "$textra_cmd\\
! $textra" "$in_input" >"$in_xtr"
!     in_input=$in_xtr
    fi
  }
  
***************
*** 775,790 ****
        d
        :found
        q'
!     encoding=`sed -e "$pgm" "$filename_input"`
      if $recode && test -n "$encoding" && findprog recode; then
        verbose "Recoding from $encoding to Texinfo."
        # _rcd.  The Texinfo file recoded in 7bit.
        work_rcd=$workdir/recode
!       filename_rcd=$work_rcd/$filename_noext.$ext
        ensure_dir "$work_rcd"
!       if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
!          && test -s "$filename_rcd"; then
!         filename_input=$filename_rcd
        else
          verbose "Recoding failed, using original input."
        fi
--- 804,819 ----
        d
        :found
        q'
!     encoding=`sed -e "$pgm" "$in_input"`
      if $recode && test -n "$encoding" && findprog recode; then
        verbose "Recoding from $encoding to Texinfo."
        # _rcd.  The Texinfo file recoded in 7bit.
        work_rcd=$workdir/recode
!       in_rcd=$work_rcd/$in_base
        ensure_dir "$work_rcd"
!       if recode "$encoding"..texinfo <"$in_input" >"$in_rcd" \
!          && test -s "$in_rcd"; then
!         in_input=$in_rcd
        else
          verbose "Recoding failed, using original input."
        fi
***************
*** 816,821 ****
--- 845,895 ----
  }
  
  
+ # run_to_html ()
+ # --------------
+ # Convert to HTML.
+ run_to_html ()
+ {
+   hevea=${HEVEA:-hevea}
+ 
+   # Compiling to the tmp directory enables to preserve a previous
+   # successful compilation.  Unfortunately it makes it hard to move
+   # the image back to the destination directory.  So compile to the
+   # actual destination.
+   local to_html="$hevea -fix -noiso -O -o '$out_name' '$in_input'"
+ 
+   verbose "running $cmd"
+   if eval "$to_html" >&5; then :; else
+     fatal 1 "$hevea exited with bad status, quitting."
+   fi
+ }
+ 
+ 
+ # run_conversion ()
+ # -----------------
+ # Run the TeX tools until a fix point is reached.
+ run_conversion ()
+ {
+   # Move to the working directory.
+   if $tidy; then
+     verbose "cd $work_build"
+     cd "$work_build" || exit 1
+   fi
+ 
+   case $out_lang in
+     dvi|pdf) run_tex_suite;;
+     html   ) run_to_html;;
+   esac
+ 
+   # In case $orig_pwd is on a different drive (for DOS).
+   cd /
+ 
+   # Return to the original directory so that
+   # - the next file is processed in correct conditions
+   # - the temporary file can be removed
+   cd "$orig_pwd" || exit 1
+ }
+ 
  ## ---------------------- ##
  ## Command line parsing.  ##
  ## ---------------------- ##
***************
*** 855,860 ****
--- 929,935 ----
      -D | --debug) debug=true;;
      -e | -E | --expand) expand=t;;
      -h | --help) echo "$usage"; exit 0;;
+          --html) out_lang=html;;
      -I | --I*)
        shift
        miincludes="$miincludes -I $1"
***************
*** 868,874 ****
          /* | ?:/*) oname=$1;;
                  *) oname="$orig_pwd/$1";;
        esac;;
!     -p | --pdf) oformat=pdf;;
      -q | -s | --quiet | --silent) quiet=true; batch=true;;
      -r | --recode) recode=true;;
      -t | --texinfo | --command ) shift; textra="$textra\\
--- 943,949 ----
          /* | ?:/*) oname=$1;;
                  *) oname="$orig_pwd/$1";;
        esac;;
!     -p | --pdf) out_lang=pdf;;
      -q | -s | --quiet | --silent) quiet=true; batch=true;;
      -r | --recode) recode=true;;
      -t | --texinfo | --command ) shift; textra="$textra\\
***************
*** 984,1001 ****
  
  # 
  
! ## -------------- ##
! ## TeXify files.  ##
! ## -------------- ##
! 
! for command_line_filename in ${1+"$@"}; do
!   verbose "Processing $command_line_filename ..."
! 
!   # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
!   # prepend `./' in order to avoid that the tools take it as an option.
!   echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \
!   || command_line_filename="./$command_line_filename"
! 
    # See if we are run from within AUC-Tex, in which case we are
    # passed `\input{FOO.tex}' or even `\nonstopmode\input{FOO.tex}'.
    case $command_line_filename in
--- 1059,1081 ----
  
  # 
  
! # input_file_name_decode
! # ----------------------
! # Decode COMMAND_LINE_FILENAME, and compute:
! # - COMMAND_LINE_FILENAME clean of TeX commands
! # - IN_DIR
! #   The directory to the input file, possibly absolute if needed.
! # - IN_DIR_ABS
! #   The absolute directory of the input file.
! # - IN_BASE
! #   The input file base name (no directory part).
! # - IN_NOEXT
! #   The input file name without extensions (nor directory part).
! # - IN_INPUT
! #   Defaults to COMMAND_LINE_FILENAME, but might change if the
! #   input is preprocessed (recode etc.).  With directory, possibly absolute.
! input_file_name_decode ()
! {
    # See if we are run from within AUC-Tex, in which case we are
    # passed `\input{FOO.tex}' or even `\nonstopmode\input{FOO.tex}'.
    case $command_line_filename in
***************
*** 1011,1049 ****
        ;;
    esac
  
    # See if the file exists.  If it doesn't we're in trouble since, even
    # though the user may be able to reenter a valid filename at the tex
    # prompt (assuming they're attending the terminal), this script won't
    # be able to find the right xref files and so forth.
!   if test ! -r "$command_line_filename"; then
!     report "cannot read $command_line_filename, skipping."
!     continue
!   fi
  
    # Get the name of the current directory.
!   filename_dir=`func_dirname "$command_line_filename"`
!   filename_dir_abs=`cd "$filename_dir" >&6 && pwd`
    # In a clean build, we `cd', so get an absolute file name.
!   $tidy && filename_dir=$filename_dir_abs
  
    # Strip directory part but leave extension.
!   filename_ext=`basename "$command_line_filename"`
    # Strip extension.
!   filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
!   ext=`echo "$filename_ext" | sed 's/^.*\.//'`
  
    # The normalized file name to compile.  Must always point to the
    # file to actually compile (in case of recoding, macro-expansion etc.).
!   filename_input=$filename_dir/$filename_ext
  
    # An auxiliary directory used for all the auxiliary tasks involved
    # in compiling this document.
    case $build_dir in
!       '' | . ) t2ddir=$filename_noext.t2d ;;
        *) # Avoid collisions between multiple occurrences of the same
         # file.
!        t2ddir=$build_dir/`echo "$filename_dir_abs/" | sed 's,/,!,g'`
!        t2ddir=$t2ddir$filename_noext.t2d;;
    esac
    # Remove it at exit if clean mode.
    $clean &&
--- 1091,1153 ----
        ;;
    esac
  
+   # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
+   # prepend `./' in order to avoid that the tools take it as an option.
+   echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \
+   || command_line_filename="./$command_line_filename"
+ 
    # See if the file exists.  If it doesn't we're in trouble since, even
    # though the user may be able to reenter a valid filename at the tex
    # prompt (assuming they're attending the terminal), this script won't
    # be able to find the right xref files and so forth.
!   test  -r "$command_line_filename" ||
!     fatal 1 "cannot read $command_line_filename, skipping."
  
    # Get the name of the current directory.
!   in_dir=`func_dirname "$command_line_filename"`
!   in_dir_abs=`cd "$in_dir" >&6 && pwd`
    # In a clean build, we `cd', so get an absolute file name.
!   $tidy && in_dir=$in_dir_abs
  
    # Strip directory part but leave extension.
!   in_base=`basename "$command_line_filename"`
    # Strip extension.
!   in_noext=`echo "$in_base" | sed 's/\.[^.]*$//'`
  
    # The normalized file name to compile.  Must always point to the
    # file to actually compile (in case of recoding, macro-expansion etc.).
!   in_input=$in_dir/$in_base
! 
! 
!   # Compute the output file name.
!   if test x"$oname" != x; then
!     out_name=$oname
!   else
!     out_name=$in_noext.$out_lang
!   fi
!   out_dir=`func_dirname "$out_name"`
!   out_dir_abs=`cd $out_dir && pwd`
!   out_base=`basename "$out_name"`
!   out_noext=`echo "$out_base" | sed 's/\.[^.]*$//'`
! }
! 
! 
! ## -------------- ##
! ## TeXify files.  ##
! ## -------------- ##
! 
! for command_line_filename in ${1+"$@"}; do
!   verbose "Processing $command_line_filename ..."
! 
!   input_file_name_decode
  
    # An auxiliary directory used for all the auxiliary tasks involved
    # in compiling this document.
    case $build_dir in
!       '' | . ) t2ddir=$out_noext.t2d ;;
        *) # Avoid collisions between multiple occurrences of the same
         # file.
!        t2ddir=$build_dir/`echo "$out_dir_abs/$out_noext.t2d" | sed 's,/,!,g'`
    esac
    # Remove it at exit if clean mode.
    $clean &&
***************
*** 1056,1062 ****
    # Sometimes there are incompatibilities between auxiliary files for
    # DVI and PDF.  The contents can also change whether we work on PDF
    # and/or DVI.  So keep separate spaces for each.
!   workdir=$t2ddir/$oformat
    ensure_dir "$workdir"
  
    # _build.  In a tidy build, where the auxiliary files are output.
--- 1160,1166 ----
    # Sometimes there are incompatibilities between auxiliary files for
    # DVI and PDF.  The contents can also change whether we work on PDF
    # and/or DVI.  So keep separate spaces for each.
!   workdir=$t2ddir/$out_lang
    ensure_dir "$workdir"
  
    # _build.  In a tidy build, where the auxiliary files are output.
***************
*** 1080,1086 ****
    # etc. files in ${directory} don't get used in preference to fresher
    # files in `.'.  Include orig_pwd in case we are in clean build mode, where
    # we've cd'd to a temp directory.
!   common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
    for var in $tex_envvars; do
      eval val="\$common\$${var}_orig"
      # Convert relative paths to absolute paths, so we can run in another
--- 1184,1190 ----
    # etc. files in ${directory} don't get used in preference to fresher
    # files in `.'.  Include orig_pwd in case we are in clean build mode, where
    # we've cd'd to a temp directory.
!   common="$orig_pwd$path_sep$in_dir$path_sep$txincludes"
    for var in $tex_envvars; do
      eval val="\$common\$${var}_orig"
      # Convert relative paths to absolute paths, so we can run in another
***************
*** 1104,1132 ****
    # --recode
    run_recode
  
-   # Move to the working directory.
-   if $tidy; then
-     verbose "cd $work_build"
-     cd "$work_build" || exit 1
-   fi
- 
    # Run until a fix point is reached.
!   run_tex_suite
! 
!   # Both to make sure we can remove $t2ddir (we might have cd'd into
!   # it), and in case $orig_pwd is on a different drive (for DOS).
!   cd /
  
    # Remove temporary files.
    if $clean; then
      verbose "Removing $t2ddir"
      rm -rf "$t2ddir"
    fi
- 
-   # Return to the original directory so that
-   # - the next file is processed in correct conditions
-   # - the temporary file can be removed
-   cd "$orig_pwd" || exit 1
  done
  
  verbose "done."
--- 1208,1221 ----
    # --recode
    run_recode
  
    # Run until a fix point is reached.
!   run_conversion
  
    # Remove temporary files.
    if $clean; then
      verbose "Removing $t2ddir"
      rm -rf "$t2ddir"
    fi
  done
  
  verbose "done."
Index: util/texi2dvi.test
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi.test,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -r1.4 -r1.5
*** util/texi2dvi.test  6 Oct 2005 12:08:24 -0000       1.4
--- util/texi2dvi.test  11 Nov 2005 00:02:31 -0000      1.5
***************
*** 26,50 ****
  @bye
  EOF
  
- TEXI2DVI_pass --clean --batch input.texi
- # There should only be the DVI and the TEXI file.
- test "`list_files`" = "input.dvi input.texi"
- rm input.dvi
  
! TEXI2DVI_pass --clean --batch input.texi -o output.dvi
! # There should only be the DVI and the TEXI file.
! test "`list_files`" = "input.texi output.dvi"
! rm output.dvi
  
- TEXI2DVI_pass --build=clean --batch input.texi -o output.dvi
- # There should only be the DVI and the TEXI file.
- test "`list_files`" = "input.texi output.dvi"
- rm output.dvi
  
  TEXI2DVI_pass --build=tidy --batch input.texi -o output.dvi
  # There should only be the DVI and the TEXI file.
! test "`list_files`" = "input.t2d input.texi output.dvi"
! rm -r input.t2d output.dvi
  
  cp input.texi input2.texi
  
--- 26,51 ----
  @bye
  EOF
  
  
! for mode in --clean --build=clean
! do
!   TEXI2DVI_pass $mode --batch input.texi
!   # There should only be the DVI and the TEXI file.
!   test "`list_files`" = "input.dvi input.texi"
!   rm input.dvi
! 
!   TEXI2DVI_pass $mode --batch input.texi -o output.dvi
!   # There should only be the DVI and the TEXI file.
!   test "`list_files`" = "input.texi output.dvi"
!   rm output.dvi
! done
! 
  
  
  TEXI2DVI_pass --build=tidy --batch input.texi -o output.dvi
  # There should only be the DVI and the TEXI file.
! test "`list_files`" = "input.texi output.dvi output.t2d"
! rm -r output.t2d output.dvi
  
  cp input.texi input2.texi
  
P ChangeLog
P util/texi2dvi
P util/texi2dvi.test


reply via email to

[Prev in Thread] Current Thread [Next in Thread]