summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexmk/latexmk.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/latexmk/latexmk.pl')
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl209
1 files changed, 108 insertions, 101 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 0f5c35988f5..a05e938f912 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -36,7 +36,7 @@ use warnings;
## ?? Issues with clean-up
## List of aux files deleted is those read, not those generated.
-## Other files are generated by (pdf)latex; should they be deleted?
+## Other files are generated by *latex; should they be deleted?
## (I have hooks for this).
@@ -162,6 +162,12 @@ use warnings;
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
##
+## 29 Sep 2020 John Collins V. 4.70b.
+## Correct switch_output.
+## Try to ensure bibtex isn't given absolute pathname, when aux_dir
+## is under current directory. (Otherwise bibtex isn't allowed
+## to write a bbl file under default TeXLive settings.)
+## Add options -bibfudge, -bibfudge-, -nobibfudge.
## 13 Sep 2020 John Collins V. 4.70a. Updates in comments about bibtex.
## 28 Aug 2020 John Collins Correct $biber and $bibtex to use %S not %B
## 24 Aug 2020 John Collins Make sure bibtex/biber rules when created for
@@ -296,7 +302,6 @@ use warnings;
##
##-----------------------------------------------------------------------
-
## Explicit exit codes:
## 10 = bad command line arguments
## 11 = file specified on command line not found
@@ -308,8 +313,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.70a';
-$version_details = "$My_name, John Collins, 13 September 2020";
+$version_num = '4.70b';
+$version_details = "$My_name, John Collins, 29 September 2020";
use Config;
use File::Basename;
@@ -506,7 +511,7 @@ foreach ( 'dvi', 'dviF', 'ps', 'psF', 'pdf', 'synctex.gz', 'xdv' ) {
# Information about options to latex and pdflatex that latexmk will simply
-# pass through to (pdf)latex
+# pass through to *latex
# Option without arg. maps to itself.
# Option with arg. maps the option part to the full specification
# e.g., -kpathsea-debug => -kpathsea-debug=NUMBER
@@ -611,7 +616,7 @@ foreach (
" called or a %& line.",
#####
- # Options passed to (pdf)latex that have special processing by latexmk,
+ # Options passed to *latex that have special processing by latexmk,
# so they are commented out here.
#-jobname=STRING set the job name to STRING
#-aux-directory=dir Set the directory dir to which auxiliary files are written
@@ -619,7 +624,7 @@ foreach (
#-quiet
#-recorder enable filename recorder
#
- # Options with different processing by latexmk than (pdf)latex
+ # Options with different processing by latexmk than *latex
#-help
#-version
#
@@ -1219,9 +1224,9 @@ $jobname = ''; # Jobname: as with current tex, etc indicates
# useful when a jobname is used and latexmk is
# invoked on multiple files.
$out_dir = ''; # Directory for output files.
- # Cf. --output-directory of current (pdf)latex
+ # Cf. --output-directory of current *latex
$aux_dir = ''; # Directory for aux files (log, aux, etc).
- # Cf. --aux-directory of current (pdf)latex in MiKTeX.
+ # Cf. --aux-directory of current *latex in MiKTeX.
## default flag settings.
@@ -1253,14 +1258,14 @@ $analyze_input_log_always = 1; # Always analyze .log for input files in the
# $analyze_input_log_always to 1.
# The following two arrays contain lists of extensions (without
-# period) for files that are read in during a (pdf)LaTeX run but that
+# period) for files that are read in during a *LaTeX run but that
# are generated automatically from the previous run, as opposed to
# being user generated files (directly or indirectly from a custom
# dependency). These files get two kinds of special treatment:
# 1. In clean up, where depending on the kind of clean up, some
# or all of these generated files are deleted.
# (Note that special treatment is given to aux files.)
-# 2. In analyzing the results of a run of (pdf)LaTeX, to
+# 2. In analyzing the results of a run of *LaTeX, to
# determine if another run is needed. With an error free run,
# a rerun should be provoked by a change in any source file,
# whether a user file or a generated file. But with a run
@@ -1313,7 +1318,7 @@ $cleanup_fdb = 0; # No removal of file for latexmk's file-database
$cleanup_only = 0; # When doing cleanup, do not go on to making files
$cleanup_includes_generated = 0;
# Determines whether cleanup deletes files generated by
- # (pdf)latex (found from \openout lines in log file).
+ # *latex (found from \openout lines in log file).
# It's more than that. BUG
$cleanup_includes_cusdep_generated = 0;
# Determines whether cleanup deletes files generated by
@@ -1581,7 +1586,7 @@ $allow_switch = 1; # Allow switch of rule structure to accommodate
# 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,
+ # during a run of *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
@@ -1781,13 +1786,15 @@ $bad_options = 0;
while ($_ = $ARGV[0])
{
# Make -- and - equivalent at beginning of option,
- # but save original for possible use in (pdf)latex command line
+ # but save original for possible use in *latex command line
$original = $_;
s/^--/-/;
shift;
if ( /^-aux-directory=(.*)$/ || /^-auxdir=(.*)$/ ) {
$aux_dir = $1;
}
+ elsif (/^-bibfudge$/) { $bibtex_fudge = 1; }
+ elsif (/^-bibfudge-$/) { $bibtex_fudge = 0; }
elsif (/^-bibtex$/) { $bibtex_use = 2; }
elsif (/^-bibtex-$/) { $bibtex_use = 0; }
elsif (/^-nobibtex$/) { $bibtex_use = 0; }
@@ -1866,6 +1873,7 @@ while ($_ = $ARGV[0])
$auto_rc_use = 0;
# N.B. This has already been obeyed.
}
+ elsif (/^-nobibfudge$/) { $bibtex_fudge = 0; }
elsif ( /^-output-directory=(.*)$/ ||/^-outdir=(.*)$/ ) {
$out_dir = $1;
}
@@ -1929,16 +1937,16 @@ while ($_ = $ARGV[0])
elsif (/^-norules$/ || /^-rules-$/ ) { $rules_list = 0; }
elsif (/^-showextraoptions$/) {
print "List of extra latex and pdflatex options recognized by $my_name.\n",
- "These are passed as is to (pdf)latex. They may not be recognized by\n",
- "particular versions of (pdf)latex. This list is a combination of those\n",
+ "These are passed as is to *latex. They may not be recognized by\n",
+ "particular versions of *latex. This list is a combination of those\n",
"for TeXLive and MikTeX.\n",
"\n",
"Note that in addition to the options in this list, there are several\n",
- "options known to the (pdf)latex programs that are also recognized by\n",
+ "options known to the *latex programs that are also recognized by\n",
"latexmk and trigger special behavior by latexmk. Since these options\n",
"appear in the main list given by running 'latexmk --help', they do not\n",
"appear in the following list\n",
- "NOTE ALSO: Not all of these options are supported by all versions of (pdf)latex.\n",
+ "NOTE ALSO: Not all of these options are supported by all versions of *latex.\n",
"\n";
foreach $option ( sort( keys %allowed_latex_options, keys %allowed_latex_options_with_arg ) ) {
if (exists $allowed_latex_options{$option} ) { print " $allowed_latex_options{$option}\n"; }
@@ -2239,7 +2247,7 @@ if ( $recorder ) {
add_option( "-recorder", \$latex, \$pdflatex, \$lualatex, \$xelatex );
}
-# If the output and/or aux directories are specified, fix the (pdf)latex
+# If the output and/or aux directories are specified, fix the *latex
# commands to use them.
# N.B. We'll ensure that the directories actually exist only after a
# possible cd to the document directory, since the directories can be
@@ -2579,8 +2587,8 @@ foreach $filename ( @file_list )
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
+ local %conversions = (); # *latex-performed conversions. Not used here.
+ # Maps output file created and read by *latex
# to source file of conversion.
local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
local $fls_file_analyzed = 0;
@@ -2826,7 +2834,7 @@ if ($failure_count > 0) {
if ( $where_log == 2 ) {
warn "$My_name: You requested aux_dir '$aux_dir_requested',\n".
- " but '$aux_dir' was used by the (pdf)latex engine.\n".
+ " but '$aux_dir' was used by the *latex engine.\n".
" That indicates a configuration error.\n";
if ( ($tex_distribution !~ /^MiKTeX/i) && ($aux_dir_requested ne $out_dir_requested) ) {
warn " Probably you set different aux and out directories,\n".
@@ -2836,7 +2844,6 @@ if ( $where_log == 2 ) {
}
-
# end MAIN PROGRAM
#############################################################
#############################################################
@@ -3239,7 +3246,7 @@ sub one_from_main_rule_cache {
warn "$My_name: Possible bug:\n",
" In linking rules I already set from_rules_main{$$Pdest} to '$old_rule'\n",
" But now I want to set it to '$rule'\n";
-#???? traceback();
+# traceback( "================================\nFrom one_from_main_rule_cache" );
}
}
$from_rules_main{$$Pdest} = $rule;
@@ -3258,7 +3265,7 @@ sub one_from_rule_cache {
# OK
}
elsif ( exists $from_rules_main{$_} && ( $from_rules_main{$_} ne $rule ) ) {
- warn "$My_name: Possible problem:\n",
+ warn "$My_name: Possible bug:\n",
" In linking rules, I already set from_rules_main{$_}\n".
" to '$from_rules_main{$_}'\n",
" But now I also have a different rule '$rule' that also made the file.\n";
@@ -3279,7 +3286,7 @@ sub one_from_rule_cache {
warn "$My_name: Possible bug:\n",
" In linking rules I already set from_rules{$_} to '$old_rule'\n",
" But now I want to set it to '$rule'\n";
-#???? traceback();
+# traceback( "================================\nFrom one_from__rule_cache" );
}
}
$from_rules{$_} = $rule;
@@ -3292,7 +3299,7 @@ sub set_trivial_aux_fdb {
# 1. Write aux file EXACTLY as would be written if the tex file
# had no cross references, etc. I.e., a minimal .aux file.
# 2. Write a corresponding fdb file
- # 3. Provoke a run of (pdf)latex (actually of all primaries).
+ # 3. Provoke a run of *latex (actually of all primaries).
local *aux_file;
open( aux_file, '>', $aux_main )
@@ -3679,13 +3686,13 @@ CHANGE:
# 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:
+ # So set the GENERATED files from *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
+ # from dvi, etc haven't been run after an error in *latex, so
# are out-of-date by filetime criterion, but they should not be run
- # until after another (pdf)latex run:
+ # until after another *latex run:
foreach (@post_primary) { delete $rules_to_watch{$_}; }
$failure_msg =~ s/\s*$//; #Remove trailing space
@@ -3918,8 +3925,9 @@ sub die_trace {
#************************************************************
sub traceback {
- # Call: &traceback
- # or traceback( message, )
+ # Call: traceback()
+ # or traceback( message )
+ # NOT &traceback!!!
my $msg = shift;
if ($msg) { warn "$msg\n"; }
warn "Traceback:\n";
@@ -3990,6 +3998,8 @@ sub print_help
" -bibtex-cond - use bibtex when needed, but only if the bib file exists\n",
" -bibtex-cond1 - use bibtex when needed, but only if the bib file exists;\n",
" on cleanup delete bbl file only if bib file exists\n",
+ " -bibfudge - use change-directory fudge needed for old bibtexs\n",
+ " -bibfudge- - don't use change-directory fudge needed for old bibtexs\n",
" -bm <message> - Print message across the page when converting to postscript\n",
" -bi <intensity> - Set contrast or intensity of banner\n",
" -bs <scale> - Set scale for banner\n",
@@ -4030,11 +4040,11 @@ sub print_help
" -l- - turn off -l\n",
" -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",
+ " -latexoption=<option> - add the given option to the *latex command\n",
" -logfilewarninglist or -logfilewarnings \n",
- " give list of warnings after run of (pdf)latex\n",
+ " give list of warnings after run of *latex\n",
" -logfilewarninglist- or -logfilewarnings- \n",
- " do not give list of warnings after run of (pdf)latex\n",
+ " do not give list of warnings after run of *latex\n",
" -lualatex - use lualatex for processing files to pdf\n",
" and turn dvi/ps modes off\n",
" -M - Show list of dependent files after processing\n",
@@ -4047,6 +4057,7 @@ sub print_help
" -new-viewer - in -pvc mode, always start a new viewer\n",
" -new-viewer- - in -pvc mode, start a new viewer only if needed\n",
" -nobibtex - never use bibtex\n",
+ " -nobibfudge - don't use change-directory fudge needed for old bibtexs\n",
" -nodependents - Do not show list of dependent files after processing\n",
" -norc - omit automatic reading of system, user and project rc files\n",
" -output-directory=dir or -outdir=dir\n",
@@ -4086,9 +4097,9 @@ sub print_help
" -r <file> - Read custom RC file\n",
" (N.B. This file could override options specified earlier\n",
" on the command line.)\n",
- " -recorder - Use -recorder option for (pdf)latex\n",
+ " -recorder - Use -recorder option for *latex\n",
" (to give list of input and output files)\n",
- " -recorder- - Do not use -recorder option for (pdf)latex\n",
+ " -recorder- - Do not use -recorder option for *latex\n",
" -rules - Show list of rules after processing\n",
" -rules- - Do not show list of rules after processing\n",
" -showextraoptions - Show other allowed options that are simply passed\n",
@@ -4230,7 +4241,7 @@ sub check_biber_log {
}
elsif ( /> ERROR - .*\.bcf is malformed/ ) {
# Special treatment: Malformed .bcf file commonly results from error
- # in (pdf)latex run. This error must be ignored.
+ # in *latex run. This error must be ignored.
$control_file_malformed = 1;
}
else {
@@ -4381,7 +4392,7 @@ sub check_bibtex_log {
# 3: could not open .blg file.
# 10: only error is missing \citation commands or a missing aux file
# (which would normally be corrected after a later run of
- # (pdf)latex).
+ # *latex).
my $base = $_[0];
my $blg_name = "$base.blg";
@@ -4416,7 +4427,7 @@ sub check_bibtex_log {
if ( $#missing_aux > -1 ) {
# Need to make the missing files.
warn "$My_name: One or more aux files is missing for bibtex. I'll try\n",
- " to get (pdf)latex to remake them.\n";
+ " to get *latex to remake them.\n";
rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
}
#print "Bibtex errors = $error_count, missing aux files and citations = $missing\n";
@@ -4425,7 +4436,7 @@ sub check_bibtex_log {
# If the only error is a missing citation line, that should only
# count as a warning.
# Also a missing aux file should be innocuous; it will be created on
- # next run of (pdf)latex. ?? HAVE I HANDLED THAT CORRECTLY?
+ # next run of *latex. ?? HAVE I HANDLED THAT CORRECTLY?
# But have to deal with the problem that bibtex gives a non-zero
# exit code. So leave things as they are so that the user gets
# a better diagnostic ??????????????????????????
@@ -4549,7 +4560,7 @@ sub parse_log {
# Treat the following specially, since they have special rules
# @bbl_files to list of .bbl files.
# %idx_files to map from .idx files to .ind files.
-# %generated_log: keys give set of files written by (pdf)latex (e.g., aux, idx)
+# %generated_log: keys give set of files written by *latex (e.g., aux, idx)
# as determined by \openout = ... lines in log file.
# @missing_subdirs = list of needed subdirectories of aux_dir
# These are needed for writing aux_files when an included file is in
@@ -4890,7 +4901,7 @@ LINE:
}
# Typically, there is trailing space, not part of filename:
$idx_file =~ s/\s*$//;
- # When (pdf)latex is run with an -output-directory
+ # When *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 );
@@ -4917,16 +4928,10 @@ LINE:
next LINE;
}
elsif ( /^No file (.*?\.bbl)./ ) {
- my $bbl_file = clean_filename($1);
+ my $bbl_file = normalize_force_directory( $aux_dir1, $1);
my $aux_file = $bbl_file;
$aux_file =~ s/\.bbl$/\.aux/;
- # When aux dir used (may equal out dir), name of missing file fails
- # to have correct directory. If corresponding aux file exists,
- # with name prefixed by aux dir, then apply prefix to bbl_file.
- if (-e $aux_dir1 . $aux_file) {
- $bbl_file = $aux_dir1 . $bbl_file;
- }
- warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
+ warn "$My_name: Non-existent bbl file '$bbl_file in line'\n $_\n";
$dependents{$bbl_file} = 0;
push @bbl_files, $bbl_file;
next LINE;
@@ -4961,7 +4966,7 @@ LINE:
# First line of message from includegraphics/x
# But this does NOT include full path information
# (if exact match is not found and a non-trivial
- # kpsearch was done by (pdf)latex).
+ # kpsearch was done by *latex).
# But the source-file information is in the fls file,
# if we are using it.
$dependents{normalize_clean_filename($1, @pwd_log)} = 1;
@@ -5313,8 +5318,8 @@ CANDIDATE_PAIR:
print "Dependents:\n";
foreach (@dependents) {
print " '$_' ";
- if ( $dependents{$_} == 6 ) { print " written by (pdf)latex";}
- if ( $dependents{$_} == 7 ) { print " converted by (pdf)latex";}
+ if ( $dependents{$_} == 6 ) { print " written by *latex";}
+ if ( $dependents{$_} == 7 ) { print " converted by *latex";}
print "\n";
}
if ($not_found > 0) {
@@ -5388,7 +5393,7 @@ sub find_set_log {
$$Plast_result = 2;
$where_log = 0;
$failure_msg
- = "(Pdf)LaTeX didn't generate the expected log file '$log_name'\n";
+ = "*LaTeX didn't generate the expected log file '$log_name'\n";
}
if ($where_log > 1) {
warn "$My_name: Changed aux_dir from '$aux_dir_requested' to '$aux_dir'\n".
@@ -5414,12 +5419,12 @@ sub parse_fls {
# I'll update it from the fls file later
# Currently I don't use this, but it would be useful to use
# this when testing prefix for cwd in a filename, by
- # giving (pdf)latex's best view of the cwd. Note that the
+ # giving *latex's best view of the cwd. Note that the
# value given by the cwd() function may be mangled, e.g., by cygwin
# compared with native MSWin32.
#
# Two relevant forms of cwd exist: The system one, which we can find, and
- # the one reported by (pdf)latex in the fls file. It will be
+ # the one reported by *latex in the fls file. It will be
# useful to remove leading part of cwd in filenames --- see the
# comments in sub rdb_set_latex_deps. Given the possible multiplicity
# of representations of cwd, the one reported in the fls file should
@@ -6044,7 +6049,7 @@ sub rdb_read_set_rule {
}
else {
warn " ===== CHANGING output type from '$newext' to '$oldext' in '$rule'\n";
- my $switch_error = switch_output( $oldext, $newext );
+ my $switch_error = switch_output( $rule, $oldext, $newext );
if ($switch_error) {
warn " I could not accommodate the changed output extension.\n",
" That is either because the configuration does not allow it\n",
@@ -6114,7 +6119,7 @@ sub rdb_write {
#************************************************************
sub rdb_set_latex_deps {
- # Assume rule context.
+ # Assume primary rule context.
# This is intended to be applied only for a primary (LaTeX-like) rule.
# Set its dependents etc, using information from log, aux, and fls files.
# Use fls file only if $recorder is set, and the fls file was generated
@@ -6127,7 +6132,7 @@ sub rdb_set_latex_deps {
# of the difficulties that do arise, between, on the one hand,
# the filenames specified on latexmk's and the cwd found by
# latexmk from the system, and, on the other hand, the filenames
- # and their components reported by (pdf)latex in the fls and log
+ # and their components reported by *latex in the fls and log
# files:
# 1. Whether the separator of path components is / or \ in
# MSWin.
@@ -6161,7 +6166,7 @@ sub rdb_set_latex_deps {
# command line depends on whether the command line is
# executed by a CLI, and by which CLI. (E.g., cmd.exe,
# v. sh v. tcsh, etc.)
- # 10. Whether such a filename for the filename on (pdf)latex's
+ # 10. Whether such a filename for the filename on *latex's
# file agrees with the one on the command line.
# The above questions have arisen from actual experiences and
# tests.
@@ -6196,7 +6201,7 @@ sub rdb_set_latex_deps {
# current directory, it will be important to preferentially use
# a determination of the current directory from the file being
# processed. In the fls file, there is normally a PWD line. In
- # the log file, if (pdf)latex is started with a filename instead
+ # the log file, if *latex is started with a filename instead
# of a command-executing first line, then this can be determined
# from the first few lines of the log file -- see parse_log.
# This gives a more reliable determination of the relevant path
@@ -6241,12 +6246,12 @@ sub rdb_set_latex_deps {
# after being written (so are not true
# source files.
local $primary_out = $$Pdest; # output file (dvi or pdf)
- local %conversions = (); # (pdf)latex-performed conversions.
- # Maps output file created and read by (pdf)latex
+ local %conversions = (); # *latex-performed conversions.
+ # Maps output file created and read by *latex
# to source file of conversion.
local @missing_subdirs = (); # Missing subdirectories in aux_dir
- local $pwd_latex = undef; # Cwd as reported in fls file by (pdf)latex
+ local $pwd_latex = undef; # Cwd as reported in fls file by *latex
local %created_rules = (); # Maps files to rules existing or created to
# make them. Use to avoid misunderstood
@@ -6265,7 +6270,7 @@ sub rdb_set_latex_deps {
if ( /^eps pdf / ) { $epspdf_cusdep = 1; last; }
}
- # Analyze fls file first. It tells us the working directory as seen by (pdf)latex
+ # Analyze fls file first. It tells us the working directory as seen by *latex
# But we'll use the results later, so that they take priority over the findings
# from the log file.
local $fls_file_analyzed = 0;
@@ -6354,7 +6359,7 @@ sub rdb_set_latex_deps {
# 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
+ # $conv isn't a real source of *latex
rdb_remove_files( $rule, $conv );
delete $dependents{$conv};
if ($epspdf_cusdep) {
@@ -6374,7 +6379,7 @@ sub rdb_set_latex_deps {
# no content, or because of a missing input file. Since a
# missing input file might be correctable by a run of some
# other program whose running is provoked AFTER a run of
- # (pdf)latex, we'll set a diagnostic and leave it to the
+ # *latex, we'll set a diagnostic and leave it to the
# rdb_make to handle after all circular dependencies are
# resolved.
# 2. The output file might be of a different kind than expected
@@ -6398,7 +6403,7 @@ sub rdb_set_latex_deps {
" is not one I know about. I cannot handle this\n";
}
else {
- my $switch_error = switch_output( $actual_ext, $intended_ext );
+ my $switch_error = switch_output( $rule, $actual_ext, $intended_ext );
if ( $switch_error ) {
warn " I could not accommodate the changed output extension\n",
" (either because the configuration does not allow it\n",
@@ -6553,14 +6558,14 @@ NEW_SOURCE:
rdb_ensure_file( $rule, $new_source, undef, 1 );
}
elsif ( $dependents{$new_source} == 7 ) {
- # File was result of conversion by (pdf)latex.
+ # File was result of conversion by *latex.
my $cnv_source = $conversions{$new_source};
rdb_ensure_file( $rule, $new_source );
# if ($cnv_source && ($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.
+ # of the *latex run.
rdb_ensure_file( $rule, $cnv_source );
}
# Flag that changes of the generated file during a run
@@ -6636,20 +6641,23 @@ NEW_SOURCE:
#************************************************************
sub switch_output {
- # Assume rule context for primary rule
+ # Usage: switch_output( primary_rule, actual_ext, intended_ext )
+ # Rearrange rules to deal with changed extension of output file of
+ # the specified primary rule (one of *latex).
# Return 0 on success, non-zero error code on failure
- my ( $actual_ext, $intended_ext ) = @_;
- if ( $actual_ext eq $intended_ext) { return 0; }
+ my ( $rule, $actual_ext, $intended_ext ) = @_;
+ if ( $actual_ext eq $intended_ext ) { return 0; }
if ( ! $can_switch ) { return 1; }
- if ( $intended_ext eq '.dvi' ) {
- rdb_deactivate_derequest( 'dvipdf', 'pspdf' );
- }
- elsif ( $intended_ext eq '.xdv' ) {
- rdb_deactivate_derequest( 'xdvipdfmx' );
+ if (! defined $possible_primaries{$rule} ) {
+ warn "$My_name: BUG: subroutine switch_output called with non-primary rule '$rule'\n";
+ return 1;
}
- else { }
+
+ rdb_deactivate_derequest( 'dvipdf', 'pspdf', 'xdvipdfmx', keys %possible_primaries );
+
+ rdb_activate_request( $rule );
if ( $actual_ext eq '.dvi' ) {
rdb_activate_request( 'dvipdf' );
@@ -6687,7 +6695,7 @@ sub switch_output {
sub test_gen_file {
# Usage: test_gen_file( filename )
- # Tests whether the file was generated during a run of (pdf)latex.
+ # Tests whether the file was generated during a run of *latex.
# Assumes context for primary rule.
# Two kinds of test are used:
# a. From %generated_log, which works after the log file has been parsed,
@@ -6970,11 +6978,11 @@ DEP:
# Put file in rule, without a from_rule, but
# set its state as non-existent, to correspond
# to file's state before the file was made
- # This ensures a rerun of (pdf)latex is provoked.
+ # This ensures a rerun of *latex is provoked.
rdb_ensure_file( $rule, $new_dest, undef, 1 );
push @new_sources, $new_dest;
push @deletions, [$rule, $file];
- # Flag need for a new run of (pdf)latex despite
+ # Flag need for a new run of *latex despite
# the error due to a missing file.
$$Pout_of_date_user = 1;
return;
@@ -7158,12 +7166,12 @@ sub rdb_make {
# situation is an example of a generic situation where certain
# rules must be obeyed in order to obtain proper results:
# 1. A/the latex source file contains specifications for
- # certain postprocessing operations. Standard (pdf)latex
+ # certain postprocessing operations. Standard *latex
# already has this, for indexing and bibliography.
# 2. In the case in point that caused me trouble, the
# specification was for musical tunes that were contained
# in external source files not directly input to
- # (pdf)latex. But in the original version, there was a
+ # *latex. But in the original version, there was a
# style file (abc.sty) that caused latex itself to call
# abcm2ps to make .eps files for each tune that were to be
# read in on the next run of latex.
@@ -7214,7 +7222,7 @@ sub rdb_make {
# 5. (Note that these assumptions could be violated, e.g., if
# $dvips is arranged not only to do the basic dvips
# command, but also to extract information from the ps file
- # and feed it back to an input file for (pdf)latex.)
+ # and feed it back to an input file for *latex.)
# 6. Nevertheless, the overall algorithm should allow
# circularities. Then the general criterion of stability
# of source files covers the general case, and also
@@ -7246,7 +7254,7 @@ sub rdb_make {
# c. Any time that a pre-primary or primary rule is
# applied, loop back to the beginning of step b. This
# ensures that bibtex etc are applied before rerunning
- # (pdf)latex, and also covers changing source files, and
+ # *latex, and also covers changing source files, and
# gives priority to quick pre-primary rules for changing
# source files against slow reruns of latex.
# d. Then apply post-primary rules in order, but not
@@ -7361,7 +7369,7 @@ sub rdb_make {
if ($#primary_warning_summary > -1) {
# N.B. $mult_defined, $bad_reference, $bad_character, $bad_citation also available here.
- show_array( "$My_name: Summary of warnings from last run of (pdf)latex:",
+ show_array( "$My_name: Summary of warnings from last run of *latex:",
@primary_warning_summary );
}
if (! $silent) {
@@ -7481,7 +7489,7 @@ sub rdb_make1 {
# 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
+ # For a primary rule *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),
@@ -7490,14 +7498,14 @@ sub rdb_make1 {
# 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
+ # Any error will arise at the *latex level due to a
# missing source file at that level.
if ( $$Psource && (! -e $$Psource)
&& ( ( $$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:
- # file might be found elsewhere (by kpsearch from (pdf)latex),
+ # file might be found elsewhere (by kpsearch from *latex),
# while non-existence of main source file is a clear error.
}
elsif ( $$Pcmd_type eq 'delegated' ) {
@@ -7590,7 +7598,7 @@ sub rdb_make1 {
$$Pout_of_date = 0;
}
elsif ($$Pcmd_type eq 'primary' ) {
- # For a primary rule, i.e., (pdf)latex, not to produce the
+ # For a primary rule, i.e., *latex, not to produce the
# expected output file may not be an error condition.
# Diagnostics were handled in parsing the log file.
# Special action in main loop in rdb_make
@@ -7791,7 +7799,7 @@ sub rdb_run1 {
else {
warn "$My_name: Either a bug OR a configuration error:\n",
" No command provided for '$rule'\n";
- &traceback();
+ traceback();
$return = -1;
$$Plast_result = 2;
$$Plast_message = "Bug or configuration error; incorrect command type";
@@ -7850,7 +7858,7 @@ sub rdb_run1 {
" I'll ignore error, and delete any bbl file.\n";
}
# Malformed bcf file is a downstream consequence, normally,
- # of an error in (pdf)latex run. So this is not an error
+ # of an error in *latex run. So this is not an error
# condition in biber itself.
# Current version of biber deletes bbl file.
# Older versions (pre-2016) made an incorrect bbl file, which
@@ -7864,7 +7872,7 @@ sub rdb_run1 {
# in malformed bcf file situation under -pvc.
# since on each check for change in ANY file, pvc finds changed file
# Need to restrict pvc reruns to case of changed USER files
-# # To give good properties for (pdf)latex rule, it is best
+# # To give good properties for *latex rule, it is best
# # to have a valid bbl file that exists:
# create_empty_file( $$Pdest );
# $return = 0;
@@ -8074,10 +8082,10 @@ sub rdb_primary_run {
&find_set_log;
if ($recorder) {
- # Handle problem that some version of (pdf)latex give fls files
+ # Handle problem that some version of *latex give fls files
# of name latex.fls or pdflatex.fls instead of $root_filename.fls.
# Also that setting of -output-directory -aux-directory is not
- # respected by (pdf)latex, at least in some versions.
+ # respected by *latex, at least in some versions.
my $std_fls_file = $fls_name;
my @other_fls_names = ( );
if ( $rule =~ /^pdflatex/ ) {
@@ -8140,13 +8148,13 @@ sub rdb_primary_run {
# ???? Is the following needed?
if ($return_latex && $$Pout_of_date_user) {
- print "Error in (pdf)LaTeX, but change of user file(s), ",
+ print "Error in *LaTeX, but change of user file(s), ",
"so ignore error & provoke rerun\n"
if (! $silent);
$return = 0;
}
if ($return_latex && ($missing_dirs ne 'none') ) {
- print "Error in (pdf)LaTeX, but needed subdirectories in output directory\n",
+ print "Error in *LaTeX, but needed subdirectories in output directory\n",
" were missing and successfully created, so try again.\n"
if (! $silent);
$return = 0;
@@ -9282,7 +9290,6 @@ sub get_checksum_md5 {
my $md5 = Digest::MD5->new;
my $ignore_pattern = undef;
-#&traceback;
#warn "======= GETTING MD5: $source\n";
if ( -d $source ) {
# We won't use checksum for directory
@@ -9580,7 +9587,7 @@ sub set_input_ext {
# Set list of extension(s) (specified without a leading period)
# for the given rule ('latex', 'pdflatex', etc).
# These extensions are used when an input
- # file without an extension is found by (pdf)latex, as in
+ # file without an extension is found by *latex, as in
# \input{file} or \includegraphics{figure}. When latexmk searches
# custom dependencies to make the missing file, it will assume that
# the file has one of the specified extensions.