summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-01-02 21:32:25 +0000
committerKarl Berry <karl@freefriends.org>2015-01-02 21:32:25 +0000
commit90d985dd123974027ec2b4e7da30f744b803b6bd (patch)
tree35ca2b4654185ad8a3dba4e3d3b8c68a64121f5e /Build
parentb943cdf8beb44268e9ec30be3b91415d06a3609d (diff)
latexmk (2jan15)
git-svn-id: svn://tug.org/texlive/trunk@35947 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/convbkmk/convbkmk.rb10
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexmk/latexmk.pl1855
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl2
3 files changed, 1047 insertions, 820 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/convbkmk/convbkmk.rb b/Build/source/texk/texlive/linked_scripts/convbkmk/convbkmk.rb
index 66dc49095aa..c5bceb5a574 100755
--- a/Build/source/texk/texlive/linked_scripts/convbkmk/convbkmk.rb
+++ b/Build/source/texk/texlive/linked_scripts/convbkmk/convbkmk.rb
@@ -3,12 +3,12 @@
=begin
-= convbkmk Ver.0.10
+= convbkmk Ver.0.10a
- 2014.03.08
+ 2014.12.29
Takuji Tanaka
- KXD02663 (at) nifty.ne.jp
-((<URL:http://homepage3.nifty.com/ttk/comp/tex/uptex_en.html>))
+ ttk (at) t-lab.opal.ne.jp
+((<URL:http://www.t-lab.opal.ne.jp/tex/uptex_en.html>))
== Abstract
@@ -113,6 +113,8 @@ THE SOFTWARE.
* Bug fix: Conversion was not complete in some cases.
: 2014.03.08 0.10
* Bug fix: Output of binary data might be broken in filter mode on Windows.
+: 2014.12.29 0.10a
+ * Update the author's mail address and web site.
=end
diff --git a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
index 95f302d82a1..1dbe4e7c00e 100755
--- a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
+++ b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
@@ -1,7 +1,14 @@
#!/usr/bin/env perl
+# !!!!!!!!!! Don't forget to document $silence_logfile_warnings.!!!
+
# N.B. !!!!!!!!!!! See 17 July 2012 comments !!!!!!!!!!!!!!!!!!
+# Re -cd issue !!!!!!!!!!!!! SEE "??!!" COMMENTS.
+# If relative path is given for $out_dir or $aux_dir, and -cd is
+# used, should it be interpreted w.r.t. initial cwd (i.e., cwd when
+# latexmk is started), or w.r.t. to document directory???????
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# On a UNIX-like system, the above enables latexmk to run independently
# of the location of the perl executable. This line relies on the
@@ -111,12 +118,13 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.39';
-$version_details = "$My_name, John Collins, 10 Nov 2013";
+$version_num = '4.41';
+$version_details = "$My_name, John Collins, 1 January 2015";
use Config;
use File::Basename;
use File::Copy;
+use Cwd 'abs_path';
use File::Glob ':glob'; # Better glob. Does not use space as item separator.
use File::Path 2.08 qw( make_path );
use FileHandle;
@@ -147,8 +155,8 @@ else {
warn "Something wrong with the perl configuration: No signals?\n";
}
-## Copyright John Collins 1998-2013
-## (username collins at node phys.psu.edu)
+## Copyright John Collins 1998-2015
+## (username jcc8 at node psu.edu)
## (and thanks to David Coppit (username david at node coppit.org)
## for suggestions)
## Copyright Evan McLean
@@ -184,6 +192,50 @@ else {
## Modification log from 9 Dec 2011 onwards in detail
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
+##
+## 1 Jan 2015 John Collins V. 4.41
+## 18 Dec 2014 John Collins -c also deletes $deps_file if it is used.
+## 16 Dec 2014 John Collins Finish change of e-mail
+## 5 Dec 2014 John Collins Quote jobname when needed.
+## 5 Sep 2014 John Collins Change my e-mail
+## 30 Aug 2014 John Collins Change my e-mail
+## 13 Aug 2014 John Collins Try to correct error handling to avoid
+## repeated runs of latex after an error.
+## Revert to some code from v. 4-32.
+## Do I need $retry_msg?
+## 8 Aug 2014 John Collins Fix up for the making of -eps-converted-to.pdf
+## 4 Aug 2014 John Collins Sort and remove redundant xxx-undefined
+## warning lines from log file.
+## 23 Jul 2014 John Collins Fix failure when using both -cd and -output-directory
+## 22 Jul 2014 John Collins If $HOME not set, then don't read ~/.latexmkrc
+## Introduce $silence_logfile_warnings
+## 21 Jul 2014 John Collins In setting $pscmd, allow for non-existent
+### $ENV{USER}
+## 29 May 2014 John Collins Correct sub Run for internal cmd w/o arguments
+## 21 Mar 2014 John Collins Experimental: Add analysis hook for aux file.
+## But I need to change rdb_create_rule in someway to
+## allow correct handling of: (a) rule creation if
+## rule doesn't exist, (b) either no change, or rule
+## update, if the rule exists. No change is a bad
+## idea, because conditions may change. Such a
+## change, to effectively rdb_ensure_rule, would also
+## help other dependencies, e.g., if a custom
+## dependency has been created on one run of latexmk,
+## and then on another run the definition is changed.
+## With the old method, the old cus-dep is used unless
+## the dependency cache fdb_latexmk is cleared; but
+## with the new method the custom dependency will be
+## changed correctly.
+## 5 Mar 2014 John Collins System initialization files: allow them
+## to be named latexmkrc as well as LatexMk,
+## for more consistency with user directory
+## names. Keep both cases, to preserve
+## backward compatibility.
+## 30 Jan 2014 John Collins Change sign-on message. Bug report info with help. V. 4.40a
+## 15 Jan 2014 John Collins Fix failure to clean up correctly when
+## root filename contains [, which is
+## a glob metacharacter.
+## V. 4.40
## 10 Nov 2013 John Collins Change split / /, ... to split /\s*/, ...
## so as to be immune from extra white space.
## Clean up $clean_ext and $clean_full_ext by removing
@@ -361,6 +413,17 @@ $log_wrap = 79;
# (Documentation obviously needs to be improved!)
%extra_rule_spec = ();
+
+# Hooks for customized extra processing on aux files. The following
+# variable is an array of references to function. Each function is
+# invoked in turn when a line of an aux file is processed (if none
+# of the built-in actions have been done). On entry to the function,
+# the following variables are set:
+# $_ = current line of aux file
+# $rule = name of rule during the invocation of which, the aux file
+# was supposed to have been generated.
+@aux_hooks = ();
+
#########################################################################
## Default document processing programs, and related settings,
## These are mostly the same on all systems.
@@ -620,6 +683,8 @@ $quote_filenames = 1; # Quote filenames in external commands
$del_dir = ''; # Directory into which cleaned up files are to be put.
# If $del_dir is '', just delete the files
+@rc_system_files = ();
+
#########################################################################
################################################################
@@ -665,6 +730,14 @@ $MSWin_fudge_break = 1; # Give special treatment to ctrl/C and ctrl/break
# System-dependent overrides:
+# Currently, the cases I have tests for are: MSWin32, cygwin, linux and
+# darwin, with the main complications being for MSWin32 and cygwin.
+# Special treatment may also be useful for MSYS (for which $^O reports
+# "msys"). This is another *nix-emulation/system for MSWindows. At
+# present it is treated as unix-like, but the environment variables
+# are those of Windows. (The test for USERNAME as well as USER was
+# to make latexmk work under MSYS's perl.)
+#
if ( $^O eq "MSWin32" ) {
# Pure MSWindows configuration
## Configuration parameters:
@@ -676,7 +749,7 @@ if ( $^O eq "MSWin32" ) {
## List of possibilities for the system-wide initialization file.
## The first one found (if any) is used.
- @rc_system_files = ( 'C:/latexmk/LatexMk' );
+ @rc_system_files = ( "C:/latexmk/LatexMk", "C:/latexmk/latexmkrc" );
$search_path_separator = ';'; # Separator of elements in search_path
@@ -776,15 +849,19 @@ elsif ( $^O eq "cygwin" ) {
## List of possibilities for the system-wide initialization file.
## The first one found (if any) is used.
## We could stay with MSWin files here, since cygwin perl understands them
- ## @rc_system_files = ( 'C:/latexmk/LatexMk' );
+ ## @rc_system_files = ( 'C:/latexmk/LatexMk', 'C:/latexmk/latexmkrc' );
## But they are deprecated in v. 1.7. So use the UNIX version, prefixed
## with a cygwin equivalent of the MSWin location
- @rc_system_files =
- ( '/cygdrive/c/latexmk/LatexMk',
- '/opt/local/share/latexmk/LatexMk',
- '/usr/local/share/latexmk/LatexMk',
- '/usr/local/lib/latexmk/LatexMk' );
-
+ ## In addition, we need to add the same set of possible locations as with
+ ## unix, so that the user use a unix-style setup.
+ @rc_system_files = ();
+ foreach ( 'LatexMk', 'latexmkrc' ) {
+ push @rc_system_files,
+ ( "/cygdrive/c/latexmk/$_",
+ "/opt/local/share/latexmk/$_",
+ "/usr/local/share/latexmk/$_",
+ "/usr/local/lib/latexmk/$_" );
+ }
$search_path_separator = ';'; # Separator of elements in search_path
# This is tricky. The search_path_separator depends on the kind
# of executable: native NT v. cygwin.
@@ -852,13 +929,15 @@ else {
## The first one found (if any) is used.
## Normally on a UNIX it will be in a subdirectory of /opt/local/share or
## /usr/local/share, depending on the local conventions.
- ## /usr/local/lib/latexmk/LatexMk is put in the list for
+ ## But /usr/local/lib/latexmk is put in the list for
## compatibility with older versions of latexmk.
- @rc_system_files =
- ( '/opt/local/share/latexmk/LatexMk',
- '/usr/local/share/latexmk/LatexMk',
- '/usr/local/lib/latexmk/LatexMk' );
-
+ @rc_system_files = ();
+ foreach ( 'LatexMk', 'latexmkrc' ) {
+ push @rc_system_files,
+ ( "/opt/local/share/latexmk/$_",
+ "/usr/local/share/latexmk/$_",
+ "/usr/local/lib/latexmk/$_" );
+ }
$search_path_separator = ':'; # Separator of elements in search_path
$dvi_update_signal = $signo{USR1}
@@ -919,10 +998,21 @@ else {
#
# The following works on Solaris, LINUX, HP-UX, IRIX
# Use -f to get full listing, including command line arguments.
- # Use -u $ENV{CMD} to get all processes started by current user (not just
+ # Use -u $ENV{USER} to get all processes started by current user (not just
# those associated with current terminal), but none of other users'
# processes.
- $pscmd = "ps -f -u $ENV{USER}";
+ # However, the USER environment variable may not exist. Windows uses
+ # USERNAME instead. (And this propagates to a situation of
+ # unix-emulation software running under Windows.)
+ if ( exists $ENV{USER} ) {
+ $pscmd = "ps -f -u $ENV{USER}";
+ }
+ elsif ( exists $ENV{USERNAME} ) {
+ $pscmd = "ps -f -u $ENV{USERNAME}";
+ }
+ else {
+ $pscmd = "ps -f";
+ }
$pid_position = 1; # offset of PID in output of pscmd; first item is 0.
if ( $^O eq "linux" ) {
# Ps on Redhat (at least v. 7.2) appears to truncate its output
@@ -974,12 +1064,12 @@ $max_repeat = 5; # Maximum times I repeat latex. Normally
# occur, which mess up page numbers in the toc and lof,
# Hence a 4th run is conceivably necessary.
# At least one document class (JHEP.cls) works
- # in such a way that a 4th run is needed.
+ # in such a way that a 4th run is needed.
# We allow an extra run for safety for a
- # maximum of 5. Needing further runs is
- # usually an indication of a problem; further
- # runs may not resolve the problem, and
- # instead could cause an infinite loop.
+ # maximum of 5. Needing further runs is
+ # usually an indication of a problem; further
+ # runs may not resolve the problem, and
+ # instead could cause an infinite loop.
$clean_ext = ""; # space separated extensions of files that are
# to be deleted when doing cleanup, beyond
# standard set
@@ -1007,7 +1097,7 @@ $texfile_search = ""; # Specification for extra files to search for
# backward compatibility.
$fdb_ext = 'fdb_latexmk'; # Extension for the file for latexmk's
- # file-database
+ # file-database
# Make it long to avoid possible collisions.
$fdb_ver = 3; # Version number for kind of fdb_file.
@@ -1025,8 +1115,9 @@ $aux_dir = ''; # Directory for aux files (log, aux, etc).
## default flag settings.
$recorder = 1; # Whether to use recorder option on latex/pdflatex
-$silent = 0; # silence latex's messages?
-$landscape_mode = 0; # default to portrait mode
+$silent = 0; # Silence latex's messages?
+$silence_logfile_warnings = 0; # Do list warnings in log file
+$landscape_mode = 0; # default to portrait mode
# The following two arrays contain lists of extensions (without
# period) for files that are read in during a (pdf)LaTeX run but that
@@ -1062,7 +1153,7 @@ $pdf_mode = 0; # No pdf file requested to be made by pdflatex
# 2 to create pdf file by ps2pdf
# 3 to create pdf file by dvipdf
$view = 'default'; # Default preview is of highest of dvi, ps, pdf
-$sleep_time = 2; # time to sleep b/w checks for file changes in -pvc mode
+$sleep_time = 2; # time to sleep b/w checks for file changes in -pvc mode
$banner = 0; # Non-zero if we have a banner to insert
$banner_scale = 220; # Original default scale
$banner_intensity = 0.95; # Darkness of the banner message
@@ -1075,9 +1166,9 @@ $dependents_phony = 0; # Whether list(s) of dependencies includes phony targets
$deps_file = '-'; # File for dependency list output. Default stdout.
$rules_list = 0; # Whether to display list(s) of dependencies
@dir_stack = (); # Stack of pushed directories, each of form of
- # pointer to array [ cwd, good_cwd ], where
- # good_cwd differs from cwd by being converted
- # to native MSWin path when cygwin is used.
+ # pointer to array [ cwd, good_cwd ], where
+ # good_cwd differs from cwd by being converted
+ # to native MSWin path when cygwin is used.
$cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.
# $cleanup_mode = 0: no cleanup
# $cleanup_mode = 1: full cleanup
@@ -1092,8 +1183,8 @@ $cleanup_includes_cusdep_generated = 0;
# Determines whether cleanup deletes files generated by
# (pdf)latex (found from \openout lines in log file).
$diagnostics = 0;
-$dvi_filter = ''; # DVI filter command
-$ps_filter = ''; # Postscript filter command
+$dvi_filter = ''; # DVI filter command
+$ps_filter = ''; # Postscript filter command
$force_mode = 0; # =1 to force processing past errors
$go_mode = 0; # =1 to force processing regardless of time-stamps
@@ -1124,6 +1215,7 @@ $waiting = 0; # Flags whether we are in loop waiting for an event
# Used for some results of parsing log file:
$reference_changed = 0;
+$mult_defined = 0;
$bad_reference = 0;
$bad_citation = 0;
@@ -1280,7 +1372,7 @@ if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
# Rule data:
# 0: [ cmd_type, ext_cmd, int_cmd, test_kind,
# source, dest, base,
- # out_of_date, out_of_date_user,
+ # out_of_date, out_of_date_user,
# time_of_last_run, time_of_last_file_check,
# changed
# last_result, last_message,
@@ -1290,57 +1382,57 @@ if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
# cmd_type is 'primary', 'external', or 'cusdep'
# ext_cmd is string for associated external command
# with substitutions (%D for destination, %S
- # for source, %B for base of current rule,
- # %R for base of primary tex file, %T for
- # texfile name, %O for options,
+ # for source, %B for base of current rule,
+ # %R for base of primary tex file, %T for
+ # texfile name, %O for options,
# %Y for $aux_dir1, and %Z for $out_dir1
# int_cmd specifies any internal command to be
- # used to implement the application of the
- # rule. If this is present, it overrides
- # the external command, and it is the
- # responsibility of the perl subroutine
- # specified in intcmd to execute the
- # external command if this is appropriate.
- # This variable intcmd is a reference to an array,
+ # used to implement the application of the
+ # rule. If this is present, it overrides
+ # the external command, and it is the
+ # responsibility of the perl subroutine
+ # specified in intcmd to execute the
+ # external command if this is appropriate.
+ # This variable intcmd is a reference to an array,
# $$intcmd[0] = internal routine
# $$intcmd[1...] = its arguments (if any)
# test_kind specifies method of determining
# whether a file is out-of-date:
# 0 for never
# 1 for usual: whether there is a source
- # file change
+ # file change
# 2 for dest earlier than source
# 3 for method 2 at first run, 1 thereafter
# (used when don't have file data from
- # previous run).
+ # previous run).
# source = name of primary source file, if any
# dest = name of primary destination file,
- # if any
+ # if any
# base = base name, if any, of files for
- # this rule
+ # this rule
# out_of_date = 1 if it has been detected that
- # this rule needs to be run
- # (typically because a source
- # file has changed).
+ # this rule needs to be run
+ # (typically because a source
+ # file has changed).
# 0 otherwise
# out_of_date_user is like out_of_date, except
# that the detection of out-of-dateness
# has been made from a change of a
- # putative user file, i.e., one that is
- # not a generated file (e.g., aux). This
- # kind of out-of-dateness should provoke a
- # rerun whether or not there was an error
- # during a run of (pdf)LaTeX. Normally,
- # if there is an error, one should wait
- # for the user to correct the error. But
- # it is possible the error condition is
- # already corrected during the run, e.g.,
- # by the user changing a source file in
- # response to an error message.
+ # putative user file, i.e., one that is
+ # not a generated file (e.g., aux). This
+ # kind of out-of-dateness should provoke a
+ # rerun whether or not there was an error
+ # during a run of (pdf)LaTeX. Normally,
+ # if there is an error, one should wait
+ # for the user to correct the error. But
+ # it is possible the error condition is
+ # already corrected during the run, e.g.,
+ # by the user changing a source file in
+ # response to an error message.
# time_of_last_run = time that this rule was
- # last applied. (In standard units
- # from perl, to be directly compared
- # with file modification times.)
+ # last applied. (In standard units
+ # from perl, to be directly compared
+ # with file modification times.)
# time_of_last_file_check = last time that a check
# was made for changes in source files.
# changed flags whether special changes have been made
@@ -1445,8 +1537,10 @@ if ( $auto_rc_use ) {
# System rc file:
read_first_rc_file_in_list( @rc_system_files );
}
-if ( $auto_rc_use ) {
+if ( $auto_rc_use && ($HOME ne "" ) ) {
# User rc file:
+ # N.B. $HOME equals "" if latexmk couldn't determine a home directory.
+ # In that case, we shouldn't look for an rc file there.
read_first_rc_file_in_list( "$HOME/.latexmkrc" );
}
if ( $auto_rc_use ) {
@@ -1508,10 +1602,14 @@ while ($_ = $ARGV[0])
push @extra_latex_options, $1;
push @extra_pdflatex_options, $1;
}
+ elsif ( /^-logfilewarninglist$/ || /^-logfilewarnings$/ )
+ { $silence_logfile_warnings = 0; }
+ elsif ( /^-logfilewarninglist-$/ || /^-logfilewarnings-$/ )
+ { $silence_logfile_warnings = 1; }
# See above for -M
elsif (/^-MF$/) {
if ( $ARGV[0] eq '' ) {
- &exit_help( "No file name specified after -MF switch");
+ &exit_help( "No file name specified after -MF switch");
}
$deps_file = $ARGV[0];
shift;
@@ -1629,37 +1727,37 @@ while ($_ = $ARGV[0])
&exit_help( "No RC file specified after -r switch");
}
if ( -e $ARGV[0] ) {
- process_rc_file( $ARGV[0] );
+ process_rc_file( $ARGV[0] );
}
else {
- die "$My_name: RC file [$ARGV[0]] does not exist\n";
+ die "$My_name: RC file [$ARGV[0]] does not exist\n";
}
shift;
}
elsif (/^-bm$/) {
if ( $ARGV[0] eq '' ) {
- &exit_help( "No message specified after -bm switch");
+ &exit_help( "No message specified after -bm switch");
}
$banner = 1; $banner_message = $ARGV[0];
shift;
}
elsif (/^-bi$/) {
if ( $ARGV[0] eq '' ) {
- &exit_help( "No intensity specified after -bi switch");
+ &exit_help( "No intensity specified after -bi switch");
}
$banner_intensity = $ARGV[0];
shift;
}
elsif (/^-bs$/) {
if ( $ARGV[0] eq '' ) {
- &exit_help( "No scale specified after -bs switch");
+ &exit_help( "No scale specified after -bs switch");
}
$banner_scale = $ARGV[0];
shift;
}
elsif (/^-dF$/) {
if ( $ARGV[0] eq '' ) {
- &exit_help( "No dvi filter specified after -dF switch");
+ &exit_help( "No dvi filter specified after -dF switch");
}
$dvi_filter = $ARGV[0];
shift;
@@ -1692,17 +1790,30 @@ if ( $bad_options > 0 ) {
}
warn "$My_name: This is $version_details, version: $version_num.\n",
- "**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****\n"
unless $silent;
if ( ($out_dir ne '') && ($aux_dir eq '') ){
$aux_dir = $out_dir;
}
+# Initially $aux_dir and $out_dir are either absolute or relative to CURRENT
+# directory.
+# If we'll cd to directory of TeX file to do our work, we'll need to convert
+# any relative directories to absolute, to preserve the user-requested
+# directories after a cd.
+# Otherwise, we need to normalize them in our standard way (to ensure
+# standardization in the places we use them.
+
+
foreach ($out_dir, $aux_dir) {
- # Remove aliases to cwd:
- $_ = normalize_filename( $_ );
- if ($_ eq '.' ) { $_ = ''; }
+ if ($do_cd) {
+ $_ = abs_path( $_ );
+ }
+ else {
+ # Remove aliases to cwd:
+ $_ = normalize_filename( $_ );
+ if ($_ eq '.' ) { $_ = ''; }
+ }
}
# Versions terminating in directory/path separator
$out_dir1 = $out_dir;
@@ -1725,7 +1836,7 @@ foreach ( 'BIBINPUTS' ) {
$ENV{$_} = $aux_dir.$search_path_separator.$ENV{$_};
}
else {
- $ENV{$_} = $aux_dir.$search_path_separator;
+ $ENV{$_} = $aux_dir.$search_path_separator;
}
}
@@ -1792,13 +1903,13 @@ else {
# Make hash of excluded files, for easy checking:
my %excl = ();
foreach my $file (@excluded_file_list) {
- $excl{$file} = '';
+ $excl{$file} = '';
}
foreach my $file (@file_list1) {
- push( @file_list, $file) unless ( exists $excl{$file} );
+ push( @file_list, $file) unless ( exists $excl{$file} );
}
if ( !@file_list ) {
- &exit_help( "No file name specified, and I couldn't find any");
+ &exit_help( "No file name specified, and I couldn't find any");
}
}
@@ -1881,11 +1992,16 @@ if ( $recorder ) {
add_option( "-recorder", \$latex, \$pdflatex );
}
+# If the output and/or aux directories are specified: Fix the (pdf)latex
+# commands to use them, and ensure that the directories exist.
+# N.B. We are immune against cd'ing to directory of TeX file, because in
+# that case we have forced the directories to be absolute.
+
if ( $out_dir ) {
add_option( "-output-directory=\"$out_dir\"", \$latex, \$pdflatex );
if ( ! -e $out_dir ) {
warn "$My_name: making output directory '$out_dir'\n"
- if ! $silent;
+ if ! $silent;
make_path $out_dir;
}
elsif ( ! -d $out_dir ) {
@@ -1902,7 +2018,7 @@ if ( $aux_dir && ($aux_dir ne $out_dir) ) {
add_option( "-aux-directory=\"$aux_dir\"", \$latex, \$pdflatex );
if ( ! -e $aux_dir ) {
warn "$My_name: making auxiliary directory '$aux_dir'\n"
- if ! $silent;
+ if ! $silent;
make_path $aux_dir;
}
elsif ( ! -d $aux_dir ) {
@@ -1913,7 +2029,7 @@ if ( $aux_dir && ($aux_dir ne $out_dir) ) {
}
if ( $jobname ne '' ) {
- $jobstring = "--jobname=$jobname";
+ $jobstring = "--jobname=\"$jobname\"";
add_option( "$jobstring", \$latex, \$pdflatex );
}
@@ -1965,7 +2081,7 @@ if ($print_type eq 'auto') {
if ( $printout_mode ) {
$one_time{'print'} = 1;
if ($print_type eq 'none'){
- warn "$My_name: You have requested printout, but \$print_type is set to 'none'\n";
+ warn "$My_name: You have requested printout, but \$print_type is set to 'none'\n";
}
}
if ( $preview_continuous_mode || $preview_mode ) { $one_time{'view'} = 1; }
@@ -2010,15 +2126,15 @@ if ($aux_dir) {
# Ensure $aux_dir is in TEXINPUTS search path.
# This is used by dvips for files generated by mpost.
if ( ! exists $ENV{TEXINPUTS} ) {
- # Note the trailing ":" which ensures that the last item
- # in the list of paths is the empty path, which actually
- # means the default path, i.e., the following means that
- # the TEXINPUTS search path is $aux_dir and the standard
- # value.
- $ENV{TEXINPUTS} = $aux_dir.$search_path_separator;
+ # Note the trailing ":" which ensures that the last item
+ # in the list of paths is the empty path, which actually
+ # means the default path, i.e., the following means that
+ # the TEXINPUTS search path is $aux_dir and the standard
+ # value.
+ $ENV{TEXINPUTS} = $aux_dir.$search_path_separator;
}
elsif ( $ENV{TEXINPUTS} !~ /$aux_dir$search_path_separator/ ) {
- $ENV{TEXINPUTS} = $aux_dir.$search_path_separator.$ENV{TEXINPUTS};
+ $ENV{TEXINPUTS} = $aux_dir.$search_path_separator.$ENV{TEXINPUTS};
}
}
@@ -2067,21 +2183,21 @@ foreach $filename ( @file_list )
pushd( $path );
}
else {
- $path = '';
+ $path = '';
}
## remove extension from filename if was given.
if ( &find_basename($filename, $root_filename, $texfile_name) )
{
- if ( $force_mode ) {
- warn "$My_name: Could not find file [$texfile_name]\n";
- }
- else {
+ if ( $force_mode ) {
+ warn "$My_name: Could not find file [$texfile_name]\n";
+ }
+ else {
&ifcd_popd;
- &exit_msg1( "Could not find file [$texfile_name]",
- 11);
- }
+ &exit_msg1( "Could not find file [$texfile_name]",
+ 11);
+ }
}
if ($jobname ne '' ) {
$root_filename = $jobname;
@@ -2120,11 +2236,11 @@ foreach $filename ( @file_list )
$base = $path.$base;
if ( $rule =~ /^makeindex/ ) {
push @index_bibtex_generated, $$Psource, $$Pdest, "$base.ilg";
- }
+ }
elsif ( $rule =~ /^(bibtex|biber)/ ) {
push @index_bibtex_generated, $$Pdest, "$base.blg";
push @aux_files, $$Psource;
- }
+ }
elsif ( exists $other_generated{$$Psource} ) {
$other_generated{$$Pdest};
}
@@ -2140,24 +2256,24 @@ foreach $filename ( @file_list )
if $diagnostics;
# Variables set by parse_log. Can I remove them?
local %generated_log = ();
- local %dependents = (); # Maps files to status. Not used here.
- local @bbl_files = (); # Not used here.
- local %idx_files = (); # Maps idx_file to (ind_file, base). Not used here.
- local %conversions = (); # (pdf)latex-performed conversions. Not used here.
- # Maps output file created and read by (pdf)latex
- # to source file of conversion.
- local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
+ local %dependents = (); # Maps files to status. Not used here.
+ local @bbl_files = (); # Not used here.
+ local %idx_files = (); # Maps idx_file to (ind_file, base). Not used here.
+ local %conversions = (); # (pdf)latex-performed conversions. Not used here.
+ # Maps output file created and read by (pdf)latex
+ # to source file of conversion.
+ local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
&parse_log;
%other_generated = %generated_log;
- }
+ }
else {
print "$My_name: No fdb or log file, so clean up default set of files ...\n"
if $diagnostics;
- }
+ }
if ( ($go_mode == 2) && !$silent ) {
warn "$My_name: Removing all generated files\n" unless $silent;
- }
+ }
if ($bibtex_use < 2) {
delete $generated_exts_all{'bbl'};
}
@@ -2165,14 +2281,14 @@ foreach $filename ( @file_list )
my %index_bibtex_generated = ();
my %aux_files = ();
foreach (@index_bibtex_generated) {
- $index_bibtex_generated{$_} = 1
+ $index_bibtex_generated{$_} = 1
unless ( /\.bbl$/ && ($bibtex_use < 2) );
delete( $other_generated{$_} );
- }
+ }
foreach (@aux_files) {
$aux_files{$_} = 1;
delete( $other_generated{$_} );
- }
+ }
if ($diagnostics) {
show_array( "For deletion, the following were determined from fdb file or log file:\n"
." Generated (from makeindex and bibtex):",
@@ -2181,7 +2297,9 @@ foreach $filename ( @file_list )
show_array( " Other generated files:\n"
." (only deleted if \$cleanup_includes_generated is set): ",
keys %other_generated );
- }
+ show_array( " Yet other generated files:\n",
+ keys %generated_exts_all );
+ }
&cleanup1( $aux_dir1, $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
split('\s+',$clean_ext),
keys %generated_exts_all
@@ -2189,12 +2307,15 @@ foreach $filename ( @file_list )
unlink_or_move( 'texput.log', "texput.aux",
keys %index_bibtex_generated,
keys %aux_files );
+ if ( $dependents_list && ( $deps_file ne '-' ) ) {
+ unlink_or_move( $deps_file );
+ }
if ($cleanup_includes_generated) {
- unlink_or_move( keys %other_generated );
- }
+ unlink_or_move( keys %other_generated );
+ }
if ( $cleanup_includes_cusdep_generated) {
- &cleanup_cusdep_generated;
- }
+ &cleanup_cusdep_generated;
+ }
if ( $cleanup_mode == 1 ) {
&cleanup1( $out_dir1, 'dvi', 'dviF', 'ps', 'psF', 'pdf',
split('\s+', $clean_full_ext)
@@ -2254,12 +2375,12 @@ foreach $filename ( @file_list )
# previous run. So use filetime criterion for make
# instead of change from previous run, until we have
# done our own make.
- rdb_recurse( [keys %possible_primaries],
- sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
+ rdb_recurse( [keys %possible_primaries],
+ sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
);
if ( -e $log_name ) {
- rdb_for_some( [keys %possible_primaries], \&rdb_set_latex_deps );
- }
+ rdb_for_some( [keys %possible_primaries], \&rdb_set_latex_deps );
+ }
}
foreach $rule ( rdb_accessible( uniq1( keys %requested_filerules ) ) ){
# For all source files of all accessible rules,
@@ -2267,12 +2388,12 @@ foreach $filename ( @file_list )
# file, set them from disk.
rdb_one_rule ($rule, undef,
sub{ if ( $$Ptime == 0) { &rdb_update1; } }
- );
+ );
}
if ($go_mode) {
# Force everything to be remade.
- rdb_recurse( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
+ rdb_recurse( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
}
@@ -2443,16 +2564,16 @@ sub rdb_make_rule_list {
my $print_file = '';
my $print_cmd = 'NONE';
if ( $print_type eq 'dvi' ) {
- $print_file = $dvi_final;
- $print_cmd = $lpr_dvi;
+ $print_file = $dvi_final;
+ $print_cmd = $lpr_dvi;
}
elsif ( $print_type eq 'pdf' ) {
- $print_file = $pdf_final;
- $print_cmd = $lpr_pdf;
+ $print_file = $pdf_final;
+ $print_cmd = $lpr_pdf;
}
elsif ( $print_type eq 'ps' ) {
- $print_file = $ps_final;
- $print_cmd = $lpr;
+ $print_file = $ps_final;
+ $print_cmd = $lpr;
}
elsif ( $print_type eq 'none' ) {
$print_cmd = 'NONE echo NO PRINTING CONFIGURED';
@@ -2510,30 +2631,30 @@ sub rdb_set_rules {
%rule_db = ();
foreach my $Prule_list (@_) {
- foreach my $rule ( keys %$Prule_list) {
- my ( $cmd_type, $ext_cmd, $int_cmd, $source, $dest, $base, $test_kind, $PA_extra_gen ) = @{$$Prule_list{$rule}};
+ foreach my $rule ( keys %$Prule_list) {
+ my ( $cmd_type, $ext_cmd, $int_cmd, $source, $dest, $base, $test_kind, $PA_extra_gen ) = @{$$Prule_list{$rule}};
if ( ! $PA_extra_gen ) { $PA_extra_gen = []; }
- my $needs_making = 0;
- # Substitute in the filename variables, since we will use
- # those for determining filenames. But delay expanding $cmd
- # until run time, in case of changes.
- foreach ($base, $source, $dest, @$PA_extra_gen ) {
- s/%R/$root_filename/;
- s/%Y/$aux_dir1/;
- s/%Z/$out_dir1/;
- }
- foreach ($source, $dest ) {
- s/%B/$base/;
- s/%T/$texfile_name/;
- }
+ my $needs_making = 0;
+ # Substitute in the filename variables, since we will use
+ # those for determining filenames. But delay expanding $cmd
+ # until run time, in case of changes.
+ foreach ($base, $source, $dest, @$PA_extra_gen ) {
+ s/%R/$root_filename/;
+ s/%Y/$aux_dir1/;
+ s/%Z/$out_dir1/;
+ }
+ foreach ($source, $dest ) {
+ s/%B/$base/;
+ s/%T/$texfile_name/;
+ }
# print "$rule: $cmd_type, EC='$ext_cmd', IC='$int_cmd', $test_kind,\n",
# " S='$source', D='$dest', B='$base' $needs_making\n";
- rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind,
- $source, $dest, $base,
- $needs_making, undef, undef, 1, $PA_extra_gen );
+ rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind,
+ $source, $dest, $base,
+ $needs_making, undef, undef, 1, $PA_extra_gen );
# !! ?? Last line was
-# $needs_making, undef, ($test_kind==1) );
- }
+# $needs_making, undef, ($test_kind==1) );
+ }
} # End arguments of subroutine
&rdb_make_links;
} # END rdb_set_rules
@@ -2558,7 +2679,7 @@ sub rdb_make_links {
)
{ $$Pfrom_rule = $from_rules{$file};
}
- }
+ }
);
rdb_for_all(
0,
@@ -2568,9 +2689,9 @@ sub rdb_make_links {
}
if ( $$Pfrom_rule && (! rdb_rule_exists( $$Pfrom_rule ) ) ) {
$$Pfrom_rule = '';
- }
+ }
#?? print "$rule: $file, $$Pfrom_rule\n";
- }
+ }
);
} # END rdb_make_links
@@ -2615,12 +2736,12 @@ sub do_cusdep {
if ( !-e $$Psource ) {
# Source does not exist. Users of this rule will need to turn
# it off when custom dependencies are reset
- if ( !$silent ) {
+ if ( !$silent ) {
## ??? Was commented out. 1 Sep. 2008 restored, for cusdep no-file-exists issue
warn "$My_name: In trying to apply custom-dependency rule\n",
" to make '$$Pdest' from '$$Psource'\n",
" the source file has disappeared since the last run\n";
- }
+ }
# Treat as successful
}
elsif ( !$func_name ) {
@@ -2636,21 +2757,21 @@ sub do_cusdep {
" function name '$func_name' does not exists.\n";
}
else {
- my $cusdep_ret = &$func_name( $$Pbase );
+ my $cusdep_ret = &$func_name( $$Pbase );
if ( defined $cusdep_ret && ($cusdep_ret != 0) ) {
- $return = $cusdep_ret;
- if ($return) {
+ $return = $cusdep_ret;
+ if ($return) {
warn "Rule '$rule', function '$func_name'\n",
" failed with return code = $return\n";
- }
- }
+ }
+ }
elsif ( !-e $$Pdest ) {
# Destination non-existent, but routine failed to give an error
warn "$My_name: In running custom-dependency rule\n",
" to make '$$Pdest' from '$$Psource'\n",
" function '$func_name' did not make the destination.\n";
- $return = -1;
- }
+ $return = -1;
+ }
}
return $return;
} # END do_cusdep
@@ -2673,9 +2794,9 @@ sub do_viewfile {
else {
warn "$My_name is configured to make '$$Pdest' via a temporary file\n",
" but the command template '$$Pext_cmd' does not have a slot\n",
- " to set the destination file, so I won't use a temporary file\n";
+ " to set the destination file, so I won't use a temporary file\n";
$return = &Run_subst();
- }
+ }
}
else {
$return = &Run_subst();
@@ -2701,12 +2822,12 @@ sub do_update_view {
my $Pneed_to_get_viewer_process = \${$PAint_cmd}[4];
if ($viewer_update_method == 2) {
- if ($$Pneed_to_get_viewer_process) {
+ if ($$Pneed_to_get_viewer_process) {
$$Pviewer_process = &find_process_id( $$Psource );
if ($$Pviewer_process != 0) {
$$Pneed_to_get_viewer_process = 0;
- }
- }
+ }
+ }
if ($$Pviewer_process == 0) {
print "$My_name: need to signal viewer for file '$$Psource', but didn't get \n",
" process ID for some reason, e.g., no viewer, bad configuration, bug\n"
@@ -2715,8 +2836,8 @@ sub do_update_view {
elsif ( defined $viewer_update_signal) {
print "$My_name: signalling viewer, process ID $$Pviewer_process\n"
if $diagnostics ;
- kill $viewer_update_signal, $$Pviewer_process;
- }
+ kill $viewer_update_signal, $$Pviewer_process;
+ }
else {
warn "$My_name: viewer is supposed to be sent a signal\n",
" but no signal is defined. Misconfiguration or bug?\n";
@@ -2726,7 +2847,7 @@ sub do_update_view {
elsif ($viewer_update_method == 4) {
if (defined $$Pext_cmd) {
$return = &Run_subst();
- }
+ }
else {
warn "$My_name: viewer is supposed to be updated by running a command,\n",
" but no command is defined. Misconfiguration or bug?\n";
@@ -2745,7 +2866,7 @@ sub if_source {
}
else {
warn "Needed source file '$$Psource' does not exist.\n";
- return -1;
+ return -1;
}
} #END if_source
@@ -2908,7 +3029,7 @@ CHANGE:
$SIG{BREAK} = $SIG{INT} = 'IGNORE';
}
if ($compiling_cmd) {
- Run_subst( $compiling_cmd );
+ Run_subst( $compiling_cmd );
}
$failure = rdb_make( @targets );
@@ -2920,25 +3041,25 @@ CHANGE:
# Start viewer if needed.
if ( ($failure > 0) && (! $force_mode) ) {
# No viewer yet
- }
+ }
elsif ( ($view_file ne '') && (-e $view_file) && $updated && $viewer_running ) {
# A viewer is running. Explicitly get it to update screen if we have to do it:
rdb_one_rule( 'update_view', \&rdb_run1 );
}
elsif ( ($view_file ne '') && (-e $view_file) && !$viewer_running ) {
# Start the viewer
- if ( !$silent ) {
+ if ( !$silent ) {
if ($new_viewer_always) {
warn "$My_name: starting previewer for '$view_file'\n",
"------------\n";
- }
+ }
else {
warn "$My_name: I have not found a previewer that ",
"is already running. \n",
" So I will start it for '$view_file'\n",
"------------\n";
- }
- }
+ }
+ }
local $retcode = 0;
rdb_one_rule( 'view', sub { $retcode = &rdb_run1;} );
if ( $retcode != 0 ) {
@@ -2952,11 +3073,11 @@ CHANGE:
else {
$viewer_running = 1;
$$Pneed_to_get_viewer_process = 1;
- } # end analyze result of trying to run viewer
+ } # end analyze result of trying to run viewer
} # end start viewer
if ( $failure > 0 ) {
if ( !$failure_msg ) {
- $failure_msg = 'Failure to make the files correctly';
+ $failure_msg = 'Failure to make the files correctly';
}
@pre_primary = (); # Array of rules
@post_primary = (); # Array of rules
@@ -2978,12 +3099,12 @@ CHANGE:
warn "$My_name: $failure_msg\n",
" ==> You will need to change a source file before I do another run <==\n";
if ($failure_cmd) {
- Run_subst( $failure_cmd );
+ Run_subst( $failure_cmd );
}
- }
+ }
else {
if ($success_cmd) {
- Run_subst( $success_cmd );
+ Run_subst( $success_cmd );
}
}
rdb_show_rule_errors();
@@ -2997,8 +3118,8 @@ CHANGE:
}
else {
warn "Cannot open '$deps_file' for output of dependency information\n";
- }
- }
+ }
+ }
if ( $first_time || $updated || $failure ) {
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
@@ -3011,24 +3132,24 @@ CHANGE:
$have_break = 0;
WAIT: while (1) {
sleep( $sleep_time );
- if ($have_break) { last WAIT; }
+ if ($have_break) { last WAIT; }
if ( rdb_new_changes(keys %rules_to_watch) ) {
- if (!$silent) {
+ if (!$silent) {
warn "$My_name: Need to remake files.\n";
- &rdb_diagnose_changes( ' ' );
- }
+ &rdb_diagnose_changes( ' ' );
+ }
last WAIT;
- }
+ }
# Don't count waiting time in processing:
$processing_time1 = processing_time();
# Does this do this job????
local $new_files = 0;
rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_files } );
if ($new_files > 0) {
- warn "$My_name: New file(s) found.\n";
+ warn "$My_name: New file(s) found.\n";
last WAIT;
- }
- if ($have_break) { last WAIT; }
+ }
+ if ($have_break) { last WAIT; }
} # end WAIT:
&default_break;
if ($have_break) {
@@ -3078,7 +3199,7 @@ sub process_rc_file {
# PREVIOUS VERSION
# if ( ! -r $rc_file ) {
# warn "$My_name: I cannot read the rc-file '$rc_file'\n",
-# " or at least that's what Perl (for $^O) reports\n";
+# " or at least that's what Perl (for $^O) reports\n";
# return 1;
# }
# do( $rc_file );
@@ -3128,11 +3249,12 @@ sub execute_code_string {
sub cleanup1 {
# Usage: cleanup1( directory, exts_without_period, ... )
#
- # The directory is a fixed name, so I must escape any glob metacharacters
- # in it:
+ # The directory and the root file name are fixed names, so I must escape
+ # any glob metacharacters in them:
my $dir = fix_pattern( shift );
+ my $root_fixed = fix_pattern( $root_filename );
foreach (@_) {
- (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_filename/;
+ (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_fixed/;
unlink_or_move( glob( "$name" ) );
}
} #END cleanup1
@@ -3295,6 +3417,10 @@ sub print_help
" -latex=<program> - set program used for latex.\n",
" (replace '<program>' by the program name)\n",
" -latexoption=<option> - add the given option to the (pdf)latex command\n",
+ " -logfilewarninglist or -logfilewarnings \n",
+ " give list of warnings after run of (pdf)latex\n",
+ " -logfilewarninglist- or -logfilewarnings- \n",
+ " do not give list of warnings after run of (pdf)latex\n",
" -M - Show list of dependent files after processing\n",
" -MF file - Specifies name of file to receives list dependent files\n",
" -MP - List of dependent files includes phony target for each source file.\n",
@@ -3363,7 +3489,9 @@ sub print_help
" \n",
"In addition, latexmk recognizes many other options that are passed to\n",
"latex and/or pdflatex without interpretation by latexmk. Run latexmk\n",
- "with the option -showextraoptions to see a list of these\n";
+ "with the option -showextraoptions to see a list of these\n",
+ "\n",
+ "Report bugs etc to John Collins <jcc8 at psu.edu>.\n";
} #END print_help
@@ -3465,7 +3593,7 @@ sub check_biber_log {
$error_count ++;
if ( /> (FATAL|ERROR) - The file '[^']+' does not contain any citations!/ ) { #'
$no_citations++;
- }
+ }
}
}
elsif ( /> INFO - Found .* '([^']+)'\s*$/
@@ -3474,16 +3602,16 @@ sub check_biber_log {
|| /> INFO - Reading (.*)$/
|| /> INFO - Processing .* file '([^']+)' .*$/
) {
- if ( defined $Pbiber_source ) {
+ if ( defined $Pbiber_source ) {
push @$Pbiber_source, $1;
- }
+ }
}
elsif ( /> INFO - WARNINGS: ([\d]+)\s*$/ ) {
$bibers_warning_count = $1;
- }
+ }
elsif ( /> INFO - ERRORS: ([\d]+)\s*$/ ) {
$bibers_error_count = $1;
- }
+ }
}
close $log_file;
@@ -3498,7 +3626,7 @@ sub check_biber_log {
# Special treatment if sole missing file is bib file
# I don't want to treat that as an error
warn "$My_name: Biber did't find bib file [$not_found[0]]\n";
- return 5;
+ return 5;
}
else {
show_array( "$My_name: Failed to find one or more biber source files:",
@@ -3509,7 +3637,7 @@ sub check_biber_log {
}
if ($control_file_missing) {
return 6;
- }
+ }
return 4;
}
# print "$My_name: #Biber errors = $error_count, warning messages = $warning_count,\n ",
@@ -3538,13 +3666,13 @@ sub run_bibtex {
my ( $base, $path, $ext ) = fileparseA( $$Psource );
my $cwd = good_cwd();
foreach ( 'BIBINPUTS', 'BSTINPUTS' ) {
- if ( exists $ENV{$_} ) {
- $ENV{$_} = $cwd.$search_path_separator.$ENV{$_};
- }
- else {
- $ENV{$_} = $cwd.$search_path_separator;
- }
- }
+ if ( exists $ENV{$_} ) {
+ $ENV{$_} = $cwd.$search_path_separator.$ENV{$_};
+ }
+ else {
+ $ENV{$_} = $cwd.$search_path_separator;
+ }
+ }
pushd( $path );
$return = &Run_subst( undef, undef, '', $base.$ext, '', $base );
popd();
@@ -3553,7 +3681,7 @@ sub run_bibtex {
warn "$My_name: Directory in file name '$$Psource' for bibtex\n",
" but it is not the output directory '$aux_dir'\n";
$return = Run_subst();
- }
+ }
}
else {
$return = Run_subst();
@@ -3590,10 +3718,10 @@ sub check_bibtex_log {
}
elsif ( /^I couldn\'t open auxiliary file (.*\.aux)/ ) {
push @missing_aux, $1;
- }
+ }
elsif ( /^I found no \\citation commands---while reading file/ ) {
$missing_citations++;
- }
+ }
elsif (/There (were|was) (\d+) error message/) {
$error_count = $2;
#print "Bibtex error: count=$error_count $_";
@@ -3694,8 +3822,8 @@ sub parse_log {
my %cusdep_to = ();
foreach ( @cus_dep_list ) {
my ($fromext, $toext) = split;
- $cusdep_from{$fromext} = $cusdep_from{".$fromext"} = $_;
- $cusdep_to{$toext} = $cusdep_to{".$toext"} = $_;
+ $cusdep_from{$fromext} = $cusdep_from{".$fromext"} = $_;
+ $cusdep_to{$toext} = $cusdep_to{".$toext"} = $_;
}
# print "==== Cusdep from-exts:"; foreach (keys %cusdep_from) {print " '$_'";} print "\n";
# print "==== Cusdep to-exts:"; foreach (keys %cusdep_to) {print " '$_'";} print "\n";
@@ -3714,6 +3842,7 @@ sub parse_log {
# a sensible default in case of misparsing
$reference_changed = 0;
+ $mult_defined = 0;
$bad_reference = 0;
$bad_citation = 0;
@@ -3765,44 +3894,46 @@ sub parse_log {
# data structure until block is ended.)
my %new_conversions = ();
my @retries = ();
+ my $log_silent = ($silent || $silence_logfile_warnings);
+ my @warning_list = ();
LINE:
while( ($line <= $#lines) || ($#retries > -1) ) {
if ($#retries > -1) {
- $_ = pop @retries;
- }
- else {
+ $_ = pop @retries;
+ }
+ else {
$_ = $lines[$line];
$line ++;
- }
+ }
if ( /^! pdfTeX warning/ || /^pdfTeX warning/ ) {
# This kind of warning is produced by some versions of pdftex
# or produced by my reparse of warnings from other
# versions.
next;
- }
+ }
elsif ( /^(.+)(pdfTeX warning.*)$/ ) {
# Line contains a pdfTeX warnings that may have been
# inserted directly after other material without an
# intervening new line. I think pdfTeX always inserts a
# newline after the warning. (From examination of source
# code.)
- push @retries, $1;
+ push @retries, $1;
# But continue parsing the original line, in case it was a
# misparse, e.g., of a filename ending in 'pdfTeX';
- }
+ }
if ( $line == 1 ){
- if ( /^This is / ) {
- # First line OK
+ if ( /^This is / ) {
+ # First line OK
next LINE;
} else {
warn "$My_name: Error on first line of '$log_name'.\n".
"This is apparently not a TeX log file. ",
- "The first line is:\n$_\n";
+ "The first line is:\n$_\n";
$failure = 1;
$failure_msg = "Log file '$log_name' appears to have wrong format.";
return 0;
- }
- }
+ }
+ }
if ( $block_type ) {
# In middle of parsing block
if ( /^\($current_pkg\)/ ) {
@@ -3810,146 +3941,152 @@ LINE:
if ( ($block_type eq 'conversion')
&& /^\($current_pkg\)\s+Output file: <([^>]+)>/ )
{
- $delegated_output = normalize_clean_filename($1);
+ $delegated_output = normalize_clean_filename($1);
}
- next LINE;
- }
+ next LINE;
+ }
# Block has ended.
if ($block_type eq 'conversion') {
+print "=== $delegated_source -> $delegated_output\n";
$new_conversions{$delegated_source} = $delegated_output;
- }
+ }
$current_pkg = $block_type
= $delegated_source = $delegated_output = "";
# Then process current line
- }
+ }
+
# Check for changed references, bad references and bad citations:
if (/Rerun to get/) {
- warn "$My_name: References changed.\n" if ! $silent;
+ warn "$My_name: References changed.\n" if ! $log_silent;
$reference_changed = 1;
}
- if (/LaTeX Warning: (Reference[^\001]*undefined)./) {
- warn "$My_name: $1 \n" unless $silent;
- $bad_reference++;
- }
- if (/LaTeX Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n" unless $silent;
- $bad_citation++;
- }
- if (/Package natbib Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n" unless $silent;
+ if (/^LaTeX Warning: (Reference[^\001]*undefined on input line .*)\./) {
+ push @warning_list, $1;
+ $bad_reference++;
+ }
+ elsif (/^LaTeX Warning: (Label [^\001]* multiply defined.*)\./) {
+ push @warning_list, $1;
+ $mult_defined++;
+ }
+ elsif (/^LaTeX Warning: (Citation[^\001]*undefined on input line .*)\./) {
+ push @warning_list, $1;
$bad_citation++;
- }
- if ( /^Document Class: / ) {
- # Class sign-on line
- next LINE;
- }
- if ( /^\(Font\)/ ) {
- # Font info line
- next LINE;
- }
- if (/^No pages of output\./) {
+ }
+ elsif (/^Package natbib Warning: (Citation[^\001]*undefined on input line .*)\./) {
+ push @warning_list, $1;
+ $bad_citation++;
+ }
+ elsif ( /^Document Class: / ) {
+ # Class sign-on line
+ next LINE;
+ }
+ elsif ( /^\(Font\)/ ) {
+ # Font info line
+ next LINE;
+ }
+ elsif (/^No pages of output\./) {
$primary_out = '';
- warn "$My_name: Log file says no output from latex\n";
- next LINE;
- }
- if ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {
+ warn "$My_name: Log file says no output from latex\n";
+ next LINE;
+ }
+ elsif ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {
$primary_out = normalize_clean_filename($1);
- warn "$My_name: Log file says output to '$primary_out'\n"
- unless $silent;
- next LINE;
- }
- if ( /^Overfull /
- || /^Underfull /
+ warn "$My_name: Log file says output to '$primary_out'\n"
+ unless $silent;
+ next LINE;
+ }
+ elsif ( /^Overfull /
+ || /^Underfull /
|| /^or enter new name\. \(Default extension: .*\)/
|| /^\*\*\* \(cannot \\read from terminal in nonstop modes\)/
) {
- # Latex error/warning, etc.
- next LINE;
- }
- if ( /^\\openout\d+\s*=\s*\`([^\']+)\'\.$/ ) {
+ # Latex error/warning, etc.
+ next LINE;
+ }
+ elsif ( /^\\openout\d+\s*=\s*\`([^\']+)\'\.$/ ) {
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
$generated_log{normalize_force_directory( $aux_dir1, $1 )} = 1;
- next LINE;
- }
+ next LINE;
+ }
# Test for conversion produced by package:
- if ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {
- # Info. produced by epstopdf (and possibly others)
+ elsif ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {
+ # Info. produced by epstopdf (and possibly others)
# about file conversion
$current_pkg = normalize_clean_filename($1);
$delegated_source = normalize_clean_filename($2);
$block_type = 'conversion';
- next LINE;
- }
+ next LINE;
+ }
# Test for writing of index file. The precise format of the message
# depends on which package (makeidx.sty , multind.sty or index.sty) and
# which version writes the message.
- if ( /Writing index file (.*)$/ ) {
+ elsif ( /Writing index file (.*)$/ ) {
my $idx_file = '';
- if ( /^Writing index file (.*)$/ ) {
+ if ( /^Writing index file (.*)$/ ) {
# From makeidx.sty or multind.sty
$idx_file = $1;
- }
+ }
elsif ( /^index\.sty> Writing index file (.*)$/ ) {
# From old versions of index.sty
$idx_file = $1;
- }
+ }
elsif ( /^Package \S* Info: Writing index file (.*) on input line/ ) {
# From new versions of index.sty
$idx_file = $1;
- }
+ }
else {
- warn "$My_name: Message indicates index file was written\n",
- " ==> but I do not know how to understand it: <==\n",
- " '$_'\n";
+ warn "$My_name: Message indicates index file was written\n",
+ " ==> but I do not know how to understand it: <==\n",
+ " '$_'\n";
next LINE;
- }
- # Typically, there is trailing space, not part of filename:
- $idx_file =~ s/\s*$//;
+ }
+ # Typically, there is trailing space, not part of filename:
+ $idx_file =~ s/\s*$//;
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- $idx_file = normalize_force_directory( $aux_dir1, $idx_file );
- my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );
- $idx_base = $idx_path.$idx_base;
+ $idx_file = normalize_force_directory( $aux_dir1, $idx_file );
+ my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );
+ $idx_base = $idx_path.$idx_base;
$idx_file = $idx_base.$idx_ext;
- if ( $idx_ext eq '.idx' ) {
- warn "$My_name: Index file '$idx_file' was written\n"
- unless $silent;
- $idx_files{$idx_file} = [ "$idx_base.ind", $idx_base ];
- }
- elsif ( exists $cusdep_from{$idx_ext} ) {
+ if ( $idx_ext eq '.idx' ) {
+ warn "$My_name: Index file '$idx_file' was written\n"
+ unless $silent;
+ $idx_files{$idx_file} = [ "$idx_base.ind", $idx_base ];
+ }
+ elsif ( exists $cusdep_from{$idx_ext} ) {
if ( !$silent ) {
- warn "$My_name: Index file '$idx_file' was written\n";
+ warn "$My_name: Index file '$idx_file' was written\n";
warn " Cusdep '$cusdep_from{$idx_ext}' should be used\n";
}
# No action needed here
- }
- else {
- warn "$My_name: Index file '$idx_file' written\n",
- " ==> but it has an extension I do not know how to handle <==\n";
- }
+ }
+ else {
+ warn "$My_name: Index file '$idx_file' written\n",
+ " ==> but it has an extension I do not know how to handle <==\n";
+ }
- next LINE;
- }
- if ( /^No file (.*?\.bbl)./ ) {
+ next LINE;
+ }
+ elsif ( /^No file (.*?\.bbl)./ ) {
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- my $bbl_file = normalize_force_directory( $aux_dir1, $1 );
- warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
- $dependents{$bbl_file} = 0;
- push @bbl_files, $bbl_file;
- next LINE;
- }
- foreach my $pattern (@file_not_found) {
- if ( /$pattern/ ) {
+ my $bbl_file = normalize_force_directory( $aux_dir1, $1 );
+ warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
+ $dependents{$bbl_file} = 0;
+ push @bbl_files, $bbl_file;
+ next LINE;
+ }
+ foreach my $pattern (@file_not_found) {
+ if ( /$pattern/ ) {
my $file = clean_filename($1);
- warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
- unless $silent;
- $dependents{normalize_filename($file)} = 0;
- my $file1 = $file;
+ warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
+ unless $silent;
+ $dependents{normalize_filename($file)} = 0;
+ my $file1 = $file;
if ( $aux_dir ) {
# Allow for the possibility that latex generated
# a file in $aux_dir, from which the missing file can
@@ -3959,31 +4096,31 @@ LINE:
# file in $aux_dir, with a path. So give this alternate
# location.
my $file1 = normalize_force_directory( $aux_dir1, $file );
- $dependents{$file1} = 0;
- }
- next LINE;
- }
- }
- if ( /^File: (.+) Graphic file \(type / ) {
- # First line of message from includegraphics/x
- $dependents{normalize_clean_filename($1)} = 1;
- next LINE;
- }
- # Now test for generic lines to ignore, only after special cases!
- if ( /^File: / ) {
- # Package sign-on line. Includegraphics/x also produces a line
- # with this signature, but I've already handled it.
- next LINE;
- }
- if ( /^Package: / ) {
- # Package sign-on line
- next LINE;
- }
- if (/^\! LaTeX Error: / ) {
- next LINE;
- }
+ $dependents{$file1} = 0;
+ }
+ next LINE;
+ }
+ }
+ if ( /^File: (.+) Graphic file \(type / ) {
+ # First line of message from includegraphics/x
+ $dependents{normalize_clean_filename($1)} = 1;
+ next LINE;
+ }
+ # Now test for generic lines to ignore, only after special cases!
+ if ( /^File: / ) {
+ # Package sign-on line. Includegraphics/x also produces a line
+ # with this signature, but I've already handled it.
+ next LINE;
+ }
+ if ( /^Package: / ) {
+ # Package sign-on line
+ next LINE;
+ }
+ if (/^\! LaTeX Error: / ) {
+ next LINE;
+ }
if ( m[^! I can't write on file `(.*)/([^/']*)'.\s*$] ) {
- my $dir = $1;
+ my $dir = $1;
my $file = $2;
my $full_dir = $aux_dir1.$dir;
if ( ($aux_dir ne '') && (! -e $full_dir) && ( $file =~ /\.aux$/) ) {
@@ -3991,13 +4128,13 @@ LINE:
" I'll try to make the subdirectory later.\n"
if $diagnostics;
push @missing_subdirs, $full_dir;
- }
+ }
else {
warn "$My_name: ====== There were problems writing to",
"----- '$file' in '$full_dir'.\n",
"----- But this is not the standard situation of\n",
"----- aux file to subdir of output directory, with\n",
- "----- non-existent subdir\n",
+ "----- non-existent subdir\n",
}
}
INCLUDE_CANDIDATE:
@@ -4026,23 +4163,23 @@ LINE:
# anymore.
#
# Solution: use ' [', but not '[' as first try at delimiter.
- # Then if candidate filename is of form 'name1[name2]', then
- # try splitting it. If 'name1' and/or 'name2' exists, put
- # it/them in list, else just put 'name1[name2]' in list.
- # So form of filename is now:
- # '(',
- # then any number of characters that are NOT ')', '(', or '{'
- # (these form the filename);
- # then ' [', or ' (', or ')', or end-of-string.
- # That fails for pdflatex
- # In log file:
- # '(' => start of reading of file, followed by filename
- # ')' => end of reading of file
- # '[' => start of page (normally preceeded by space)
- # Remember:
- # filename (on VAX/VMS) may include '[' and ']' (directory
- # separators)
- # filenames (on MS-Win) commonly include space.
+ # Then if candidate filename is of form 'name1[name2]', then
+ # try splitting it. If 'name1' and/or 'name2' exists, put
+ # it/them in list, else just put 'name1[name2]' in list.
+ # So form of filename is now:
+ # '(',
+ # then any number of characters that are NOT ')', '(', or '{'
+ # (these form the filename);
+ # then ' [', or ' (', or ')', or end-of-string.
+ # That fails for pdflatex
+ # In log file:
+ # '(' => start of reading of file, followed by filename
+ # ')' => end of reading of file
+ # '[' => start of page (normally preceeded by space)
+ # Remember:
+ # filename (on VAX/VMS) may include '[' and ']' (directory
+ # separators)
+ # filenames (on MS-Win) commonly include space.
# filenames on UNIX can included space.
# Miktex quotes filenames
# But web2c doesn't. Then
@@ -4052,15 +4189,15 @@ LINE:
# are rare. System filenames with spaces are common, but
# they are normally followed by a newline rather than messages.
- # First step: replace $_ by whole of line after the '('
- # Thus $_ is putative filename followed by other stuff.
+ # First step: replace $_ by whole of line after the '('
+ # Thus $_ is putative filename followed by other stuff.
$_ = $1;
# Array of new candidate include files; sometimes more than one.
my @new_includes = ();
my $quoted = 0;
if ( /^\"([^\"]+)\"/ ) {
# Quoted file name, as from MikTeX
- $quoted = 1;
+ $quoted = 1;
}
elsif ( /^([^\(^\)]*?)\s+[\[\{\<]/ ) {
# Terminator: space then '[' or '{' or '<'
@@ -4074,7 +4211,7 @@ LINE:
elsif ( /^([^\(^\)]*)(\))/ ) {
# Terminator is ')'
}
- else {
+ else {
#Terminator is end-of-string
}
$_ = $'; # Put $_ equal to the unmatched tail of string '
@@ -4085,7 +4222,7 @@ LINE:
# followed by space followed by message
# (Common)
push @new_includes, $1;
- }
+ }
if ( $include_candidate eq "[]" ) {
# Part of overfull hbox message
next INCLUDE_CANDIDATE;
@@ -4105,32 +4242,32 @@ LINE:
# If the first component exists, we probably have the
# pdflatex form
push @new_includes, $1, $2;
- }
+ }
else {
# We have something else.
# So leave the original candidate in the list
- }
- }
- INCLUDE_NAME:
+ }
+ }
+ INCLUDE_NAME:
foreach my $include_name (@new_includes) {
$include_name = normalize_filename( $include_name );
- my ($base, $path, $ext) = fileparseB( $include_name );
+ my ($base, $path, $ext) = fileparseB( $include_name );
if ( ($path eq './') || ($path eq '.\\') ) {
$include_name = $base.$ext;
- }
+ }
if ( $include_name !~ m'[/|\\]' ) {
# Filename does not include a path character
# High potential for misparsed line
- $dependents{$include_name} = 2;
- } else {
- $dependents{$include_name} = 3;
- }
- if ( $ext eq '.bbl' ) {
- warn "$My_name: Found input bbl file '$include_name'\n"
- unless $silent;
- push @bbl_files, $include_name;
- }
- } # INCLUDE_NAME
+ $dependents{$include_name} = 2;
+ } else {
+ $dependents{$include_name} = 3;
+ }
+ if ( $ext eq '.bbl' ) {
+ warn "$My_name: Found input bbl file '$include_name'\n"
+ unless $silent;
+ push @bbl_files, $include_name;
+ }
+ } # INCLUDE_NAME
} # INCLUDE_CANDIDATE
} # LINE
@@ -4155,16 +4292,16 @@ CANDIDATE:
}
elsif ( -e $candidate ) {
if ( exists $generated_log{$candidate} ){
- $dependents{$candidate} = 6;
- }
+ $dependents{$candidate} = 6;
+ }
elsif ($code == 0) {
- $dependents{$candidate} = 5;
- }
- else {
- $dependents{$candidate} = 4;
- }
- }
- elsif ($code == 1) {
+ $dependents{$candidate} = 5;
+ }
+ else {
+ $dependents{$candidate} = 4;
+ }
+ }
+ elsif ($code == 1) {
# Graphics file that is supposed to have been read.
# Candidate name is as given in source file, not as path
# to actual file.
@@ -4173,14 +4310,14 @@ CANDIDATE:
# If the file still is not found, assume non-existent;
my @kpse_result = kpsewhich( $candidate );
if ($#kpse_result > -1) {
- delete $dependents{$candidate};
+ delete $dependents{$candidate};
$dependents{$kpse_result[0]} = 4;
- next CANDIDATE;
- }
- else {
- push @not_found, $candidate;
- }
- }
+ next CANDIDATE;
+ }
+ else {
+ push @not_found, $candidate;
+ }
+ }
elsif ($code == 2) {
# Candidate is from '(...' construct in log file, for input file
# which should include pathname if valid input file.
@@ -4188,9 +4325,9 @@ CANDIDATE:
# $code==2.
# We get here if candidate file does not exist with given name
# Almost surely result of a misparsed line in log file.
- delete $dependents{$candidate};
+ delete $dependents{$candidate};
push @misparse, $candidate;
- }
+ }
elsif ($code == 3) {
# Candidate is from '(...' construct in log file, for input file
# which should include pathname if valid input file.
@@ -4200,10 +4337,10 @@ CANDIDATE:
# given name.
# Almost surely result of a misparsed line in log file.
# But with lower probability than $code == 2
- delete $dependents{$candidate};
+ delete $dependents{$candidate};
push @misparse, $candidate;
- }
- elsif ($code == 0) {
+ }
+ elsif ($code == 0) {
my ($base, $path, $ext) = fileparseA($candidate);
$ext =~ s/^\.//;
if ( ($ext eq '') && (-e "$path$base.tex") ) {
@@ -4214,16 +4351,16 @@ CANDIDATE:
# to the missing file, unless the .tex file was
# created during the run.
# OLD $dependents{"$path$base.tex"} = 4;
- # OLD delete $dependents{$candidate};
+ # OLD delete $dependents{$candidate};
# NEW:
- $dependents{"$path$base.tex"} = 4;
- }
- push @missing, $candidate;
- }
+ $dependents{"$path$base.tex"} = 4;
+ }
+ push @missing, $candidate;
+ }
}
CANDIDATE_PAIR:
foreach my $delegated_source (keys %new_conversions) {
- my $delegated_output = $new_conversions{$delegated_source};
+ my $delegated_output = $new_conversions{$delegated_source};
my $rule = "Delegated $delegated_source, $delegated_output";
# N.B. $delegated_source eq '' means the output file
# was created without a named input file.
@@ -4234,30 +4371,35 @@ CANDIDATE_PAIR:
my @kpse_result = kpsewhich( $candidate,);
if ($#kpse_result > -1) {
$candidate = $kpse_result[0];
- }
- }
- }
+ }
+ }
+ }
if ( ( (-e $delegated_source) || ($delegated_source eq '') )
&& (-e $delegated_output) )
{
- $conversions{$delegated_output} = $delegated_source;
- $dependents{$delegated_output} = 7;
+ $conversions{$delegated_output} = $delegated_source;
+ $dependents{$delegated_output} = 7;
if ($delegated_source) {
$dependents{$delegated_source} = 4;
- }
- }
- elsif (!$silent) {
+ }
+ }
+ elsif (!$silent) {
print "Logfile claimed conversion from '$delegated_source' ",
- "to '$delegated_output'. But:\n";
+ "to '$delegated_output'. But:\n";
if (! -e $delegated_output) {
- print " Output file does not exist\n";
- }
+ print " Output file does not exist\n";
+ }
if ( ($delegated_source ne '') && (! -e $delegated_source) ) {
- print " Input file does not exist\n";
- }
- }
+ print " Input file does not exist\n";
+ }
+ }
}
+ if ( ($#warning_list >= 0) && !$log_silent ) {
+ @warning_list = uniqs( @warning_list );
+ show_array( "$My_name: List of undefined refs and citations:",
+ @warning_list );
+ }
if ( $diagnostics ) {
@misparse = uniqs( @misparse );
@@ -4274,22 +4416,22 @@ CANDIDATE_PAIR:
print "$dependents dependent files detected, of which ",
"$exist exist, $not_found were not found,\n",
- " and $missing appear not to exist.\n";
+ " and $missing appear not to exist.\n";
print "Dependents:\n";
foreach (@dependents) {
print " '$_' ";
if ( $dependents{$_} == 6 ) { print " written by (pdf)latex";}
if ( $dependents{$_} == 7 ) { print " converted by (pdf)latex";}
- print "\n";
+ print "\n";
}
if ($not_found > 0) {
- print "Not found:\n";
- foreach (@not_found) { print " $_\n"; }
- }
+ print "Not found:\n";
+ foreach (@not_found) { print " $_\n"; }
+ }
if ($missing > 0) {
- print "Not existent:\n";
- foreach (@missing) { print " $_\n"; }
- }
+ print "Not existent:\n";
+ foreach (@missing) { print " $_\n"; }
+ }
if ( $bbl > 0 ) {
print "Input bbl files:\n";
foreach (@bbl_files) { print " $_\n"; }
@@ -4335,12 +4477,12 @@ sub parse_fls {
if ( (exists $$Poutputs{$file}) && (! exists $$Pinputs{$file}) ) {
$$Pfirst_read_after_write{$file} = 1;
}
- $$Pinputs{$file} = 1;
- }
+ $$Pinputs{$file} = 1;
+ }
elsif (/^\s*OUTPUT\s+(.*)$/) {
# Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
- $$Poutputs{ normalize_filename( $1 )} = 1;
- }
+ $$Poutputs{ normalize_filename( $1 )} = 1;
+ }
}
close( $fls_file );
return 0;
@@ -4515,7 +4657,12 @@ AUX_LINE:
}
elsif ( /^\\\@input\{(.*)\}/ ) {
# \\@input{next_aux_file_name}
- &parse_aux1( $aux_dir1.$1 );
+ &parse_aux1( $aux_dir1.$1 );
+ }
+ else {
+ foreach my $Psub (@aux_hooks) {
+ &$Psub;
+ }
}
}
close($aux_fh);
@@ -4563,8 +4710,8 @@ sub fdb_get {
if ( ! defined $check_time ) { $check_time = 0;}
my ($new_time, $new_size) = get_time_size($file);
my @nofile = (0,-1,0); # What we use for initializing
- # a new entry in fdb or flagging
- # non-existent file
+ # a new entry in fdb or flagging
+ # non-existent file
if ( $new_size < 0 ) {
delete $fdb_current{$file};
return @nofile;
@@ -4658,41 +4805,41 @@ LINE:
s/^\s*//;
s/\s*$//;
if ($state == -1) {
- if ( ! /^# Fdb version ([\d]+)$/ ) {
- warn "$My_name: File-database '$in_name' is not of correct format\n";
+ if ( ! /^# Fdb version ([\d]+)$/ ) {
+ warn "$My_name: File-database '$in_name' is not of correct format\n";
return 1;
- }
+ }
if ( $1 > $fdb_ver) {
- warn "$My_name: File-database '$in_name' is of too new version, $1 > $fdb_ver\n";
+ warn "$My_name: File-database '$in_name' is of too new version, $1 > $fdb_ver\n";
return 1;
- }
+ }
$state = 0;
}
# Ignore blank lines and comments
if ( /^$/ || /^#/ || /^%/ ) { next LINE;}
if ( /^\[\"([^\"]+)\"\]/ ) {
# Start of section
- $rule = $1;
+ $rule = $1;
my $tail = $'; #' Single quote in comment tricks the parser in
# emacs from misparsing an isolated single quote
$run_time = $check_time = 0;
$source = $dest = $base = '';
if ( $tail =~ /^\s*(\S+)\s*$/ ) {
$run_time = $1;
- }
+ }
elsif ( $tail =~ /^\s*(\S+)\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s*$/ ) {
$run_time = $1;
$source = $2;
$dest = $3;
$base = $4;
- }
+ }
elsif ( $tail =~ /^\s*(\S+)\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s+(\S+)\s*$/ ) {
$run_time = $1;
$source = $2;
$dest = $3;
$base = $4;
$check_time = $5;
- }
+ }
if ( rdb_rule_exists( $rule ) ) {
rdb_one_rule( $rule,
sub{
@@ -4701,7 +4848,7 @@ LINE:
$$Pcheck_time = $check_time;
}
);
- }
+ }
elsif ($rule =~ /^cusdep\s+(\S+)\s+(\S+)\s+(.+)$/ ) {
# Create custom dependency
my $fromext = $1;
@@ -4721,7 +4868,7 @@ LINE:
# lines of the fdb file
rdb_create_rule( $rule, 'cusdep', '', $PAnew_cmd, 1,
$source, $dest, $base, 0, $run_time, $check_time, 1 );
- }
+ }
elsif ( $rule =~ /^(makeindex|bibtex|biber)\s*(.*)$/ ) {
my $PA_extra_gen = [];
my $rule_generic = $1;
@@ -4735,85 +4882,85 @@ LINE:
$base = $path.$base;
if ($rule_generic eq 'makeindex') {
$dest = "$base.ind";
- }
+ }
elsif ($rule_generic eq 'bibtex') {
$dest = "$base.bbl";
$source = "$base.aux";
- }
+ }
elsif ($rule_generic eq 'biber') {
$dest = "$base.bbl";
$source = "$base.bcf";
- }
- }
+ }
+ }
if ($rule =~ /^makeindex/) { $PA_extra_gen = [ "$base.ilg" ]; }
if ($rule =~ /^(bibtex|biber)/) { $PA_extra_gen = [ "$base.blg" ]; }
if ($rule =~ /^bibtex/) { $int_cmd = "run_bibtex"; }
- warn "$My_name: File-database '$in_name': setting rule '$rule'\n"
+ warn "$My_name: File-database '$in_name': setting rule '$rule'\n"
if $diagnostics;
my $cmd_type = 'external';
my $ext_cmd = ${$rule_generic};
- warn " Rule kind = '$rule_generic'; ext_cmd = '$ext_cmd';\n",
+ warn " Rule kind = '$rule_generic'; ext_cmd = '$ext_cmd';\n",
" int_cmd = '$int_cmd';\n",
- " source = '$source'; dest = '$dest'; base = '$base';\n"
+ " source = '$source'; dest = '$dest'; base = '$base';\n"
if $diagnostics;
# Set source file as non-existent.
# If it existed on last run, it will be in later
# lines of the fdb file
rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, 1,
$source, $dest, $base, 0, $run_time, $check_time, 1, $PA_extra_gen );
- }
+ }
else {
- warn "$My_name: In file-database '$in_name' rule '$rule'\n",
+ warn "$My_name: In file-database '$in_name' rule '$rule'\n",
" is not in use in this session\n"
if $diagnostics;
- $new_source = undef;
- $state = 10;
- next LINE;
- }
+ $new_source = undef;
+ $state = 10;
+ next LINE;
+ }
$new_source = $new_sources{$rule} = {};
- $state = 1; #Reading a section, source part
- }
+ $state = 1; #Reading a section, source part
+ }
elsif ( ($state <=0) || ($state >= 3) ) {
next LINE;
- }
+ }
elsif ( /^\(source\)/ ) { $state = 1; next LINE; }
elsif ( /^\(generated\)/ ) { $state = 2; next LINE; }
- elsif ( ($state == 1) && /^\"([^\"]*)\"\s+(\S+)\s+(\S+)\s+(\S+)\s+\"([^\"]*)\"/ ) {
+ elsif ( ($state == 1) && /^\"([^\"]*)\"\s+(\S+)\s+(\S+)\s+(\S+)\s+\"([^\"]*)\"/ ) {
# Source file line
- my $file = $1;
- my $time = $2;
- my $size = $3;
- my $md5 = $4;
+ my $file = $1;
+ my $time = $2;
+ my $size = $3;
+ my $md5 = $4;
my $from_rule = $5;
#?? print " --- File '$file'\n";
if ($state != 1) {
warn "$My_name: In file-database '$in_name' ",
- "line $. is outside a section:\n '$_'\n";
- $errors++;
- next LINE;
- }
+ "line $. is outside a section:\n '$_'\n";
+ $errors++;
+ next LINE;
+ }
# Set file in database. But ensure we don't do an unnecessary
# fdb_get, which can trigger a new MD5 calculation, which is
# lengthy for a big file. Ininitially flagging the file
# as non-existent solves the problem:
- rdb_ensure_file( $rule, $file, undef, 1 );
+ rdb_ensure_file( $rule, $file, undef, 1 );
rdb_set_file1( $rule, $file, $time, $size, $md5 );
fdb_set( $file, $time, $size, $md5 );
# Save the rest of the data, especially the from_fule until we know all
# the rules, otherwise the from_rule may not exist.
# Also we'll have a better chance of looping through files.
- ${$new_source}{$file} = [ $time, $size, $md5, $from_rule ];
- }
- elsif ( ($state == 2) && /^\"([^\"]*)\"/ ) {
+ ${$new_source}{$file} = [ $time, $size, $md5, $from_rule ];
+ }
+ elsif ( ($state == 2) && /^\"([^\"]*)\"/ ) {
my $file = $1;
rdb_one_rule( $rule, sub{ rdb_add_generated($file); } );
}
- else {
- warn "$My_name: In file-database '$in_name' ",
+ else {
+ warn "$My_name: In file-database '$in_name' ",
"line $. is of wrong format:\n '$_'\n";
- $errors++;
- next LINE;
- }
+ $errors++;
+ next LINE;
+ }
}
undef $in_handle;
# Set cus dependencies.
@@ -4863,7 +5010,7 @@ sub rdb_write {
\@rules,
sub {
# Omit data on a unused and never-run primary rule:
- if ( ($$Prun_time == 0)
+ if ( ($$Prun_time == 0)
&& exists( $possible_primaries{$rule} )
&& ! exists( $current_primaries{$rule} )
)
@@ -4873,7 +5020,7 @@ sub rdb_write {
print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" $$Pcheck_time\n";
rdb_do_files(
sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; }
- );
+ );
print $out_handle " (generated)\n";
foreach (keys %$PHdest) {
print $out_handle " \"$_\"\n";
@@ -4895,7 +5042,7 @@ sub rdb_set_latex_deps {
# Rules should only be primary
if ( $$Pcmd_type ne 'primary' ) {
- warn "\n$My_name: ==========$My_name: Probable BUG======= \n ",
+ warn "\n$My_name: ==========$My_name: Probable BUG======= \n ",
" rdb_set_latex_deps called to set files ",
"for non-primary rule '$rule'\n\n";
return;
@@ -4923,7 +5070,13 @@ sub rdb_set_latex_deps {
local @missing_subdirs = (); # Missing subdirectories in aux_dir
# The following are also returned, but are global, to be used by caller
- # $reference_changed, $bad_reference $bad_citation
+ # $reference_changed, $bad_reference $bad_citation, $mult_defined
+
+ # Do I have my own eps-to-pdf conversion?
+ my $epspdf_cusdep = 0;
+ foreach (@cus_dep_list) {
+ if ( /^eps pdf / ) { $epspdf_cusdep = 1; last; }
+ }
&parse_log;
$missing_dirs = 'none'; # Status of missing directories
@@ -4933,30 +5086,30 @@ sub rdb_set_latex_deps {
foreach my $dir ( uniqs( @missing_subdirs ) ) {
if ( -d $dir ) {
$missing_dirs = 'failure';
- warn "$My_name: ==== Directory '$dir' is said to be missing\n",
- " But it exists!\n";
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But it exists!\n";
}
elsif ( (-e $dir) && (!-d $dir) ) {
$missing_dirs = 'failure';
- warn "$My_name: ==== Directory '$dir' is said to be missing\n",
- " But a non-directory file of this name exists!\n";
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But a non-directory file of this name exists!\n";
}
else {
if (mkdir $dir) {
warn "$My_name: Directory '$dir' created\n";
- }
+ }
else {
$missing_dirs = 'failure';
warn "$My_name: Couldn't create directory '$dir'.\n",
" System error: '$!'\n";
- }
+ }
}
}
- }
+ }
else {
$missing_dirs = 'not allowed';
warn "$My_name: There are missing subdirectories, but their creation\n",
- " is not allowed. The subdirectories are:\n";
+ " is not allowed. The subdirectories are:\n";
foreach my $dir ( uniqs( @missing_subdirs ) ) {
warn " '$dir'\n";
}
@@ -4968,14 +5121,35 @@ sub rdb_set_latex_deps {
parse_fls( $fls_file, \%source_fls, \%generated_fls, \%first_read_after_write );
foreach (keys %source_fls) {
$dependents{$_} = 4;
- }
+ }
foreach (keys %generated_fls) {
rdb_add_generated( $_ );
if ( exists($dependents{$_}) ) {
$dependents{$_} = 6;
- }
+ }
}
}
+
+ for my $conv (sort keys %conversions) {
+ my $conv_source = $conversions{$conv};
+ if ( $conv =~ /^(.*)-eps-converted-to\.pdf$/ ) {
+ # Check all the conditions for pdflatex's conversion eps to pdf
+ # are valid; if they are, treat the converted file as not a
+ # source file.
+ my $base = $1;
+ if ( (-e $conv_source) && (-e $conv) && ( $conv_source eq "$base.eps" ) ) {
+ # $conv isn't a real source of (pdf)latex
+ rdb_remove_files( $rule, $conv );
+ delete $dependents{$conv};
+ if ($epspdf_cusdep) {
+ $dependents{"$base.pdf"} = ((-e "$base.pdf") ? 4 : 0 );
+ }
+ }
+ }
+ }
+
+
+
# ?? !! Should also deal with .run.xml file
# Handle result on output file:
@@ -5003,7 +5177,7 @@ sub rdb_set_latex_deps {
IDX_FILE:
foreach my $idx_file ( keys %idx_files ) {
- my ($ind_file, $ind_base) = @{$idx_files{$idx_file}};
+ my ($ind_file, $ind_base) = @{$idx_files{$idx_file}};
my $from_rule = "makeindex $idx_file";
if ( ! rdb_rule_exists( $from_rule ) ){
print "!!!===Creating rule '$from_rule': '$ind_file' from '$idx_file'\n"
@@ -5013,7 +5187,7 @@ sub rdb_set_latex_deps {
print " ===Source file '$ind_file' for '$rule'\n"
if ($diagnostics);
rdb_ensure_file( $rule, $ind_file, $from_rule );
- }
+ }
# Make sure the .ind file is treated as a detected source file;
# otherwise if the log file has it under a different name (as
# with MiKTeX which gives full directory information), there
@@ -5023,13 +5197,14 @@ sub rdb_set_latex_deps {
if ( ! -e $ind_file ) {
# Failure was non-existence of makable file
# Leave failure issue to other rules.
- $failure = 0;
- }
+ $failure = 0;
+ }
}
+ local %processed_aux_files = ();
BBL_FILE:
foreach my $bbl_file ( uniqs( @bbl_files ) ) {
- my ($bbl_base, $bbl_path, $bbl_ext) = fileparseA( $bbl_file );
+ my ($bbl_base, $bbl_path, $bbl_ext) = fileparseA( $bbl_file );
$bbl_base = $bbl_path.$bbl_base;
my @new_bib_files = ();
my @new_aux_files = ();
@@ -5038,7 +5213,7 @@ sub rdb_set_latex_deps {
my $bib_program = 'bibtex';
if ( test_gen_file( "$bbl_base.bcf" ) ) {
$bib_program = 'biber';
- }
+ }
my $from_rule = "$bib_program $bbl_base";
print "======= Dealing with '$from_rule'\n" if ($diagnostics);
if ($bib_program eq 'biber') {
@@ -5056,12 +5231,12 @@ sub rdb_set_latex_deps {
if ( $bib_program eq 'biber' ) {
rdb_create_rule( $from_rule, 'external', $biber, '', 1,
"$bbl_base.bcf", $bbl_file, $bbl_base, 1, 0, 0 );
- }
+ }
else {
rdb_create_rule( $from_rule, 'external', $bibtex, 'run_bibtex', 1,
"$bbl_base.aux", $bbl_file, $bbl_base, 1, 0, 0 );
- }
- }
+ }
+ }
local %old_sources = ();
rdb_one_rule( $from_rule, sub { %old_sources = %$PHsource; } );
foreach my $source ( @new_bib_files, @new_aux_files, @new_bst_files, @biber_source ) {
@@ -5070,6 +5245,9 @@ sub rdb_set_latex_deps {
rdb_ensure_file( $from_rule, $source );
delete $old_sources{$source};
}
+ foreach my $source ( @new_aux_files ) {
+ $processed_aux_files{$source} = 1;
+ }
if ($diagnostics) {
foreach ( keys %old_sources ) {
print "Removing no-longer-needed dependent '$_' from rule '$from_rule'\n";
@@ -5083,14 +5261,24 @@ sub rdb_set_latex_deps {
# Failure was non-existence of makable file
# Leave failure issue to other rules.
$failure = 0;
- }
+ }
+ }
+
+ if ( ($#aux_hooks > -1) && ! exists $processed_aux_files{$aux_main} ) {
+ my @new_bib_files = ();
+ my @new_aux_files = ();
+ my @new_bst_files = ();
+ parse_aux( $aux_main, \@new_bib_files, \@new_aux_files, \@new_bst_files );
+ foreach my $source ( @new_aux_files ) {
+ $processed_aux_files{$source} = 1;
+ }
}
NEW_SOURCE:
- foreach my $new_source (keys %dependents, keys %conversions) {
+ foreach my $new_source (keys %dependents) {
print " ===Source file for rule '$rule': '$new_source'\n"
- if ($diagnostics);
- if ( ($dependents{$new_source} == 5)
+ if ($diagnostics);
+ if ( ($dependents{$new_source} == 5)
|| ($dependents{$new_source} == 6)
) {
# (a) File was detected in "No file..." line in log file.
@@ -5104,37 +5292,37 @@ NEW_SOURCE:
# database, then the previous version of the file should be
# treated as non-existent, to ensure another run is forced.
rdb_ensure_file( $rule, $new_source, undef, 1 );
- }
- elsif ( $dependents{$new_source} == 7 ) {
+ }
+ elsif ( $dependents{$new_source} == 7 ) {
# File was result of conversion by (pdf)latex.
my $cnv_source = $conversions{$new_source};
rdb_ensure_file( $rule, $new_source );
- if ($cnv_source) {
+ if ($cnv_source) {
# Conversion from $cnv_source to $new_source
# implies that effectively $cnv_source is a source
# of the (pdf)latex run.
rdb_ensure_file( $rule, $cnv_source );
- }
+ }
# Flag that changes of the generated file during a run
# do not require a rerun:
rdb_one_file( $new_source, sub{ $$Pcorrect_after_primary = 1; } );
- }
- else {
+ }
+ else {
# But we don't need special precautions for ordinary user files
# (or for files that are generated outside of latex/pdflatex).
rdb_ensure_file( $rule, $new_source );
- }
- if ( ($dependents{$new_source} == 6)
+ }
+ if ( ($dependents{$new_source} == 6)
|| ($dependents{$new_source} == 7)
) {
- rdb_add_generated($new_source);
+ rdb_add_generated($new_source);
}
}
my @more_sources = &rdb_set_dependents( $rule );
my $num_new = $#more_sources + 1;
foreach (@more_sources) {
- $dependents{$_} = 4;
+ $dependents{$_} = 4;
if ( ! -e $_ ) {
# Failure was non-existence of makable file
# Leave failure issue to other rules.
@@ -5146,20 +5334,20 @@ NEW_SOURCE:
delete $dependents{$_};
}
if ($diagnostics) {
- if ($num_new > 0 ) {
- print "$num_new new source files for rule '$rule':\n";
- foreach (@more_sources) { print " '$_'\n"; }
- }
- else {
- print "No new source files for rule '$rule':\n";
- }
+ if ($num_new > 0 ) {
+ print "$num_new new source files for rule '$rule':\n";
+ foreach (@more_sources) { print " '$_'\n"; }
+ }
+ else {
+ print "No new source files for rule '$rule':\n";
+ }
my @first_read_after_write = sort keys %first_read_after_write;
if ($#first_read_after_write >= 0) {
print "The following files were only read after being written:\n";
foreach (@first_read_after_write) {
print " '$_'\n";
- }
- }
+ }
+ }
}
my @files_not_needed = ();
foreach (keys %$PHsource) {
@@ -5167,7 +5355,7 @@ NEW_SOURCE:
print "Removing no-longer-needed dependent '$_' from rule '$rule'\n"
if $diagnostics;
push @files_not_needed, $_;
- }
+ }
}
rdb_remove_files( $rule, @files_not_needed );
@@ -5215,24 +5403,24 @@ MISSING_FILE:
$new_includes{"$missing.tex"} = 1;
}
if ( -e $missing ) {
- $new_includes{$missing} = 1;
+ $new_includes{$missing} = 1;
}
if ( $ext ne "" ) {
foreach my $dep (@cus_dep_list){
my ($fromext,$toext) = split('\s+',$dep);
if ( ( "$ext" eq "$toext" )
&& ( -e "$path$base.$fromext" )
- ) {
+ ) {
# Source file for the missing file exists
# So we have a real include file, and it will be made
# next time by rdb_set_dependents
$new_includes{$missing} = 1;
}
- else {
+ else {
# no point testing the $toext if the file doesn't exist.
- }
+ }
next MISSING_FILE;
- }
+ }
}
else {
# $_ doesn't exist, $_.tex doesn't exist,
@@ -5252,7 +5440,7 @@ MISSING_FILE:
$new_includes{"$path$base.$toext"} = 1;
# next MISSING_FILE;
}
- }
+ }
}
} # end MISSING_FILES
@@ -5271,19 +5459,19 @@ MISSING_FILE:
my $stripped = $file;
$stripped =~ s{^\./}{};
if ( exists $PHsource{$file} ) {
- delete $new_includes{$file};
- }
+ delete $new_includes{$file};
+ }
else {
- $found ++;
- rdb_ensure_file( $rule, $file );
- }
+ $found ++;
+ rdb_ensure_file( $rule, $file );
+ }
}
if ( $diagnostics && ( $found > 0 ) ) {
- warn "$My_name: Detected previously missing files:\n";
+ warn "$My_name: Detected previously missing files:\n";
foreach ( sort keys %new_includes ) {
warn " '$_'\n";
- }
+ }
}
return $found;
} # END rdb_find_new_files
@@ -5300,7 +5488,7 @@ sub rdb_set_dependents {
rdb_for_some( [@_], 0, \&rdb_one_dep );
# OLD rdb_recurse( [@_], 0, \&rdb_one_dep );
foreach (@deletions) {
- my ($rule, $file) = @$_;
+ my ($rule, $file) = @$_;
rdb_remove_files( $rule, $file );
}
&rdb_make_links;
@@ -5329,30 +5517,30 @@ DEP:
my ($fromext,$proptoext,$must,$func_name) = split('\s+',$dep);
if ( $toext eq $proptoext ) {
my $source = "$base_name.$fromext";
- # Found match of rule
+ # Found match of rule
if ($diagnostics) {
print "Found cusdep: $source to make $rule:$new_dest ====\n";
}
- if ( -e $source ) {
- $$Pfrom_rule = "cusdep $fromext $toext $base_name";
-#?? print "?? Ensuring rule for '$$Pfrom_rule'\n";
+ if ( -e $source ) {
+ $$Pfrom_rule = "cusdep $fromext $toext $base_name";
+#?? print "?? Ensuring rule for '$$Pfrom_rule'\n";
local @PAnew_cmd = ( 'do_cusdep', $func_name );
if ( !-e $new_dest ) {
- push @new_sources, $new_dest;
- }
+ push @new_sources, $new_dest;
+ }
if (! rdb_rule_exists( $$Pfrom_rule ) ) {
print "=== Creating rule for '$$Pfrom_rule'\n";
rdb_create_rule( $$Pfrom_rule, 'cusdep', '', \@PAnew_cmd, 3,
$source, $new_dest, $base_name, 0 );
- }
+ }
else {
- rdb_one_rule(
+ rdb_one_rule(
$$Pfrom_rule,
sub{ @$PAint_cmd = @PAnew_cmd; $$Pdest = $new_dest;}
);
- }
- return;
- }
+ }
+ return;
+ }
else {
# Source file does not exist
if ( !$force_mode && ( $must != 0 ) ) {
@@ -5361,16 +5549,16 @@ DEP:
$failure_msg = "File '$base_name.$fromext' does not exist ".
"to build '$base_name.$toext'";
return;
- }
+ }
elsif ( $$Pfrom_rule =~ /^cusdep $fromext $toext / ) {
# Source file does not exist, destination has the rule set.
# So turn the from_rule off
- $$Pfrom_rule = '';
- }
- else {
- }
- }
- }
+ $$Pfrom_rule = '';
+ }
+ else {
+ }
+ }
+ }
elsif ( ($toext eq '')
&& (! -e $file )
&& (! -e "$base_name.$proptoext" )
@@ -5383,27 +5571,27 @@ DEP:
my $source = "$base_name.$fromext";
if ( -e $source ) {
$new_dest = "$base_name.$proptoext";
- my $from_rule = "cusdep $fromext $proptoext $base_name";
+ my $from_rule = "cusdep $fromext $proptoext $base_name";
push @new_sources, $new_dest;
- print "Ensuring rule for '$from_rule', to make '$new_dest'\n"
- if $diagnostics > -1;
+ print "Ensuring rule for '$from_rule', to make '$new_dest'\n"
+ if $diagnostics > -1;
local @PAnew_cmd = ( 'do_cusdep', $func_name );
if (! rdb_rule_exists( $from_rule ) ) {
rdb_create_rule( $from_rule, 'cusdep', '', \@PAnew_cmd, 3,
$source, $new_dest, $base_name, 0 );
- }
+ }
else {
- rdb_one_rule(
+ rdb_one_rule(
$$Pfrom_rule,
sub{ @$PAint_cmd = @PAnew_cmd; $$Pdest = $new_dest;}
);
- }
+ }
rdb_ensure_file( $rule, $new_dest, $from_rule );
# We've now got a spurious file in our rule. But don't mess
# with deleting an item we are in the middle of!
push @deletions, [$rule, $file];
- return;
- }
+ return;
+ }
} # End of Rule found
} # End DEP
if ( (! -e $file) && $use_make_for_missing_files ) {
@@ -5415,8 +5603,8 @@ DEP:
&Run_subst( "$make $q$file$q" );
if ( -e $file ) {
return;
- }
- }
+ }
+ }
else {
print "$My_name: '$rule': source '$file' doesn't exist.\n",
" I'll try making it with allowed extensions \n";
@@ -5436,9 +5624,9 @@ DEP:
# the error due to a missing file.
$$Pout_of_date_user = 1;
return;
- }
- }
- }
+ }
+ }
+ }
}
} #END rdb_one_dep
@@ -5452,18 +5640,18 @@ sub rdb_list {
my @accessible_all = rdb_accessible( keys %requested_filerules );
rdb_for_some(
\@accessible_all,
- sub{ $count_rules++;
+ sub{ $count_rules++;
print "Rule '$rule' depends on:\n";
},
- sub{ print " '$file'\n"; },
- sub{ print " and generates:\n";
+ sub{ print " '$file'\n"; },
+ sub{ print " and generates:\n";
foreach (keys %$PHdest) { print " '$_'\n"; }
# print " default_extra_generated:\n";
# foreach (@$PA_extra_generated) { print " '$_'\n"; }
},
);
if ($count_rules <= 0) {
- print " ---No rules defined\n";
+ print " ---No rules defined\n";
}
} #END rdb_list
@@ -5483,11 +5671,11 @@ sub deps_list {
my @accessible_all = rdb_accessible( keys %requested_filerules );
rdb_for_some(
\@accessible_all,
- sub{
+ sub{
# foreach (keys %$PHdest) { print "----- $_\n"; }
push @generated, keys %$PHdest;
},
- sub{ $source{$file} = 1; }
+ sub{ $source{$file} = 1; }
);
foreach (keys %generated_exts_all) {
(my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$root_filename/;
@@ -5526,17 +5714,17 @@ sub rdb_show {
print "===Rules:\n";
local $count_rules = 0;
rdb_for_all(
- sub{ $count_rules++;
+ sub{ $count_rules++;
my @int_cmd = @$PAint_cmd;
- foreach (@int_cmd) {
- if ( !defined($_) ) { $_='undef';}
- }
+ foreach (@int_cmd) {
+ if ( !defined($_) ) { $_='undef';}
+ }
print " [$rule]: '$$Pcmd_type' '$$Pext_cmd' '@int_cmd' $$Ptest_kind ",
"'$$Psource' '$$Pdest' '$$Pbase' $$Pout_of_date $$Pout_of_date_user\n"; },
- sub{ print " '$file': $$Ptime $$Psize $$Pmd5 '$$Pfrom_rule'\n"; }
+ sub{ print " '$file': $$Ptime $$Psize $$Pmd5 '$$Pfrom_rule'\n"; }
);
if ($count_rules <= 0) {
- print " ---No rules defined\n";
+ print " ---No rules defined\n";
}
} #END rdb_show
@@ -5734,7 +5922,7 @@ sub rdb_make {
# making currently non-existent file, which
# could become a needed source file for a run
# and therefore undo an error condition
- if ($diagnostics) {
+ if ($diagnostics) {
print "Make: doing pre_primary and primary...\n";
}
# Do the primary run if it is needed. On return $runs == 0
@@ -5745,31 +5933,45 @@ sub rdb_make {
# limit. In the second case $too_many_runs is set.
rdb_for_some( [@pre_primary, $primary], \&rdb_make1 );
if ( ($runs > 0) && ! $too_many_passes ) {
- next PASS;
+ $retry_msg = 0;
+ if ( $force_mode || (! $failure) ) {
+ next PASS;
+ }
+ # Get here on failure, without being in force_mode
+ if ( $newrule_nofile ) {
+ $retry_msg = 1;
+ print "$My_name: Error on run, but found possibility to ",
+ "make new source files\n";
+ next PASS;
+ }
+ else { last PASS; }
}
if ($runs == 0) {
# $failure not set on this pass, so use value from previous pass:
$failure = $previous_failure;
+ if ($retry_msg) {
+ print "But in fact no new files made\n";
+ }
if ($failure && !$force_mode ) { last PASS; }
- }
+ }
if ( $missing_dvi_pdf ) {
# No output from primary, after completing circular dependence
warn "Failure to make '$missing_dvi_pdf'\n";
$failure = 1;
last PASS;
}
- if ($diagnostics) {
- print "Make: doing post_primary...\n";
- }
+ if ($diagnostics) {
+ print "Make: doing post_primary...\n";
+ }
rdb_for_some( [@post_primary], \&rdb_make1 );
if ( ($runs == 0) || $too_many_passes ) {
# If $too_many_passes is set, it should also be that
# $runs == 0; but for safety, I also checked
# $too_many_passes.
last PASS;
- }
- }
- continue {
+ }
+ }
+ continue {
# Re-evaluate rule classification and accessibility,
# but do not change primaries.
# Problem is that %current_primaries gets altered
@@ -5777,23 +5979,23 @@ sub rdb_make {
&rdb_classify_rules( \%possible_primaries, @requested_targets );
%current_primaries = %old_curr_prim;
&rdb_make_links;
- }
+ }
}
rdb_for_some( [@unusual_one_time], \&rdb_make1 );
rdb_write( $fdb_name );
if (! $silent) {
- if ($failure && $force_mode) {
+ if ($failure && $force_mode) {
print "$My_name: Errors, in force_mode: so I tried finishing targets\n";
- }
- elsif ($failure) {
+ }
+ elsif ($failure) {
print "$My_name: Errors, so I did not complete making targets\n";
- }
- else {
+ }
+ else {
local @dests = ();
rdb_for_some( [@_], sub{ push @dests, $$Pdest if ($$Pdest); } );
print "$My_name: All targets (@dests) are up-to-date\n";
- }
+ }
}
return $failure;
} #END rdb_make
@@ -5804,37 +6006,37 @@ sub rdb_show_rule_errors {
local @errors = ();
local @warnings = ();
rdb_for_all(
- sub{
- if ($$Plast_message ne '') {
+ sub{
+ if ($$Plast_message ne '') {
if ($$Plast_result == 200) {
- push @warnings, "$rule: $$Plast_message";
- }
- else {
- push @errors, "$rule: $$Plast_message";
- }
- }
- elsif ($$Plast_result == 1) {
- push @errors, "$rule: failed to create output file";
- }
- elsif ($$Plast_result == 2) {
- push @errors, "$rule: gave an error";
- }
- elsif ($$Prun_time == 0) {
+ push @warnings, "$rule: $$Plast_message";
+ }
+ else {
+ push @errors, "$rule: $$Plast_message";
+ }
+ }
+ elsif ($$Plast_result == 1) {
+ push @errors, "$rule: failed to create output file";
+ }
+ elsif ($$Plast_result == 2) {
+ push @errors, "$rule: gave an error";
+ }
+ elsif ($$Prun_time == 0) {
# This can have innocuous causes. So don't report
- }
- }
- );
+ }
+ }
+ );
if ($#warnings > -1) {
- warn "Collected warning summary (may duplicate other messages):\n";
- foreach (@warnings){
- warn " $_\n";
- }
+ warn "Collected warning summary (may duplicate other messages):\n";
+ foreach (@warnings){
+ warn " $_\n";
+ }
}
if ($#errors > -1) {
- warn "Collected error summary (may duplicate other messages):\n";
- foreach (@errors){
- warn " $_\n";
- }
+ warn "Collected error summary (may duplicate other messages):\n";
+ foreach (@errors){
+ warn " $_\n";
+ }
}
return $#errors+1;
}
@@ -5867,15 +6069,15 @@ sub rdb_make1 {
$bibtex_not_run = 0;
if ($bibtex_use == 0) {
$bibtex_not_run = 2;
- }
+ }
elsif ($bibtex_use == 1) {
- foreach ( keys %$PHsource ) {
- if ( ( /\.bib$/ ) && (! -e $_) ) {
+ foreach ( keys %$PHsource ) {
+ if ( ( /\.bib$/ ) && (! -e $_) ) {
push @missing_bib_files, $_;
$bibtex_not_run = 1;
- }
- }
- }
+ }
+ }
+ }
}
if ( ($$Prun_time == 0) && exists($possible_primaries{$rule}) ) {
@@ -5885,53 +6087,53 @@ sub rdb_make1 {
}
else {
if ( $$Pdest && (! -e $$Pdest) ) {
- # With a non-existent destination, if we haven't made any passes
+ # With a non-existent destination, if we haven't made any passes
# through a rule, rerunning the rule is good, because the file
# may fail to exist because of being deleted by the user (for ex.)
# rather than because of a failure on a previous run.
# (We could do better with a flag in fdb file.)
- # But after the first pass, the situation is different.
- # For a primary rule (pdf)latex, the lack of a destination file
- # could result from there being zero content due to a missing
- # essential input file. The input file could be generated
- # by a program to be run later (e.g., a cusdep or bibtex),
- # so we should wait until all passes are completed before
+ # But after the first pass, the situation is different.
+ # For a primary rule (pdf)latex, the lack of a destination file
+ # could result from there being zero content due to a missing
+ # essential input file. The input file could be generated
+ # by a program to be run later (e.g., a cusdep or bibtex),
+ # so we should wait until all passes are completed before
# deciding a non-existent destination file is an error.
- # For a custom dependency, the rule may be obsolete, and
- # if the source file does not exist also, we should simply
- # not run the rule, but not set an error condition.
- # Any error will arise at the (pdf)latex level due to a
- # missing source file at that level.
- if ( $$Psource && (! -e $$Psource)
+ # For a custom dependency, the rule may be obsolete, and
+ # if the source file does not exist also, we should simply
+ # not run the rule, but not set an error condition.
+ # Any error will arise at the (pdf)latex level due to a
+ # missing source file at that level.
+ if ( $$Psource && (! -e $$Psource)
# OLD && ( ( $$Pcmd_type eq 'cusdep') )
# NEW
&& ( ( $$Pcmd_type ne 'primary') )
) {
# Main source file doesn't exist, and rule is NOT primary.
- # No action, since a run is pointless. Primary is different:
+ # No action, since a run is pointless. Primary is different:
# file might be found elsewhere (by kpsearch from (pdf)latex),
# while non-existence of main source file is a clear error.
- }
- elsif ( $$Pcmd_type eq 'delegated' ) {
- # Delegate to destination rule
- }
- elsif ( $pass{$rule}==0) {
- push @no_dest, $$Pdest;
- $$Pout_of_date = 1;
- }
- if ( $$Pcmd_type eq 'primary' ) {
- $missing_dvi_pdf = $$Pdest;
- }
- }
+ }
+ elsif ( $$Pcmd_type eq 'delegated' ) {
+ # Delegate to destination rule
+ }
+ elsif ( $pass{$rule}==0) {
+ push @no_dest, $$Pdest;
+ $$Pout_of_date = 1;
+ }
+ if ( $$Pcmd_type eq 'primary' ) {
+ $missing_dvi_pdf = $$Pdest;
+ }
+ }
}
&rdb_flag_changes_here(0);
if (!$$Pout_of_date) {
-#?? if ( ($$Pcmd_type eq 'primary') && (! $silent) ) {
+#?? if ( ($$Pcmd_type eq 'primary') && (! $silent) ) {
# print "Rule '$rule' up to date\n";
# }
- return;
+ return;
}
if ($diagnostics) { print " remake\n"; }
if (!$silent) {
@@ -5956,7 +6158,7 @@ sub rdb_make1 {
# Treat rule as completed, else in -pvc mode get infinite reruns:
$$Pout_of_date = 0;
$failure = 1;
- $failure_msg = "'$rule' needed too many passes";
+ $failure_msg = "'$rule' needed too many passes";
return;
}
@@ -5971,7 +6173,7 @@ sub rdb_make1 {
}
elsif ($bibtex_not_run == 2 ) {
warn "$My_name: I AM CONFIGURED/INVOKED NOT TO RUN '$rule'\n";
- }
+ }
$return = &rdb_dummy_run1;
}
else {
@@ -6002,7 +6204,7 @@ sub rdb_make1 {
# So in this case, do NOT report an error
$$Pout_of_date = 0;
- }
+ }
elsif ($$Pcmd_type eq 'primary' ) {
# For a primary rule, i.e., (pdf)latex, not to produce the
# expected output file may not be an error condition.
@@ -6013,7 +6215,7 @@ sub rdb_make1 {
elsif ($return == -2) {
# Missing output file was reported to be NOT an error
$$Pout_of_date = 0;
- }
+ }
elsif ( ($bibtex_use <= 1) && ($bibtex_not_run > 0) ) {
# Lack of destination file is not to be treated as an error
# for a bibtex rule when latexmk is configured not to treat
@@ -6021,16 +6223,16 @@ sub rdb_make1 {
# only error.
$$Pout_of_date = 0;
}
- else {
+ else {
$failure = 1;
- }
+ }
}
if ( ($return != 0) && ($return != -2) ) {
$failure = 1;
- $$Plast_result = 2;
+ $$Plast_result = 2;
if ( !$$Plast_message ) {
$$Plast_message = "Run of rule '$rule' gave a non-zero error code";
- }
+ }
# !!?? $failure_msg = $$Plast_message;
}
@@ -6081,45 +6283,45 @@ sub rdb_classify_rules {
@post_primary = reverse @post_primary;
if ($diagnostics) {
- print "Rule classification: \n";
- if ($#requested_targets < 0) {
- print " No requested rules\n";
- }
- else {
- print " Requested rules:\n";
- foreach ( @requested_targets ) { print " $_\n"; }
- }
- if ($#pre_primary < 0) {
- print " No pre-primaries\n";
- }
- else {
- print " Pre-primaries:\n";
- foreach (@pre_primary) { print " $_\n"; }
- }
- print " Primaries:\n";
- foreach (keys %current_primaries) { print " $_\n"; }
- if ($#post_primary < 0) {
- print " No post-primaries\n";
- }
- else {
- print " Post-primaries:\n";
- foreach (@post_primary) { print " $_\n"; }
- }
- if ($#unusual_one_time < 0) {
- print " No inner-level one_time rules, as expected\n";
- }
- else {
- print " Inner-level one_time rules:\n";
- foreach ( @unusual_one_time ) { print " $_\n"; }
- }
+ print "Rule classification: \n";
+ if ($#requested_targets < 0) {
+ print " No requested rules\n";
+ }
+ else {
+ print " Requested rules:\n";
+ foreach ( @requested_targets ) { print " $_\n"; }
+ }
+ if ($#pre_primary < 0) {
+ print " No pre-primaries\n";
+ }
+ else {
+ print " Pre-primaries:\n";
+ foreach (@pre_primary) { print " $_\n"; }
+ }
+ print " Primaries:\n";
+ foreach (keys %current_primaries) { print " $_\n"; }
+ if ($#post_primary < 0) {
+ print " No post-primaries\n";
+ }
+ else {
+ print " Post-primaries:\n";
+ foreach (@post_primary) { print " $_\n"; }
+ }
+ if ($#unusual_one_time < 0) {
+ print " No inner-level one_time rules, as expected\n";
+ }
+ else {
+ print " Inner-level one_time rules:\n";
+ foreach ( @unusual_one_time ) { print " $_\n"; }
+ }
my @normal_one_time = keys %one_time;
- if ($#normal_one_time < 0) {
- print " No outer-level one_time rules\n";
- }
- else {
- print " Outer-level one_time rules:\n";
- foreach ( @normal_one_time ) { print " $_\n"; }
- }
+ if ($#normal_one_time < 0) {
+ print " No outer-level one_time rules\n";
+ }
+ else {
+ print " Outer-level one_time rules:\n";
+ foreach ( @normal_one_time ) { print " $_\n"; }
+ }
} #end diagnostics
} #END rdb_classify_rules
@@ -6146,12 +6348,12 @@ sub rdb_classify1 {
$current_primaries{ $rule } = 1;
}
else {
- push @post_primary, $rule;
+ push @post_primary, $rule;
}
}
else {
$state = 2; # in post-primary rule
- push @pre_primary, $rule;
+ push @pre_primary, $rule;
}
} #END rdb_classify1
@@ -6191,14 +6393,14 @@ sub rdb_run1 {
my $int_cmd = shift @int_args;
my @int_args_for_printing = @int_args;
foreach (@int_args_for_printing) {
- if ( ! defined $_ ) { $_ = 'undef'; }
+ if ( ! defined $_ ) { $_ = 'undef'; }
}
if ($int_cmd) {
- print "For rule '$rule', running '\&$int_cmd( @int_args_for_printing )' ...\n";
+ print "For rule '$rule', running '\&$int_cmd( @int_args_for_printing )' ...\n";
$return = &$int_cmd( @int_args );
}
elsif ($$Pext_cmd) {
- $return = &Run_subst();
+ $return = &Run_subst();
}
else {
warn "$My_name: Either a bug OR a configuration error:\n",
@@ -6231,7 +6433,7 @@ sub rdb_run1 {
" be recreated, I'll try to do so.\n";
$return = -2;
rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
- }
+ }
elsif ($retcode == 4) {
$$Plast_result = 2;
$$Plast_message = "Could not find all biber source files for '$$Pbase'";
@@ -6260,7 +6462,7 @@ sub rdb_run1 {
if ( ! -e $$Psource ) {
$retcode = 10;
rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
- }
+ }
if ($retcode == 3) {
$$Plast_result = 2;
$$Plast_message = "Could not open bibtex log file for '$$Pbase'";
@@ -6281,17 +6483,17 @@ sub rdb_run1 {
warn "$My_name: Bibtex did not produce '$$Pdest'. But that\n",
" was because of missing files, so I will continue.\n";
$return = -2;
- }
+ }
else {
$return = 0;
- }
+ }
}
}
$updated = 1;
if ($$Ptest_kind == 3) {
# We are time-criterion first time only. Now switch to
- # file-change criterion
+ # file-change criterion
$$Ptest_kind = 1;
}
$$Pout_of_date = $$Pout_of_date_user = 0;
@@ -6299,11 +6501,11 @@ sub rdb_run1 {
if ( ($$Plast_result == 0) && ($return != 0) && ($return != -2) ) {
$$Plast_result = 2;
if ($$Plast_message eq '') {
- $$Plast_message = "Command for '$rule' gave return code $return";
- }
+ $$Plast_message = "Command for '$rule' gave return code $return";
+ }
}
elsif ( $$Pdest && (! -e $$Pdest) && ($return != -2) ) {
- $$Plast_result = 1;
+ $$Plast_result = 1;
}
return $return;
} # END rdb_run1
@@ -6326,7 +6528,7 @@ sub rdb_dummy_run1 {
if ($$Ptest_kind == 3) {
# We are time-criterion first time only. Now switch to
- # file-change criterion
+ # file-change criterion
$$Ptest_kind = 1;
}
$$Pout_of_date = $$Pout_of_date_user = 0;
@@ -6385,9 +6587,9 @@ sub Run_subst {
'%%' => '%' # To allow literal %B, %R, etc, by %%B.
);
if ( ($^O eq "MSWin32" ) && $MSWin_back_slash ) {
- foreach ( '%R', '%B', '%T', '%S', '%D', '%Y', '%Z' ) {
- $subst{$_} =~ s(/)(\\)g;
- }
+ foreach ( '%R', '%B', '%T', '%S', '%D', '%Y', '%Z' ) {
+ $subst{$_} =~ s(/)(\\)g;
+ }
}
my @tokens = split /(%.)/, $ext_cmd;
@@ -6437,13 +6639,13 @@ sub rdb_primary_run {
my @other_fls_names = ( );
if ( $rule =~ /^pdflatex/ ) {
push @other_fls_names, "pdflatex.fls";
- }
+ }
else {
push @other_fls_names, "latex.fls";
- }
+ }
if ( $aux_dir1 ne '' ) {
push @other_fls_names, "$root_filename.fls";
- }
+ }
# Find the first non-standard fls file and copy it to the standard
# place. But only do this if the file time is compatible with being
# generated in the current run, as tested by the use of
@@ -6454,10 +6656,10 @@ sub rdb_primary_run {
copy $cand, $std_fls_file;
last;
}
- }
+ }
if ( ! test_gen_file( $std_fls_file ) ) {
warn "$My_name: fls file doesn't appear to have been made\n";
- }
+ }
}
# Find current set of source files:
@@ -6491,8 +6693,8 @@ sub rdb_primary_run {
#?? &rdb_update_files;
if ( $diagnostics ) {
- print "$My_name: Rules after run: \n";
- rdb_show();
+ print "$My_name: Rules after run: \n";
+ rdb_show();
}
$return = $return_latex;
@@ -6504,17 +6706,19 @@ sub rdb_primary_run {
if (! $silent);
$return = 0;
}
-
# Summarize issues that may have escaped notice:
my @warnings = ();
if ($bad_reference) {
push @warnings, "Latex failed to resolve $bad_reference reference(s)";
}
+ if ($mult_defined) {
+ push @warnings, "Latex found $mult_defined multiply defined reference(s)";
+ }
if ($bad_citation) {
push @warnings, "Latex failed to resolve $bad_citation citation(s)";
}
if ($#warnings > -1) {
- show_array( "$My_name: Summary of warnings:", @warnings );
+ show_array( "$My_name: Summary of warnings:", @warnings );
}
return $return;
} #END rdb_primary_run
@@ -6550,9 +6754,9 @@ sub rdb_flag_changes_here {
$dest_mtime = get_mtime($$Pdest) if ($$Pdest);
rdb_do_files( \&rdb_file_change1);
if ($$Pout_of_date) {
- push @rules_to_apply, $rule;
+ push @rules_to_apply, $rule;
}
-#?? print "======== flag: $rule $$Pout_of_date ==========\n";
+#?? print "======== flag: $rule $$Pout_of_date ==========\n";
} #END rdb_flag_changes_here
#************************************************************
@@ -6573,7 +6777,7 @@ sub rdb_file_change1 {
#?? " New $new_time, $new_size, $new_md5\n";
my $ext_no_period = ext_no_period( $file );
if ( ($new_size < 0) && ($$Psize >= 0) ) {
- # print "Disappeared '$file' in '$rule'\n";
+ # print "Disappeared '$file' in '$rule'\n";
push @disappeared, $file;
# No reaction is good.
#$$Pout_of_date = 1;
@@ -6589,27 +6793,27 @@ sub rdb_file_change1 {
return;
}
if ( ($new_size < 0) && ($$Psize < 0) ) {
- return;
+ return;
}
if ( ($new_size != $$Psize) || ($new_md5 ne $$Pmd5) ) {
#?? print "FC1: changed $file: ($new_size != $$Psize) $new_md5 ne $$Pmd5)\n";
- push @changed, $file;
- $$Pout_of_date = 1;
+ push @changed, $file;
+ $$Pout_of_date = 1;
if ( ! exists $generated_exts_all{$ext_no_period} ) {
$$Pout_of_date_user = 1;
- }
+ }
}
elsif ( $new_time != $$Ptime ) {
#warn "--==-- Unchanged $file, changed time, update filetime in $rule\n";
- $$Ptime = $new_time;
+ $$Ptime = $new_time;
}
if ( ( ($$Ptest_kind == 2) || ($$Ptest_kind == 3) )
&& (! exists $generated_exts_all{$ext_no_period} )
&& ( $new_time > $dest_mtime )
) {
#?? print "FC1: changed $file: ($new_time > $dest_mtime)\n";
- push @changed, $file;
- $$Pout_of_date = $$Pout_of_date_user = 1;
+ push @changed, $file;
+ $$Pout_of_date = $$Pout_of_date_user = 1;
}
} #END rdb_file_change1
@@ -6630,22 +6834,22 @@ sub rdb_diagnose_changes {
my $heading = defined($_[0]) ? $_[0] : "$My_name: ";
if ($#rules_never_run >= 0) {
- warn "${heading}Rules & subrules not known to be previously run:\n";
+ warn "${heading}Rules & subrules not known to be previously run:\n";
foreach (@rules_never_run) { warn " $_\n"; }
}
if ( ($#changed >= 0) || ($#disappeared >= 0) || ($#no_dest >= 0) ) {
warn "${heading}File changes, etc:\n";
if ( $#changed >= 0 ) {
- warn " Changed files, or newly in use since previous run(s):\n";
- foreach (uniqs(@changed)) { warn " '$_'\n"; }
+ warn " Changed files, or newly in use since previous run(s):\n";
+ foreach (uniqs(@changed)) { warn " '$_'\n"; }
}
if ( $#disappeared >= 0 ) {
- warn " No-longer-existing files:\n";
- foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
+ warn " No-longer-existing files:\n";
+ foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
}
if ( $#no_dest >= 0 ) {
- warn " Non-existent destination files:\n";
- foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
+ warn " Non-existent destination files:\n";
+ foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
}
}
elsif ($#rules_to_apply >=0) {
@@ -6653,7 +6857,7 @@ sub rdb_diagnose_changes {
foreach (@rules_to_apply) { warn " '$_'\n"; }
}
else {
- warn "${heading}No file changes\n";
+ warn "${heading}No file changes\n";
}
} #END rdb_diagnose_changes
@@ -6814,7 +7018,7 @@ sub rdb_for_some {
foreach $rule ( @heads ) {
# $rule is implicitly local
- &rdb_one_rule( $rule, @_ );
+ &rdb_one_rule( $rule, @_ );
}
} #END rdb_for_some
@@ -6843,7 +7047,7 @@ sub rdb_recurse_rule {
# Assumes recursion context, i.e. that %visited, @heads, $depth.
# We are overriding actions:
my ($rule, $rule_act1, $new_file_act1, $new_file_act2, $rule_act2)
- = @_;
+ = @_;
# and must propagate the file actions:
local $file_act1 = $new_file_act1;
local $file_act2 = $new_file_act2;
@@ -6869,7 +7073,7 @@ sub rdb_recurse_file {
# Assumes contexts set for: Recursion, rule, and file
&$file_act1 if $file_act1;
rdb_recurse_rule( $$Pfrom_rule, $rule_act1, $file_act1, $file_act2,
- $rule_act2 )
+ $rule_act2 )
if $$Pfrom_rule;
&$file_act2 if $file_act2;
} #END rdb_recurse_file
@@ -7000,7 +7204,7 @@ sub rdb_create_rule {
-1, '', $PA_extra_gen ],
{},
{}
- ];
+ ];
if ($source) {
rdb_ensure_file( $rule, $source, undef, $set_file_not_exists );
}
@@ -7046,27 +7250,27 @@ sub rdb_ensure_file {
my $rule = shift;
local ( $new_file, $new_from_rule, $set_not_exists ) = @_;
if ( ! rdb_rule_exists( $rule ) ) {
- die_trace( "$My_name: BUG in rdb_ensure_file: non-existent rule '$rule'" );
+ die_trace( "$My_name: BUG in rdb_ensure_file: non-existent rule '$rule'" );
}
if ( ! defined $new_file ) {
- die_trace( "$My_name: BUG in rdb_ensure_file: undefined file for '$rule'" );
+ die_trace( "$My_name: BUG in rdb_ensure_file: undefined file for '$rule'" );
}
if ( ! defined $set_not_exists ) { $set_not_exists = 0; }
rdb_one_rule( $rule,
sub{
if (! exists ${$PHsource}{$new_file} ) {
- if ( $set_not_exists ) {
+ if ( $set_not_exists ) {
${$PHsource}{$new_file} = [0, -1, 0, '', 0];
- }
- else {
+ }
+ else {
${$PHsource}{$new_file}
= [fdb_get($new_file, $$Prun_time), '', 0];
- }
- }
- }
+ }
+ }
+ }
);
if (defined $new_from_rule ) {
- rdb_for_one_file( $rule, $new_file, sub{ $$Pfrom_rule = $new_from_rule; });
+ rdb_for_one_file( $rule, $new_file, sub{ $$Pfrom_rule = $new_from_rule; });
}
} #END rdb_ensure_file
@@ -7101,7 +7305,7 @@ sub rdb_file_exists {
local $exists = 0;
rdb_one_rule( $rule,
sub{ $exists = exists( ${$PHsource}{$file} ) ? 1:0; }
- );
+ );
return $exists;
} #END rdb_file_exists
@@ -7111,7 +7315,7 @@ sub rdb_update_gen_files {
# Assumes rule context. Update source files of rule to current state.
rdb_do_files(
sub{
- if ( exists $generated_exts_all{ ext_no_period($file) } ) {&rdb_update1;}
+ if ( exists $generated_exts_all{ ext_no_period($file) } ) {&rdb_update1;}
}
);
} #END rdb_update_gen_files
@@ -7312,28 +7516,28 @@ sub parse_quotes {
while() {
/\G\s*/gc;
if ( /\G$/ ) {
- last ITEM;
- }
+ last ITEM;
+ }
# Now pos (and \G) is at start of item:
PART:
while () {
- if (/\G([^\s\"]*)/gc) {
- $item .= $1;
- }
+ if (/\G([^\s\"]*)/gc) {
+ $item .= $1;
+ }
if ( /\G\"([^\"]*)\"/gc ) {
# Match balanced quotes
- $item .= $1;
- next PART;
- }
+ $item .= $1;
+ next PART;
+ }
elsif ( /\G\"(.*)$/gc ) {
# Match unbalanced quote
- $item .= $1;
+ $item .= $1;
warn "====Non-matching quotes in\n '$_'\n";
- }
+ }
push @results, $item;
$item = '';
last PART;
- }
+ }
}
return @results;
} #END parse_quotes
@@ -7471,8 +7675,8 @@ sub get_checksum_md5 {
if ( $ignore_pattern ) {
while (<$input>) {
if ( /$ignore_pattern/ ){
- $_= '';
- }
+ $_= '';
+ }
$md5->add($_);
}
}
@@ -7566,7 +7770,7 @@ sub find_file_list1 {
if ($suffix eq '.bib') { $file =~ s/\.bib$//; }
my ($tmp_file, $find_retcode) = &find_file1( "$file$suffix", $ref_search );
if ($tmp_file) {
- push @return_list, $tmp_file;
+ push @return_list, $tmp_file;
}
if ( $find_retcode != 0 ) {
push @not_found, $file.$suffix;
@@ -7586,9 +7790,9 @@ sub unlink_or_move {
}
else {
foreach (@_) {
- if (-e $_ && ! rename $_, "$del_dir/$_" ) {
+ if (-e $_ && ! rename $_, "$del_dir/$_" ) {
warn "$My_name:Cannot move '$_' to '$del_dir/$_'\n";
- }
+ }
}
}
}
@@ -7606,7 +7810,7 @@ sub kpsewhich {
foreach (@args) {
if ( ! /^-/ ) {
$_ = "\"$_\"";
- }
+ }
}
foreach ($cmd) {
s/%[RBTDO]//g;
@@ -7617,7 +7821,7 @@ sub kpsewhich {
open $fh, "$cmd|"
or die "Cannot open pipe for \"$cmd\"\n";
while ( <$fh> ) {
- s/^\s*//;
+ s/^\s*//;
s/\s*$//;
push @found, $_;
}
@@ -7645,12 +7849,12 @@ sub remove_cus_dep {
while ($i <= $#cus_dep_list) {
# Use \Q and \E round directory name in regex to avoid interpretation
# of metacharacters in directory name:
- if ( $cus_dep_list[$i] =~ /^\Q$from_ext $to_ext \E/ ) {
- splice @cus_dep_list, $i, 1;
- }
- else {
- $i++;
- }
+ if ( $cus_dep_list[$i] =~ /^\Q$from_ext $to_ext \E/ ) {
+ splice @cus_dep_list, $i, 1;
+ }
+ else {
+ $i++;
+ }
}
}
@@ -7662,6 +7866,22 @@ sub show_cus_dep {
####################################################
+sub add_aux_hook {
+ # Usage: add_aux_hook( sub_name )
+ # Add the name subroutine to the array of hooks for
+ # processing lines of aux files.
+ # The argument is either a string naming the subroutine, e.g.
+ # add_aux_hook( 'subname' );
+ # or a Perl reference to the subroutine, e.g.,
+ # add_aux_hook( \&subname );
+ # It is also possible to use an anonymous subroutine, e.g.,
+ # add_aux_hook( sub{ code of subroutine... } );
+ my ($sub_name) = @_;
+ push @aux_hooks, $sub_name;
+}
+
+####################################################
+
sub add_input_ext {
# Usage: add_input_ext( rule, ext, ... )
# Add extension(s) (specified without a leading period) to the
@@ -7724,8 +7944,8 @@ sub find_dirs {
= sub
{ ## Subroutine for use in File::find
## Check to see if we have a directory
- if (-d) { push @result, $File::Find::name; }
- };
+ if (-d) { push @result, $File::Find::name; }
+ };
foreach my $directory (@_) {
my $recurse = ( $directory =~ m[//$] );
# Remove all trailing /s, since directory name with trailing /
@@ -7733,16 +7953,16 @@ sub find_dirs {
$directory =~ s[/+$][];
# Similarly for MSWin reverse slash
$directory =~ s[\\+$][];
- if ( ! -e $directory ){
+ if ( ! -e $directory ){
next;
- }
- elsif ( $recurse ){
+ }
+ elsif ( $recurse ){
# Recursively search directory
find( $find_action, $directory );
- }
+ }
else {
push @result, $directory;
- }
+ }
}
return @result;
}
@@ -7758,9 +7978,9 @@ sub uniq
my $first = 1;
while (@_)
{
- $current = shift;
+ $current = shift;
if ($first || ($current ne $prev) )
- {
+ {
push @sort, $current;
$prev = $current;
$first = 0;
@@ -7855,7 +8075,7 @@ sub split_search_path
my @list = split( /$separator/, $search_path);
if ( $search_path =~ /$separator$/ ) {
# If search path ends in a blank item, the split subroutine
- # won't have picked it up.
+ # won't have picked it up.
# So add it to the list by hand:
push @list, "";
}
@@ -7885,7 +8105,7 @@ sub tempfile1 {
or next;
close(TMP);
return $tmp_file;
- }
+ }
}
die "$My_name.tempfile1: BUG TO ARRIVE HERE\n";
}
@@ -7965,7 +8185,7 @@ sub Run {
# or the return value of the Perl subroutine.
my $cmd_line = $_[0];
if ( $cmd_line eq '' ) {
- traceback( "$My_name: Bug OR configuration error\n".
+ traceback( "$My_name: Bug OR configuration error\n".
" In run of '$rule', attempt to run a null program" );
return (0, 1);
}
@@ -7975,22 +8195,27 @@ sub Run {
while ( $cmd_line =~ s/^start +// ) {
# But first remove extra starts (which may have been inserted
# to force a command to be run detached, when the command
- # already contained a "start").
+ # already contained a "start").
$detach = 1;
}
if ( $cmd_line =~ s/^nostart +// ) {
$detach = 0;
}
if ( $cmd_line =~ /^internal\s+([a-zA-Z_]\w*)\s+(.*)$/ ) {
- my $routine = $1;
- my @args = parse_quotes( $2 );
- warn "$My_name: calling $routine( @args )\n";
+ my $routine = $1;
+ my @args = parse_quotes( $2 );
+ warn "$My_name: calling $routine( @args )\n";
return ( 0, &$routine( @args ) );
}
+ elsif ( $cmd_line =~ /^internal\s+([a-zA-Z_]\w*)\s*$/ ) {
+ my $routine = $1;
+ warn "$My_name: calling $routine()\n";
+ return ( 0, &$routine() );
+ }
elsif ( $cmd_line =~ /^NONE/ ) {
warn "$My_name: ",
"Program not implemented for this version. Command line:\n";
- warn " '$cmd_line'\n";
+ warn " '$cmd_line'\n";
return (0, 1);
}
elsif ($detach) {
@@ -8027,7 +8252,7 @@ sub Run_Detached {
if ( $cmd_line =~ /^NONE / ) {
warn "$My_name: ",
"Program not implemented for this version. Command line:\n";
- warn " '$cmd_line'\n";
+ warn " '$cmd_line'\n";
return (0, 1);
}
@@ -8044,10 +8269,10 @@ sub Run_Detached {
## warn "Run_Detached.UNIX: B pid=$pid\n";
if ( ! defined $pid ) {
## warn "Run_Detached.UNIX: C\n";
- warn "$My_name: Could not fork to run the following command:\n";
+ warn "$My_name: Could not fork to run the following command:\n";
warn " '$cmd_line'\n";
return (0, 1);
- }
+ }
elsif( $pid == 0 ){
## warn "Run_Detached.UNIX: D\n";
# Forked child process arrives here
@@ -8096,7 +8321,7 @@ sub find_process_id {
shift(@ps_output); # Discard the header line from ps
foreach (@ps_output) {
- next unless ( /$looking_for/ ) ;
+ next unless ( /$looking_for/ ) ;
my @ps_line = split ('\s+');
# OLD return($ps_line[$pid_position]);
push @found, $ps_line[$pid_position];
@@ -8133,7 +8358,7 @@ sub cache_good_cwd {
chomp $Win_cwd;
if ( $Win_cwd ) {
$cwd = $Win_cwd;
- }
+ }
else {
warn "$My_name: Could not correctly run command\n",
" '$cmd'\n",
@@ -8141,7 +8366,7 @@ sub cache_good_cwd {
" '$cwd'\n",
" The result was\n",
" 'Win_cwd'\n";
- }
+ }
}
$cache{cwd} = $cwd;
} # END cache_good_cwd
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index 47aa78664d1..102f0a97102 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -376,7 +376,7 @@ for the full story.\n";
}
if (@notvalidargs) {
my $msg =
- "The following arguments are not supported for the action $action:\n";
+ "The following options are not supported for the action $action:\n";
for my $c (@notvalidargs) {
$msg .= " $c";
}