diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-10 23:08:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-10 23:08:24 +0000 |
commit | 0c0cbb6bdf8cafc26e784fc01c5554c79b92af50 (patch) | |
tree | 54ead87e617c1d82544e08186279a9c347519dd8 /Master/texmf-dist/scripts | |
parent | a9664d38e2e1340141169de2acde8ff31735aaef (diff) |
latexmk 4.18 (28jul10)
git-svn-id: svn://tug.org/texlive/trunk@19650 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-x | Master/texmf-dist/scripts/latexmk/latexmk.pl | 170 |
1 files changed, 79 insertions, 91 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl index 08fdc5b4ebe..b5e5fe77ff5 100755 --- a/Master/texmf-dist/scripts/latexmk/latexmk.pl +++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl @@ -108,8 +108,8 @@ use warnings; $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.16a'; -$version_details = "$My_name, John Collins, 18 May 2010"; +$version_num = '4.18'; +$version_details = "$My_name, John Collins, 27 July 2010"; use Config; @@ -176,40 +176,16 @@ else { ## 5. Parsing of log file instead of source file is used to ## obtain dependencies, by default. ## -## Modification log from 22 Jan 2010 onwards in detail +## Modification log from 23 Jun 2010 onwards in detail ## -## 18 May 2010, John Collins Remove unlink $$Pdest in do_viewfile -## 17 May 2010, John Collins Correct sleep time to 1 sec -## if s<0 (otherwise infinite delay) -## or if 0<s<1 (otherwise zero delay) -## 10 May 2010, John Collins Deal with filenames in log file that are -## messed up by pdfTeX warnings not preceeded -## by a new line -## 18 Apr 2010, John Collins Clean up comment from previous mod. -## 16 Apr 2010, John Collins V. 4.15c. Correct line wrapping issue. -## 12 Apr 2010, John Collins V. 4.15b. Change -## use Digest; -## to -## use Digest::MD5; -## for TeX Live compatibility. Needed also to change -## my $md5 = Digest->MD5; -## to -## my $md5 = Digest::MD5->new; -## -## 8 Apr 2010, John Collins V. 4.15a. Better defaults for system -## configuration file under cygwin -## 7 Apr 2010, John Collins V. 4.15: Change defaults on -## $latex_silent_switch and $pdflatex_silent_switch -## to make them TeXLive compatible always -## 26 Mar 2010, John Collins V. 4.14b. Make sure md5 calc -## doesn't bomb out on directory -## Parse log file: if apparent dependent -## is directory, remove it from list. -## 27 Feb 2010, John Collins V. 4.14a. List failed primaries -## 22 Jan 2010, John Collins V. 4.14. Try to fix problem that with -pvc -## failure on latex should force a wait until -## a user file is changed. But latexmk keeps -## doing dvips, dvipdf, etc. +## 27 Jul 2010, John Collins Clean up some comments. +## This is release version for 4.18. +## 23 Jul 2010, John Collins Only produce "Removing no-longer-needed +## dependent" messages when diagnostics are +## on. +## 23 Jun 2010, John Collins Add test in log file for natbib's +## citation-undefined warning +## 23 Jun 2010, John Collins V. 4.18 ## ## 1998-2010, John Collins. Many improvements and fixes. ## See CHANGE-log.txt for full list, and CHANGES for summary @@ -879,8 +855,6 @@ $dvi_filter = ''; # DVI filter command $ps_filter = ''; # Postscript filter command $force_mode = 0; # =1 to force processing past errors -$force_include_mode = 0;# =1 to ignore non-existent files when testing - # for dependency. (I.e., don't treat them as error) $go_mode = 0; # =1 to force processing regardless of time-stamps # =2 full clean-up first $preview_mode = 0; @@ -1222,8 +1196,6 @@ while ($_ = $ARGV[0]) elsif (/^-nodependents$/ || /^-dependents-$/) { $dependents_list = 0; } elsif (/^-dvi$/) { $dvi_mode = 1; } elsif (/^-dvi-$/) { $dvi_mode = 0; } - elsif (/^-F$/) { $force_include_mode = 1; } - elsif (/^-F-$/) { $force_include_mode = 0; } elsif (/^-f$/) { $force_mode = 1; } elsif (/^-f-$/) { $force_mode = 0; } elsif (/^-g$/) { $go_mode = 1; } @@ -1568,7 +1540,7 @@ elsif ( ($sleep_time < 1) && ( $sleep_time != 0 ) ) { } elsif ( $sleep_time == 0 ) { warn "$My_name: sleep_time was configured to zero.\n", - " Do you really want to do this? It will give 100% CPU usage."; + " Do you really want to do this? It will give 100% CPU usage.\n"; } # Make convenient forms for lookup. @@ -2288,7 +2260,6 @@ sub find_basename #************************************************************ sub make_preview_continuousB { - # Version for use with makeB local @changed = (); local @disappeared = (); local @no_dest = (); # Non-existent destination files @@ -2370,29 +2341,9 @@ CHANGE: if ( $MSWin_fudge_break && ($^O eq "MSWin32") ) { $SIG{BREAK} = $SIG{INT} = 'DEFAULT'; } - if ( $failure > 0 ) { - if ( !$failure_msg ) { - $failure_msg = 'Failure to make the files correctly'; - } - @pre_primary = (); # Array of rules - @post_primary = (); # Array of rules - @one_time = (); # Array of rules - &rdb_classify_rules( \%possible_primaries, keys %requested_filerules ); - # There will be files changed during the run that are irrelevant. - # We need to wait for the user to change the files. - - # So set the GENERATED files from (pdf)latex as up-to-date: - rdb_for_some( [keys %current_primaries], \&rdb_update_gen_files ); - - # And don't watch for changes for post_primary rules (ps and pdf - # from dvi, etc haven't been run after an error in (pdf)latex, so - # are out-of-date by filetime criterion, but they should not be run - # until after another (pdf)latex run: - foreach (@post_primary) { delete $rules_to_watch{$_}; } - - $failure_msg =~ s/\s*$//; #Remove trailing space - warn "$My_name: $failure_msg\n", - " ==> You will need to change a source file before I do another run <==\n"; + # 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: @@ -2414,7 +2365,6 @@ CHANGE: } local $retcode = 0; rdb_one_rule( 'view', sub { $retcode = &rdb_run1;} ); -# PREVIOUS local $retcode = rdb_makeB ( 'view' ); if ( $retcode != 0 ) { if ($force_mode) { warn "$My_name: I could not run previewer\n"; @@ -2427,14 +2377,38 @@ CHANGE: $viewer_running = 1; $$Pneed_to_get_viewer_process = 1; } # end analyze result of trying to run viewer - } # end start viewer - rdb_show_rule_errors(); - if ( $first_time || $updated || $failure ) { - print "\n=== Watching for updated files. Use ctrl/C to stop ...\n"; - } - $waiting = 1; if ($diagnostics) { warn "WAITING\n"; } - &catch_break; - $have_break = 0; + } # end start viewer + if ( $failure > 0 ) { + if ( !$failure_msg ) { + $failure_msg = 'Failure to make the files correctly'; + } + @pre_primary = (); # Array of rules + @post_primary = (); # Array of rules + @one_time = (); # Array of rules + &rdb_classify_rules( \%possible_primaries, keys %requested_filerules ); + # There will be files changed during the run that are irrelevant. + # We need to wait for the user to change the files. + + # So set the GENERATED files from (pdf)latex as up-to-date: + rdb_for_some( [keys %current_primaries], \&rdb_update_gen_files ); + + # And don't watch for changes for post_primary rules (ps and pdf + # from dvi, etc haven't been run after an error in (pdf)latex, so + # are out-of-date by filetime criterion, but they should not be run + # until after another (pdf)latex run: + foreach (@post_primary) { delete $rules_to_watch{$_}; } + + $failure_msg =~ s/\s*$//; #Remove trailing space + warn "$My_name: $failure_msg\n", + " ==> You will need to change a source file before I do another run <==\n"; + } + rdb_show_rule_errors(); + if ( $first_time || $updated || $failure ) { + print "\n=== Watching for updated files. Use ctrl/C to stop ...\n"; + } + $waiting = 1; if ($diagnostics) { warn "WAITING\n"; } + &catch_break; + $have_break = 0; WAIT: while (1) { sleep( $sleep_time ); if ($have_break) { last WAIT; } @@ -2659,8 +2633,6 @@ sub print_help " -e <code> - Execute specified PERL code\n", " -f - force continued processing past errors\n", " -f- - turn off forced continuing processing past errors\n", - " -F - Ignore non-existent files when testing for dependencies\n", - " -F- - Turn off -F\n", " -gg - Super go mode: clean out generated files (-CA), and then\n", " process files regardless of file timestamps\n", " -g - process regardless of file timestamps\n", @@ -2983,6 +2955,10 @@ LINE: warn "$My_name: $1 \n"; $bad_citation = 1; } + if (/Package natbib Warning: (Citation[^\001]*undefined)./) { + warn "$My_name: $1 \n"; + $bad_citation = 1; + } if ( /^Document Class: / ) { # Class sign-on line next LINE; @@ -3149,36 +3125,49 @@ LINE: # 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 + # (string message + # is ambiguous: is the filename "string" or "string message". + # Allow both as candidates, since user filenames with spaces + # 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. $_ = $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; } - elsif ( /^([^\(^\)]*?)\s\[/ ) { - # Terminator: space then '[' - # Use *? in condition: to pick up first ' [' as terminator - # 'file [' should give good filename. + elsif ( /^([^\(^\)]*?)\s+[\[\{\<]/ ) { + # Terminator: space then '[' or '{' or '<' + # Use *? in condition: to pick up first ' [' (etc) + # as terminator } - elsif ( /^([^\(^\)]*)\s(?=\()/ ) { + elsif ( /^([^\(^\)]*)\s+(?=\()/ ) { # Terminator is ' (', but '(' isn't in matched string, # so we keep the '(' ready for the next match } elsif ( /^([^\(^\)]*)(\))/ ) { # Terminator is ')' } - elsif ( /^([^\(^\)]*?)\s*\{/ ) { - # Terminator: arbitrary space then '{' - # Use *? in condition: to pick up first ' [' as terminator - # 'file [' should give good filename. - } else { #Terminator is end-of-string } $_ = $'; # Put $_ equal to the unmatched tail of string ' my $include_candidate = $1; $include_candidate =~ s/\s*$//; # Remove trailing space. + if ( !$quoted && ($include_candidate =~ /(\S+)\s/ ) ){ + # Non-space-containing filename-candidate + # followed by space followed by message + # (Common) + push @new_includes, $1; + } if ( $include_candidate eq "[]" ) { # Part of overfull hbox message next INCLUDE_CANDIDATE; @@ -3191,14 +3180,13 @@ LINE: # treated this as a special case. For safety check here: $include_candidate =~ s/^\"(.*)\"$/$1/; - # Make list of new include files; sometimes more than one. - my @new_includes = ($include_candidate); + push @new_includes, $include_candidate; if ( $include_candidate =~ /^(.+)\[([^\]]+)\]$/ ) { # Construct of form 'file1[file2]', as produced by pdflatex if ( -e $1 ) { # If the first component exists, we probably have the # pdflatex form - @new_includes = ($1, $2); + push @new_includes, $1, $2; } else { # We have something else. @@ -4000,7 +3988,7 @@ sub rdb_set_from_logB { rdb_ensure_file( $from_rule, $source ); delete $old_sources{$source}; } - if ($diagnostics>-1 ) { + if ($diagnostics) { foreach ( keys %old_sources ) { print "Removing no-longer-needed dependent '$_' from rule '$from_rule'\n"; } @@ -4080,7 +4068,7 @@ NEW_SOURCE: foreach (keys %$PHsource) { if ( ! exists $dependents{$_} ) { print "Removing no-longer-needed dependent '$_' from rule '$rule'\n" - if $diagnostics>-1; + if $diagnostics; push @files_not_needed, $_; } } @@ -4546,7 +4534,7 @@ sub rdb_makeB { "make new source files\n"; next PASS; } - elsif ( ! $failure ) { + elsif ( $force_mode || (! $failure) ) { next PASS; } } |