diff options
Diffstat (limited to 'Master/texmf-dist/scripts/latexmk')
-rwxr-xr-x | Master/texmf-dist/scripts/latexmk/latexmk.pl | 120 |
1 files changed, 53 insertions, 67 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl index e721d8f2e05..bf3a7f7ee38 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.13a'; -$version_details = "$My_name, John Collins, 16 January 2010"; +$version_num = '4.15'; +$version_details = "$My_name, John Collins, 7 April 2010"; use Config; @@ -176,51 +176,22 @@ else { ## 5. Parsing of log file instead of source file is used to ## obtain dependencies, by default. ## -## Modification log from 25 Nov 2009 onwards in detail +## Modification log from 22 Jan 2010 onwards in detail ## -## 16 Jan 2010, John Collins V. 4.13a. -## Correct bug in deleting extra files (I wasn't -## consistent about periods in file extensions) -## Delete unused subroutines -## 13 Jan 2010, John Collins V. 4.13 -## 27 Dec 2009, John Collins Correct position of inserting bbl into list -## of generated extensions. -## Correct clean_up. It stopped deleting aux -## file. -## $bibtex_use defaults to 1. -## 15 Dec 2009, John Collins Option not to do bibtex -## (to allow for case that bbl files -## are available, but no bibtex). -## 27 Nov 2009, John Collins Solve problem that changes in \include -## files weren't reflected in changes -## in bibtex source files. -## Remove excess recalculations of md5 in -## startup and when initializing rule -## from fdb_latexmk file. -## Fdb_latexmk now has data for all rules -## need for making target files, -## not just rules accessible from primary -## rules. -## 26 Nov 2009, John Collins In testing for changes, when filetime -## has changed, but file is unchanged, -## update filetime in rule. -## This saves excessive md5 calculations. -## 25 Nov 2009, John Collins Fixed issue with fdb_get and 1-second -## granularity of file timestamps. -## The issue was that if runs of -## latex (etc) occur within the -## 1-second time granularity, file -## contents can change even though -## the file's time and size are -## unchanged, falsifying an -## assumption made by fdb_get, but -## only when the old time is the -## same as the run time of a command -## that uses the file. -## Avoided excess md5 calculations at -## startup. +## 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. ## -## 1998-2009, John Collins. Many improvements and fixes. +## 1998-2010, John Collins. Many improvements and fixes. ## See CHANGE-log.txt for full list, and CHANGES for summary ## ## Modified by Evan McLean (no longer available for support) @@ -446,6 +417,8 @@ $new_viewer_always = 0; # If 1, always open a new viewer in pvc mode. $quote_filenames = 1; # Quote filenames in external commands + + ######################################################################### ################################################################ @@ -506,10 +479,6 @@ if ( $^O eq "MSWin32" ) { $search_path_separator = ';'; # Separator of elements in search_path - # For both fptex and miktex, the following makes error messages explicit: - $latex_silent_switch = '-interaction=batchmode -c-style-errors'; - $pdflatex_silent_switch = '-interaction=batchmode -c-style-errors'; - # For a pdf-file, "start x.pdf" starts the pdf viewer associated with # pdf files, so no program name is needed: $pdf_previewer = 'start %O %S'; @@ -613,10 +582,6 @@ elsif ( $^O eq "cygwin" ) { # of executable: native NT v. cygwin. # So the user will have to override this. - # For both fptex and miktex, the following makes error messages explicit: - $latex_silent_switch = '-interaction=batchmode -c-style-errors'; - $pdflatex_silent_switch = '-interaction=batchmode -c-style-errors'; - # We will assume that files can be viewed by native NT programs. # Then we must fix the start command/directive, so that the # NT-native start command of a cmd.exe is used. @@ -1583,8 +1548,8 @@ $quell_uptodate_msgs = $silent; #?? Unneeded now: $save_bibtex_mode = $bibtex_mode; $failure_count = 0; -$last_failed = 0; # Flag whether failed on making last file - # This is used for showing suitable error diagnostics +@failed_primaries = (); + FILE: foreach $filename ( @file_list ) { @@ -1812,10 +1777,7 @@ continue { } if ( ($failure > 0) || ($error_message_count > 0) ) { $failure_count ++; - $last_failed = 1; - } - else { - $last_failed = 0; + push @failed_primaries, $filename; } &ifcd_popd; } @@ -1827,11 +1789,13 @@ if ( $do_cd && ($#dir_stack > -1) ) { } if ($failure_count > 0) { - if ( $last_failed <= 0 ) { - # Error occured, but not on last file, so - # user may not have seen error messages + if ( $#file_list > 0 ) { + # Error occured, but multiple files were processed, so + # user may not have seen all the error messages warn "\n------------\n"; - warn "$My_name: Some operations failed.\n"; + show_array( + "$My_name: Some operations failed, for the following tex file(s)", + @failed_primaries); } if ( !$force_mode ) { warn "$My_name: Use the -f option to force complete processing.\n"; @@ -2346,6 +2310,7 @@ sub make_preview_continuousB { # Set $first_time to flag first run (to save unnecessary diagnostics) CHANGE: for (my $first_time = 1; 1; $first_time = 0 ) { + my %rules_to_watch = %requested_filerules; $updated = 0; $failure = 0; $failure_msg = ''; @@ -2367,11 +2332,22 @@ CHANGE: 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 as up-to-date + + # 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"; @@ -2420,7 +2396,7 @@ CHANGE: WAIT: while (1) { sleep($sleep_time); if ($have_break) { last WAIT; } - if ( rdb_new_changes(@targets) ) { + if ( rdb_new_changes(keys %rules_to_watch) ) { if (!$silent) { warn "$My_name: Need to remake files.\n"; &rdb_diagnose_changes( ' ' ); @@ -3198,7 +3174,14 @@ LINE: CANDIDATE: foreach my $candidate (keys %dependents) { my $code = $dependents{$candidate}; - if ( -e $candidate ) { + if ( -d $candidate ) { + # If $candidate is directory, it was presumably found from a + # mis-parse, so remove it from the list. (Misparse can + # arise, for example from a mismatch of latexmk's $log_wrap + # value and texmf.cnf value of max_print_line.) + delete $dependents{$candidate}; + } + elsif ( -e $candidate ) { if ( exists $generated_log{$candidate} ){ $dependents{$candidate} = 6; } @@ -5667,7 +5650,6 @@ sub rdb_file_exists { #************************************************************ sub rdb_update_gen_files { - # Call: fdb_updateA # Assumes rule context. Update source files of rule to current state. rdb_do_files( sub{ @@ -5962,6 +5944,10 @@ sub get_checksum_md5 { # STDIN: open( $input, '-' ); } + elsif ( -d $source ) { + # We won't use checksum for directory + return 0; + } else { open( $input, '<', $source ) or return 0; |