diff options
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl | 146 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexmk.1 | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexmk.man1.pdf | bin | 218166 -> 217752 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/CHANGES | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/INSTALL | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/README | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/latexmk.pdf | bin | 193197 -> 193225 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/latexmk.txt | 146 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/latexmk/latexmk.pl | 146 |
9 files changed, 267 insertions, 193 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl index afa5cdcd594..3758cf22ef0 100755 --- a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl +++ b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl +use warnings; ## Copyright John Collins 1998-2021 ## (username jcc8 at node psu.edu) @@ -28,7 +29,12 @@ ## ## Modification log from 14 Apr 2021 onwards in detail ## -## 3 May 2021 John Collins Minor corrections +## 16 May 2021 John Collins Deal with some variable used only once warnings +## Remove by default informational messages on rc +## files read, and aux_dir and out_dir setting. +## 5-6 May 2021 John Collins Correct normalization of aux and out dirs. +## Version 4.74 +## 3 May 2021 John Collins Minor corrections. Submit to CTAN. ## 30 Apr 2021 John Collins Revert the change of 14-15 Apr, by removing the ## of cwd(). That gave sometimes obnoxiously slow ## parsing of big log files, because of the slowness @@ -76,8 +82,8 @@ $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.73'; -$version_details = "$My_name, John Collins, 3 May 2021"; +$version_num = '4.74'; +$version_details = "$My_name, John Collins, 16 May 2021"; use Config; use File::Basename; @@ -124,7 +130,7 @@ use Digest::MD5; # The following variables are assigned once and then used in symbolic # references, so we need to avoid warnings 'name used only once': -use vars qw( $dvi_update_command $ps_update_command $pdf_update_command ); +use vars qw( $dvi_update_command $ps_update_command $pdf_update_command $out_dir_requested ); # Translation of signal names to numbers and vv: %signo = (); @@ -1015,9 +1021,13 @@ $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? +$silent = 0; # Whether fo silence latex's messages (and others) $warnings_as_errors = 0;# Treat warnings as errors and exit with non-zero exit code $silence_logfile_warnings = 0; # Do list warnings in log file +$rc_report = 0; # Whether to report on rc files read +$aux_out_dir_report = 0; # Whether to report on aux_dir & out_dir after + # initialization and normalization + $kpsewhich_show = 0; # Show calls to and results from kpsewhich $landscape_mode = 0; # default to portrait mode $analyze_input_log_always = 1; # Always analyze .log for input files in the @@ -1859,8 +1869,9 @@ while ($_ = $ARGV[0]) } } -show_array( "Rc files read:", @rc_files_read ) - unless ( $silent && ! $diagnostics ); +if ( $diagnostics || $rc_report ) { + show_array( "Rc files read:", @rc_files_read ); +} if ( $bad_options > 0 ) { &exit_help( "Bad options specified" ); @@ -1869,17 +1880,22 @@ if ( $bad_options > 0 ) { warn "$My_name: This is $version_details, version: $version_num.\n", unless $silent; - +if ($out_dir eq '' ){ + # Default to cwd + $out_dir = '.'; +} if ( $aux_dir eq '' ){ -# ????????????This may be wrong, given MiKTeX's behavior + # Default to out_dir + # ?? This is different than MiKTeX $aux_dir = $out_dir; } - # Save original values for use in diagnositics. # We may change $aux_dir and $out_dir after a detection # of results of misconfiguration. $aux_dir_requested = $aux_dir; $out_dir_requested = $out_dir; + + # The following reports results of diagnostics on location of .log file # after the first run of a latex engine, when actually used aux_dir # may not be the expected one, due to a configuration error. @@ -2279,6 +2295,7 @@ foreach $filename ( @file_list ) else { $path = ''; } + local $aux_dir = $aux_dir; local $out_dir = $out_dir; local $latex = $latex; @@ -2287,7 +2304,6 @@ foreach $filename ( @file_list ) local $xelatex = $xelatex; &normalize_aux_out_ETC; - # Set -output-directory and -aux-directory options for *latex &set_aux_out_options; @@ -2717,20 +2733,37 @@ sub ensure_path { sub normalize_aux_out_ETC { # 1. Normalize $out_dir and $aux_dir, so that if they have a non-trivial last # component, any trailing '/' is removed. - # 2. Set $out_dir1 and $aux_dir1 to have a directory separator character + # 2. They should be non-empty. + # 3. Set $out_dir1 and $aux_dir1 to have a directory separator character # '/' added if needed to give forms suitable for direct concatenation with # a filename. These are needed for substitutions like %Y%R. # Nasty cases of dir_name: "/" on all systems, "A:", "A:/" etc on MS-Win - # 3. Set some TeX-related environment variables. - # 4. Ensure the aux and out directories exist - $aux_dir = dirname_no_tail( $aux_dir ); - $out_dir = dirname_no_tail( $out_dir ); + # 4. Set some TeX-related environment variables. + # 5. Ensure the aux and out directories exist + + # Ensure the output/auxiliary directories exist, if need be + my $ret1 = 0; + my $ret2 = 0; + eval { + if ( $out_dir ) { + $ret1 = make_path_mod( $out_dir, 'output' ); + } + if ( $aux_dir && ($aux_dir ne $out_dir) ) { + $ret2 = make_path_mod( $aux_dir, 'auxiliary' ); + } + }; + if ($ret1 || $ret2 || $@ ) { + if ($@) { print "Error message:\n $@"; } + die "$My_name: Since there was trouble making the output (and aux) dirs, I'll stop\n" + } + if ($normalize_names) { foreach ( $aux_dir, $out_dir ) { $_ = normalize_filename_abs($_); } } $aux_dir1 = $aux_dir; $out_dir1 = $out_dir; foreach ( $aux_dir1, $out_dir1 ) { + if ($_ eq '.') {$_ = '';} if ( ($_ ne '') && ! m([\\/\:]$) ) { # Add a trailing '/' if necessary to give a string that can be # correctly concatenated with a filename: @@ -2777,16 +2810,7 @@ sub normalize_aux_out_ETC { $ENV{TEXMFOUTPUT} = $aux_dir; } - # Ensure the output/auxiliary directories exist, if need be - if ( $out_dir ) { - make_path_mod( $out_dir, 'output' ); - } - - if ( $aux_dir && ($aux_dir ne $out_dir) ) { - make_path_mod( $aux_dir, 'auxiliary' ); - } - - if ($diagnostics) { + if ($diagnostics || $aux_out_dir_report ) { warn "$My_name: Cwd: '", good_cwd(), "'\n"; warn "$My_name: Normalized aux dir and out dir: '$aux_dir', '$out_dir'\n"; warn "$My_name: and combining forms: '$aux_dir1', '$out_dir1'\n"; @@ -2800,10 +2824,14 @@ sub set_aux_out_options { # Set -output-directory and -aux-directory options for *latex. Use # placeholders for substitutions so that correct value is put in at # runtime. - # N.B. At this point, empty $aux_dir means cwd, unlike the definition - # used in initialization stage of latexmk. + # N.B. At this point, $aux_dir and $out_dir should be non-empty, unlike the + # case after the reading of latexmkrc files, where empty string means + # use default. Let's be certain, however: + if ($out_dir eq '') { $out_dir = '.'; $out_dir1 = ''; } + if ($aux_dir eq '') { $aux_dir = $out_dir; $aux_dir1 = $out_dir1; } + if ($emulate_aux) { - if ( $aux_dir && ($aux_dir ne '.') ) { + if ( $aux_dir ne '.' ) { # N.B. Set **output** directory to **aux_dir**, rather than # out_dir. If aux and out dirs are are different, then we'll move # the relevant files (.pdf, .ps, .dvi, .xdv, .fls to the output @@ -2821,15 +2849,8 @@ sub set_aux_out_options { # N.B. If $aux_dir and $out_dir are the same, then the # -output-directory option is sufficient, especially because # the -aux-directory exists only in MiKTeX, not in TeXLive. - if ($aux_dir) { - add_option( "-aux-directory=%V", - \$latex, \$pdflatex, \$lualatex, \$xelatex ); - } - else { - # Must have a non-empty string for argument of -aux-directory: - add_option( "-aux-directory=.", + add_option( "-aux-directory=%V", \$latex, \$pdflatex, \$lualatex, \$xelatex ); - } } } } #END set_aux_out_options @@ -3899,8 +3920,8 @@ sub print_help " -f- - turn off forced continuing processing past errors\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", - " -g- - Turn off -g\n", + " -g - process at least one run of all rules\n", + " -g- - Turn off -g and -gg\n", " -h - print help\n", " -help - print help\n", " -indexfudge or -makeindexfudge - change directory to output directory when running makeindex\n", @@ -5299,11 +5320,10 @@ sub find_set_log { else { warn " But emulate_aux is off. So I'll turn it on.\n"; $emulate_aux = 1; - foreach ( $$Pext_cmd, $$Pint_cmd ) { + foreach ( $$Pext_cmd ) { s/ -output-directory=[^ ]*(?= )//g; s/ -aux(-directory=[^ ]*)(?= )/ -output$1/g; } - print "========== '$$Pext_cmd' '$$Pint_cmd'\n"; } } elsif ( test_gen_file( "$root_filename.log" ) ) { @@ -5487,7 +5507,8 @@ sub normalize_filename { # Usage: normalize_filename( filename [, extra forms of name of cwd] ) # Returns filename with removal of various forms for cwd, and # with conversion of directory separator to '/' only. - # Works also when filename is name of a directory. + # Also when filename is name of a directory, with a trailing '/', + # the trailing '/' is removed. # my ( $file, @dirs ) = @_; my $file1 = $file; # Saved original value @@ -5496,9 +5517,11 @@ sub normalize_filename { # (Note both / and \ are allowed under MSWin.) foreach ($cwd, $file, @dirs) { s(\\)(/)g; + # If this is directory name of form :.../", remove unnecessary + # trailing directory separators: $_ = dirname_no_tail( $_ ); } - if ($filename eq '.') { $filename = ''; } + # Remove initial component equal to current working directory. # Use \Q and \E round directory name in regex to avoid interpretation # of metacharacters in directory name: @@ -5516,12 +5539,11 @@ sub normalize_filename { last; } } - if ($file eq '.' ) { - # This only occurs for a directory that is the cwd. - # Our convention is always to replace this by a blank. - # Watch out for tests of existence that will go wrong, - # and for a form for concatenating this with a filename. - $file = ''; + if ($file eq '' ) { + # This only occurs for $file equal to a directory that + # is the cwd. Our convention is always to set it to '.' + # + $file = '.'; } return $file; } #END normalize_filename @@ -9424,15 +9446,12 @@ sub make_path_mod { elsif ( -l $dir ) { $ret = 1; warn "$My_name: you requested $title directory '$dir',\n", - " but there exists a symlink that has the same name, but\n", - " does not point to anything. I won't create a directory, and\n", - " that will probably give an error later.\n"; + " but there exists a symlink of the same name. I won't create a directory,\n"; } elsif ( ! -d $dir ) { $ret = 2; warn "$My_name: you requested $title directory '$dir',\n", - " but an ordinary file of the same name exists, which will\n", - " probably give an error later.\n"; + " but an ordinary file of the same name exists.\n"; } return $ret; } @@ -10112,7 +10131,22 @@ sub good_cwd { sub pushd { push @dir_stack, [cwd(), $cache{cwd}]; if ( $#_ > -1) { - chdir dirname_no_tail( $_[0] ); + local $ret = 0; + eval { + if ( -d $_[0] ) { + $ret = chdir dirname_no_tail( $_[0] ); + } + else { + print "$my_name: Can't change directory to '$_[0]'\n", + " A directory of the same name does not exist.\n"; + } + }; + if ( ($ret == 0) || $@ ) { + if ($@) { + print "Error:\n $@" ; + } + die "$My_name: Error in changing directory to '$_[0]'. I must stop\n"; + } &cache_good_cwd; } } @@ -10122,7 +10156,7 @@ sub pushd { sub popd { if ($#dir_stack > -1 ) { my $Parr = pop @dir_stack; - chdir $$Parr[0]; + chdir $$Parr[0]; $cache{cwd} = $$Parr[1]; } } diff --git a/Master/texmf-dist/doc/man/man1/latexmk.1 b/Master/texmf-dist/doc/man/man1/latexmk.1 index 6c2bc9f30a8..7149072b67f 100644 --- a/Master/texmf-dist/doc/man/man1/latexmk.1 +++ b/Master/texmf-dist/doc/man/man1/latexmk.1 @@ -1,4 +1,4 @@ -.TH LATEXMK 1 "3 May 2021" "" +.TH LATEXMK 1 "16 May 2021" "" .SH NAME latexmk \- generate LaTeX document .SH SYNOPSIS @@ -3919,7 +3919,7 @@ e-mail addresses are not written in their standard form to avoid being harvested too easily.) .SH AUTHOR Current version, by John Collins -(Version 4.73). +(Version 4.74). Report bugs etc to his e-mail (jcc8 at psu.edu). Released version can be obtained from CTAN: diff --git a/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf b/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf Binary files differindex 72f6a657988..2f10380d6e9 100644 --- a/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf diff --git a/Master/texmf-dist/doc/support/latexmk/CHANGES b/Master/texmf-dist/doc/support/latexmk/CHANGES index c24292b0d2a..84b949bbd2e 100644 --- a/Master/texmf-dist/doc/support/latexmk/CHANGES +++ b/Master/texmf-dist/doc/support/latexmk/CHANGES @@ -762,3 +762,9 @@ From v. 4.72b to 4.73 implementation other than MiKTeX. (At the moment the only documentation of this feature is given by latexmk --help.) +From v. 4.73 to 4.74 + Correct treatment of aux_dir and out_dir to avoid bugs that appeared on + MS-Windows only. + Remove some informational messages (about rc files, and the state of + aux and dir settings after normalization). + diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL index c3443d28977..916c1097d87 100644 --- a/Master/texmf-dist/doc/support/latexmk/INSTALL +++ b/Master/texmf-dist/doc/support/latexmk/INSTALL @@ -1,6 +1,6 @@ INSTALLING latexmk ================== - (Version 4.73, 3 May 2021) + (Version 4.74, 16 May 2021) John Collins Physics Department diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README index 2ec292f02ee..ce7d3ff66fe 100644 --- a/Master/texmf-dist/doc/support/latexmk/README +++ b/Master/texmf-dist/doc/support/latexmk/README @@ -1,5 +1,5 @@ -Latexmk, version 4.73, 3 May 2021 ---------------------------------- +Latexmk, version 4.74, 16 May 2021 +---------------------------------- Latexmk completely automates the process of generating a LaTeX document. Essentially, it is a highly specialized cousin of the @@ -87,7 +87,7 @@ NOTES:- John Collins ---------------------------- "latexmk -h" ---------------------------- -Latexmk 4.73: Automatic LaTeX document generation routine +Latexmk 4.74: Automatic LaTeX document generation routine Usage: latexmk [latexmk_options] [filename ...] @@ -133,8 +133,8 @@ Usage: latexmk [latexmk_options] [filename ...] -f- - turn off forced continuing processing past errors -gg - Super go mode: clean out generated files (-CA), and then process files regardless of file timestamps - -g - process regardless of file timestamps - -g- - Turn off -g + -g - process at least one run of all rules + -g- - Turn off -g and -gg -h - print help -help - print help -indexfudge or -makeindexfudge - change directory to output directory when running makeindex diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf Binary files differindex 24874cdfb56..52212066b49 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.txt b/Master/texmf-dist/doc/support/latexmk/latexmk.txt index fa73538a8e2..406625e5ad0 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt @@ -61,7 +61,7 @@ DESCRIPTION - 3 May 2021 1 + 16 May 2021 1 @@ -127,7 +127,7 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE - 3 May 2021 2 + 16 May 2021 2 @@ -193,7 +193,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 3 + 16 May 2021 3 @@ -259,7 +259,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 4 + 16 May 2021 4 @@ -325,7 +325,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 5 + 16 May 2021 5 @@ -391,7 +391,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 6 + 16 May 2021 6 @@ -457,7 +457,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 7 + 16 May 2021 7 @@ -523,7 +523,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 8 + 16 May 2021 8 @@ -589,7 +589,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 9 + 16 May 2021 9 @@ -655,7 +655,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 10 + 16 May 2021 10 @@ -721,7 +721,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 11 + 16 May 2021 11 @@ -787,7 +787,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 12 + 16 May 2021 12 @@ -853,7 +853,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 13 + 16 May 2021 13 @@ -919,7 +919,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 14 + 16 May 2021 14 @@ -985,7 +985,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 15 + 16 May 2021 15 @@ -1051,7 +1051,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 16 + 16 May 2021 16 @@ -1117,7 +1117,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 17 + 16 May 2021 17 @@ -1183,7 +1183,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 18 + 16 May 2021 18 @@ -1249,7 +1249,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 19 + 16 May 2021 19 @@ -1315,7 +1315,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 20 + 16 May 2021 20 @@ -1381,7 +1381,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 21 + 16 May 2021 21 @@ -1447,7 +1447,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 22 + 16 May 2021 22 @@ -1513,7 +1513,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 23 + 16 May 2021 23 @@ -1579,7 +1579,7 @@ DEALING WITH ERRORS, PROBLEMS, ETC - 3 May 2021 24 + 16 May 2021 24 @@ -1645,7 +1645,7 @@ ALLOWING FOR CHANGE OF OUTPUT FILE TYPE - 3 May 2021 25 + 16 May 2021 25 @@ -1711,7 +1711,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 26 + 16 May 2021 26 @@ -1777,7 +1777,7 @@ CONFIGURATION/INITIALIZATION (RC) FILES - 3 May 2021 27 + 16 May 2021 27 @@ -1843,7 +1843,7 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES - 3 May 2021 28 + 16 May 2021 28 @@ -1909,7 +1909,7 @@ FORMAT OF COMMAND SPECIFICATIONS - 3 May 2021 29 + 16 May 2021 29 @@ -1975,7 +1975,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 30 + 16 May 2021 30 @@ -2041,7 +2041,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 31 + 16 May 2021 31 @@ -2107,7 +2107,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 32 + 16 May 2021 32 @@ -2173,7 +2173,7 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES - 3 May 2021 33 + 16 May 2021 33 @@ -2239,7 +2239,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 34 + 16 May 2021 34 @@ -2305,7 +2305,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 35 + 16 May 2021 35 @@ -2371,7 +2371,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 36 + 16 May 2021 36 @@ -2437,7 +2437,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 37 + 16 May 2021 37 @@ -2503,7 +2503,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 38 + 16 May 2021 38 @@ -2569,7 +2569,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 39 + 16 May 2021 39 @@ -2635,7 +2635,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 40 + 16 May 2021 40 @@ -2701,7 +2701,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 41 + 16 May 2021 41 @@ -2767,7 +2767,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 42 + 16 May 2021 42 @@ -2833,7 +2833,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 43 + 16 May 2021 43 @@ -2899,7 +2899,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 44 + 16 May 2021 44 @@ -2965,7 +2965,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 45 + 16 May 2021 45 @@ -3031,7 +3031,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 46 + 16 May 2021 46 @@ -3097,7 +3097,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 47 + 16 May 2021 47 @@ -3163,7 +3163,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 48 + 16 May 2021 48 @@ -3229,7 +3229,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 49 + 16 May 2021 49 @@ -3295,7 +3295,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 50 + 16 May 2021 50 @@ -3361,7 +3361,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 51 + 16 May 2021 51 @@ -3427,7 +3427,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 52 + 16 May 2021 52 @@ -3493,7 +3493,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 53 + 16 May 2021 53 @@ -3559,7 +3559,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 54 + 16 May 2021 54 @@ -3625,7 +3625,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 55 + 16 May 2021 55 @@ -3691,7 +3691,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 56 + 16 May 2021 56 @@ -3757,7 +3757,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 57 + 16 May 2021 57 @@ -3823,7 +3823,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 58 + 16 May 2021 58 @@ -3889,7 +3889,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 59 + 16 May 2021 59 @@ -3955,7 +3955,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 60 + 16 May 2021 60 @@ -4021,7 +4021,7 @@ CUSTOM DEPENDENCIES - 3 May 2021 61 + 16 May 2021 61 @@ -4087,7 +4087,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 62 + 16 May 2021 62 @@ -4153,7 +4153,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 63 + 16 May 2021 63 @@ -4219,7 +4219,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 64 + 16 May 2021 64 @@ -4285,7 +4285,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 65 + 16 May 2021 65 @@ -4351,7 +4351,7 @@ ADVANCED CONFIGURATION: Some extra resources and advanced tricks - 3 May 2021 66 + 16 May 2021 66 @@ -4417,7 +4417,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 67 + 16 May 2021 67 @@ -4483,7 +4483,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 68 + 16 May 2021 68 @@ -4549,7 +4549,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 69 + 16 May 2021 69 @@ -4615,7 +4615,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 3 May 2021 70 + 16 May 2021 70 @@ -4681,7 +4681,7 @@ BUGS - 3 May 2021 71 + 16 May 2021 71 @@ -4698,7 +4698,7 @@ THANKS TO dard form to avoid being harvested too easily.) AUTHOR - Current version, by John Collins (Version 4.73). Report bugs etc to + Current version, by John Collins (Version 4.74). Report bugs etc to his e-mail (jcc8 at psu.edu). Released version can be obtained from CTAN: @@ -4747,6 +4747,6 @@ AUTHOR - 3 May 2021 72 + 16 May 2021 72 diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl index afa5cdcd594..3758cf22ef0 100755 --- a/Master/texmf-dist/scripts/latexmk/latexmk.pl +++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl +use warnings; ## Copyright John Collins 1998-2021 ## (username jcc8 at node psu.edu) @@ -28,7 +29,12 @@ ## ## Modification log from 14 Apr 2021 onwards in detail ## -## 3 May 2021 John Collins Minor corrections +## 16 May 2021 John Collins Deal with some variable used only once warnings +## Remove by default informational messages on rc +## files read, and aux_dir and out_dir setting. +## 5-6 May 2021 John Collins Correct normalization of aux and out dirs. +## Version 4.74 +## 3 May 2021 John Collins Minor corrections. Submit to CTAN. ## 30 Apr 2021 John Collins Revert the change of 14-15 Apr, by removing the ## of cwd(). That gave sometimes obnoxiously slow ## parsing of big log files, because of the slowness @@ -76,8 +82,8 @@ $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.73'; -$version_details = "$My_name, John Collins, 3 May 2021"; +$version_num = '4.74'; +$version_details = "$My_name, John Collins, 16 May 2021"; use Config; use File::Basename; @@ -124,7 +130,7 @@ use Digest::MD5; # The following variables are assigned once and then used in symbolic # references, so we need to avoid warnings 'name used only once': -use vars qw( $dvi_update_command $ps_update_command $pdf_update_command ); +use vars qw( $dvi_update_command $ps_update_command $pdf_update_command $out_dir_requested ); # Translation of signal names to numbers and vv: %signo = (); @@ -1015,9 +1021,13 @@ $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? +$silent = 0; # Whether fo silence latex's messages (and others) $warnings_as_errors = 0;# Treat warnings as errors and exit with non-zero exit code $silence_logfile_warnings = 0; # Do list warnings in log file +$rc_report = 0; # Whether to report on rc files read +$aux_out_dir_report = 0; # Whether to report on aux_dir & out_dir after + # initialization and normalization + $kpsewhich_show = 0; # Show calls to and results from kpsewhich $landscape_mode = 0; # default to portrait mode $analyze_input_log_always = 1; # Always analyze .log for input files in the @@ -1859,8 +1869,9 @@ while ($_ = $ARGV[0]) } } -show_array( "Rc files read:", @rc_files_read ) - unless ( $silent && ! $diagnostics ); +if ( $diagnostics || $rc_report ) { + show_array( "Rc files read:", @rc_files_read ); +} if ( $bad_options > 0 ) { &exit_help( "Bad options specified" ); @@ -1869,17 +1880,22 @@ if ( $bad_options > 0 ) { warn "$My_name: This is $version_details, version: $version_num.\n", unless $silent; - +if ($out_dir eq '' ){ + # Default to cwd + $out_dir = '.'; +} if ( $aux_dir eq '' ){ -# ????????????This may be wrong, given MiKTeX's behavior + # Default to out_dir + # ?? This is different than MiKTeX $aux_dir = $out_dir; } - # Save original values for use in diagnositics. # We may change $aux_dir and $out_dir after a detection # of results of misconfiguration. $aux_dir_requested = $aux_dir; $out_dir_requested = $out_dir; + + # The following reports results of diagnostics on location of .log file # after the first run of a latex engine, when actually used aux_dir # may not be the expected one, due to a configuration error. @@ -2279,6 +2295,7 @@ foreach $filename ( @file_list ) else { $path = ''; } + local $aux_dir = $aux_dir; local $out_dir = $out_dir; local $latex = $latex; @@ -2287,7 +2304,6 @@ foreach $filename ( @file_list ) local $xelatex = $xelatex; &normalize_aux_out_ETC; - # Set -output-directory and -aux-directory options for *latex &set_aux_out_options; @@ -2717,20 +2733,37 @@ sub ensure_path { sub normalize_aux_out_ETC { # 1. Normalize $out_dir and $aux_dir, so that if they have a non-trivial last # component, any trailing '/' is removed. - # 2. Set $out_dir1 and $aux_dir1 to have a directory separator character + # 2. They should be non-empty. + # 3. Set $out_dir1 and $aux_dir1 to have a directory separator character # '/' added if needed to give forms suitable for direct concatenation with # a filename. These are needed for substitutions like %Y%R. # Nasty cases of dir_name: "/" on all systems, "A:", "A:/" etc on MS-Win - # 3. Set some TeX-related environment variables. - # 4. Ensure the aux and out directories exist - $aux_dir = dirname_no_tail( $aux_dir ); - $out_dir = dirname_no_tail( $out_dir ); + # 4. Set some TeX-related environment variables. + # 5. Ensure the aux and out directories exist + + # Ensure the output/auxiliary directories exist, if need be + my $ret1 = 0; + my $ret2 = 0; + eval { + if ( $out_dir ) { + $ret1 = make_path_mod( $out_dir, 'output' ); + } + if ( $aux_dir && ($aux_dir ne $out_dir) ) { + $ret2 = make_path_mod( $aux_dir, 'auxiliary' ); + } + }; + if ($ret1 || $ret2 || $@ ) { + if ($@) { print "Error message:\n $@"; } + die "$My_name: Since there was trouble making the output (and aux) dirs, I'll stop\n" + } + if ($normalize_names) { foreach ( $aux_dir, $out_dir ) { $_ = normalize_filename_abs($_); } } $aux_dir1 = $aux_dir; $out_dir1 = $out_dir; foreach ( $aux_dir1, $out_dir1 ) { + if ($_ eq '.') {$_ = '';} if ( ($_ ne '') && ! m([\\/\:]$) ) { # Add a trailing '/' if necessary to give a string that can be # correctly concatenated with a filename: @@ -2777,16 +2810,7 @@ sub normalize_aux_out_ETC { $ENV{TEXMFOUTPUT} = $aux_dir; } - # Ensure the output/auxiliary directories exist, if need be - if ( $out_dir ) { - make_path_mod( $out_dir, 'output' ); - } - - if ( $aux_dir && ($aux_dir ne $out_dir) ) { - make_path_mod( $aux_dir, 'auxiliary' ); - } - - if ($diagnostics) { + if ($diagnostics || $aux_out_dir_report ) { warn "$My_name: Cwd: '", good_cwd(), "'\n"; warn "$My_name: Normalized aux dir and out dir: '$aux_dir', '$out_dir'\n"; warn "$My_name: and combining forms: '$aux_dir1', '$out_dir1'\n"; @@ -2800,10 +2824,14 @@ sub set_aux_out_options { # Set -output-directory and -aux-directory options for *latex. Use # placeholders for substitutions so that correct value is put in at # runtime. - # N.B. At this point, empty $aux_dir means cwd, unlike the definition - # used in initialization stage of latexmk. + # N.B. At this point, $aux_dir and $out_dir should be non-empty, unlike the + # case after the reading of latexmkrc files, where empty string means + # use default. Let's be certain, however: + if ($out_dir eq '') { $out_dir = '.'; $out_dir1 = ''; } + if ($aux_dir eq '') { $aux_dir = $out_dir; $aux_dir1 = $out_dir1; } + if ($emulate_aux) { - if ( $aux_dir && ($aux_dir ne '.') ) { + if ( $aux_dir ne '.' ) { # N.B. Set **output** directory to **aux_dir**, rather than # out_dir. If aux and out dirs are are different, then we'll move # the relevant files (.pdf, .ps, .dvi, .xdv, .fls to the output @@ -2821,15 +2849,8 @@ sub set_aux_out_options { # N.B. If $aux_dir and $out_dir are the same, then the # -output-directory option is sufficient, especially because # the -aux-directory exists only in MiKTeX, not in TeXLive. - if ($aux_dir) { - add_option( "-aux-directory=%V", - \$latex, \$pdflatex, \$lualatex, \$xelatex ); - } - else { - # Must have a non-empty string for argument of -aux-directory: - add_option( "-aux-directory=.", + add_option( "-aux-directory=%V", \$latex, \$pdflatex, \$lualatex, \$xelatex ); - } } } } #END set_aux_out_options @@ -3899,8 +3920,8 @@ sub print_help " -f- - turn off forced continuing processing past errors\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", - " -g- - Turn off -g\n", + " -g - process at least one run of all rules\n", + " -g- - Turn off -g and -gg\n", " -h - print help\n", " -help - print help\n", " -indexfudge or -makeindexfudge - change directory to output directory when running makeindex\n", @@ -5299,11 +5320,10 @@ sub find_set_log { else { warn " But emulate_aux is off. So I'll turn it on.\n"; $emulate_aux = 1; - foreach ( $$Pext_cmd, $$Pint_cmd ) { + foreach ( $$Pext_cmd ) { s/ -output-directory=[^ ]*(?= )//g; s/ -aux(-directory=[^ ]*)(?= )/ -output$1/g; } - print "========== '$$Pext_cmd' '$$Pint_cmd'\n"; } } elsif ( test_gen_file( "$root_filename.log" ) ) { @@ -5487,7 +5507,8 @@ sub normalize_filename { # Usage: normalize_filename( filename [, extra forms of name of cwd] ) # Returns filename with removal of various forms for cwd, and # with conversion of directory separator to '/' only. - # Works also when filename is name of a directory. + # Also when filename is name of a directory, with a trailing '/', + # the trailing '/' is removed. # my ( $file, @dirs ) = @_; my $file1 = $file; # Saved original value @@ -5496,9 +5517,11 @@ sub normalize_filename { # (Note both / and \ are allowed under MSWin.) foreach ($cwd, $file, @dirs) { s(\\)(/)g; + # If this is directory name of form :.../", remove unnecessary + # trailing directory separators: $_ = dirname_no_tail( $_ ); } - if ($filename eq '.') { $filename = ''; } + # Remove initial component equal to current working directory. # Use \Q and \E round directory name in regex to avoid interpretation # of metacharacters in directory name: @@ -5516,12 +5539,11 @@ sub normalize_filename { last; } } - if ($file eq '.' ) { - # This only occurs for a directory that is the cwd. - # Our convention is always to replace this by a blank. - # Watch out for tests of existence that will go wrong, - # and for a form for concatenating this with a filename. - $file = ''; + if ($file eq '' ) { + # This only occurs for $file equal to a directory that + # is the cwd. Our convention is always to set it to '.' + # + $file = '.'; } return $file; } #END normalize_filename @@ -9424,15 +9446,12 @@ sub make_path_mod { elsif ( -l $dir ) { $ret = 1; warn "$My_name: you requested $title directory '$dir',\n", - " but there exists a symlink that has the same name, but\n", - " does not point to anything. I won't create a directory, and\n", - " that will probably give an error later.\n"; + " but there exists a symlink of the same name. I won't create a directory,\n"; } elsif ( ! -d $dir ) { $ret = 2; warn "$My_name: you requested $title directory '$dir',\n", - " but an ordinary file of the same name exists, which will\n", - " probably give an error later.\n"; + " but an ordinary file of the same name exists.\n"; } return $ret; } @@ -10112,7 +10131,22 @@ sub good_cwd { sub pushd { push @dir_stack, [cwd(), $cache{cwd}]; if ( $#_ > -1) { - chdir dirname_no_tail( $_[0] ); + local $ret = 0; + eval { + if ( -d $_[0] ) { + $ret = chdir dirname_no_tail( $_[0] ); + } + else { + print "$my_name: Can't change directory to '$_[0]'\n", + " A directory of the same name does not exist.\n"; + } + }; + if ( ($ret == 0) || $@ ) { + if ($@) { + print "Error:\n $@" ; + } + die "$My_name: Error in changing directory to '$_[0]'. I must stop\n"; + } &cache_good_cwd; } } @@ -10122,7 +10156,7 @@ sub pushd { sub popd { if ($#dir_stack > -1 ) { my $Parr = pop @dir_stack; - chdir $$Parr[0]; + chdir $$Parr[0]; $cache{cwd} = $$Parr[1]; } } |