summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-11 22:30:30 +0000
committerKarl Berry <karl@freefriends.org>2011-12-11 22:30:30 +0000
commitbca3b6017c5eda5d6c5d67bb266062fb7f363b5b (patch)
tree4982edcfc2080e1c96ac6d3d3a7b83655c273393 /Master/texmf-dist/scripts
parent66913a012bff67aeac726ca83cbaffcafbae1118 (diff)
latexmk 4.30a (10dec11)
git-svn-id: svn://tug.org/texlive/trunk@24819 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl144
1 files changed, 125 insertions, 19 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 2d9bbcf9cab..ad28098a24a 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -109,9 +109,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.28c';
-$version_details = "$My_name, John Collins, 1 December 2011";
-
+$version_num = '4.30a';
+$version_details = "$My_name, John Collins, 9 December 2011";
use Config;
use File::Copy;
@@ -179,6 +178,28 @@ else {
##
## Modification log from 1 Jan 2011 onwards in detail
##
+## 9 Dec 2011, John Collins Use OS-dependent search path separator when
+## when manipulating TEXINPUTS, etc.
+## Correct treatment of current directory
+## when modifying TEXINPUTS, etc
+## 8 Dec 2011, John Collins V. 4.30
+## Fix use of bibtex so that it works correctly
+## when $aux_dir and/or $out_dir is set.
+## Correct dependencies of aux files when
+## $aux_dir and/or $out_dir is set.
+## 7 Dec 2011, John Collins Ensure preservation of test_kind for dvips, etc
+## It was getting clobbered by rdb_read.
+## 6 Dec 2011, John Collins Results of issues in using feynmp packages:
+## 1. Set $ENV{TEXINPUTS} if $out_dir is set
+## Hence dvips can find files that would
+## normally be generated in the current
+## directory, but that are actually
+## generated in $out_dir.
+## 2. Deal with missing file message from feynmp
+## 3. In searching for cus-deps that can make a
+## missing file, look in $out_dir
+## 4. Now v. 4.29
+## 5 Dec 2011, John Collins Delete spurious print in force_directory
## 1 Dec 2011, John Collins Correct biber-no-bib problem
## (biber gives an error message, but latexmk
## should treat that only as a warning).
@@ -383,6 +404,7 @@ $log_wrap = 79;
'^LaTeX Warning: File `([^\\\']*)\\\' not found',
'^Package .* [fF]ile `([^\\\']*)\\\' not found',
'Error: pdflatex \(file ([^\)]*)\): cannot find image file',
+ ': File (.*) not found:\s*$',
);
## Hash mapping file extension (w/o period, e.g., 'eps') to a single regexp,
@@ -629,7 +651,7 @@ elsif ( $^O eq "cygwin" ) {
# example).
# Cygwin executables for tex and latex may only know cygwin
# filenames.
- # 4. The BIBINPUTS and TEXINPUTS environment variables may be
+ # 4. The BIBINPUTS environment variables may be
# UNIX-style or MSWin-style depending on whether native NT or
# cygwin executables are used. They are therefore parsed
# differently. Here is the clash:
@@ -994,16 +1016,13 @@ $bad_citation = 0;
# Set them early so that they can be overridden
$BIBINPUTS = $ENV{'BIBINPUTS'};
if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
-#?? OBSOLETE
-$TEXINPUTS = $ENV{'TEXINPUTS'};
-if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
# Convert search paths to arrays:
# If any of the paths end in '//' then recursively search the
# directory. After these operations, @BIBINPUTS should
# have all the directories that need to be searched
-@BIBINPUTS = find_dirs1 ($BIBINPUTS);
+@BIBINPUTS = find_dirs1( $BIBINPUTS );
######################################################################
@@ -1752,6 +1771,22 @@ foreach (@generated_exts ) {
$generated_exts_all{$_} = 1;
}
+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;
+ }
+ elsif ( $ENV{TEXINPUTS} !~ /$aux_dir$search_path_separator/ ) {
+ $ENV{TEXINPUTS} = $aux_dir.$search_path_separator.$ENV{TEXINPUTS};
+ }
+}
+
$quell_uptodate_msgs = $silent;
# Whether to quell informational messages when files are uptodate
# Will turn off in -pvc mode
@@ -3177,6 +3212,41 @@ sub check_biber_log {
#**************************************************
+sub run_bibtex {
+ my $return = 999;
+ if ( $aux_dir ) {
+ if ( $$Psource =~ /^$aux_dir1/ ) {
+ # Run bibtex in $aux_dir, fixing input search path
+ # to allow for finding files in original directory
+ 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;
+ }
+ }
+ pushd( $path );
+ $return = &rdb_ext_cmd1( '', $base.$ext, '', $base );
+ popd();
+ }
+ else {
+ warn "$My_name: Directory in file name '$$Psource' for bibtex\n",
+ " but it is not the output directory '$aux_dir'\n";
+ $return = rdb_ext_cmd();
+ }
+ }
+ else {
+ $return = rdb_ext_cmd();
+ }
+ return $return;
+}
+
+
+#**************************************************
+
sub check_bibtex_log {
# Check for bibtex warnings:
# Usage: check_bibtex_log( base_of_bibtex_run )
@@ -3252,7 +3322,6 @@ sub force_directory {
my $filename = $_[1];
my ($base_name, $path ) = fileparse( $filename );
if ( $path ne '' ) { $filename = "$default_dir$filename"; }
- print "$filename\n";
return $filename;
}
@@ -3566,9 +3635,20 @@ LINE:
foreach my $pattern (@file_not_found) {
if ( /$pattern/ ) {
my $file = clean_file_name($1);
+ my ($base, $path) = fileparse( $file );
warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
unless $silent;
$dependents{$file} = 0;
+ if ( $aux_dir && ( ($path eq './') || ($path eq '') ) ) {
+ # This allows for the possibility that latex generated
+ # a file in $aux_dir, from which the missing file can
+ # be created by a cusdep (or other) rule that puts
+ # the result in $out_dir. If the announced missing file
+ # has no path, then it would be effectively a missing
+ # file in $aux_dir, with a path. So give this alternate
+ # location.
+ $dependents{$aux_dir1.$file} = 0;
+ }
next LINE;
}
}
@@ -4007,7 +4087,7 @@ AUX_LINE:
}
elsif ( /^\\\@input\{(.*)\}/ ) {
# \\@input{next_aux_file_name}
- &parse_aux1( $1 );
+ &parse_aux1( $aux_dir1.$1 );
}
}
close($aux_fh);
@@ -4175,11 +4255,9 @@ LINE:
}
if ( rdb_rule_exists( $rule ) ) {
rdb_one_rule( $rule,
- sub{ $$Ptest_kind = 1;
+ sub{
+ if ($$Ptest_kind == 3) { $$Ptest_kind = 1; }
$$Prun_time = $run_time;
- #??if ($source) { $$Psource = $source; }
- #??if ($dest) { $$Pdest = $dest; }
- #??if ($base) { $$Pbase = $base; }
}
);
}
@@ -4206,6 +4284,7 @@ LINE:
elsif ( $rule =~ /^(makeindex|bibtex|biber)\s*(.*)$/ ) {
my $PA_extra_gen = [];
my $rule_generic = $1;
+ my $int_cmd = '';
if ( ! $source ) {
# If fdb_file was old-style (v. 1)
$source = $2;
@@ -4213,7 +4292,6 @@ LINE:
my $ext = '';
($base, $path, $ext) = fileparseA( $source );
$base = $path.$base;
-# ?? MAY NEED TO FIX THE FOLLOWING IF $aux_dir IS SET.
if ($rule_generic eq 'makeindex') {
$dest = "$base.ind";
}
@@ -4228,17 +4306,19 @@ LINE:
}
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"
if $diagnostics;
my $cmd_type = 'external';
my $ext_cmd = ${$rule_generic};
warn " Rule kind = '$rule_generic'; ext_cmd = '$ext_cmd';\n",
+ " int_cmd = '$int_cmd';\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, '', 1,
+ rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, 1,
$source, $dest, $base, 0, $run_time, 1, $PA_extra_gen );
}
else {
@@ -4484,7 +4564,6 @@ sub rdb_set_latex_deps {
rdb_remove_rule( "bibtex $bbl_base" );
}
else {
-# ?? MAY NEED TO FIX IF $aux_dir IS SET:
parse_aux( "$bbl_base.aux", \@new_bib_files, \@new_aux_files, \@new_bst_files );
# Remove OPPOSITE kind of bbl generation:
rdb_remove_rule( "biber $bbl_base" );
@@ -4496,7 +4575,7 @@ sub rdb_set_latex_deps {
"$bbl_base.bcf", $bbl_file, $bbl_base, 1, 0);
}
else {
- rdb_create_rule( $from_rule, 'external', $bibtex, '', 1,
+ rdb_create_rule( $from_rule, 'external', $bibtex, 'run_bibtex', 1,
"$bbl_base.aux", $bbl_file, $bbl_base, 1, 0);
}
}
@@ -4919,7 +4998,6 @@ sub deps_list {
sub{ $source{$file} = 1; }
);
foreach (keys %generated_exts_all) {
-# ?? MAY NEED TO FIX THE FOLLOWING IF $aux_dir or $out_dir IS SET.
(my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$root_filename/;
push @generated, $name;
}
@@ -7434,6 +7512,34 @@ sub find_process_id {
#************************************************************
#************************************************************
+#============================================
+
+sub good_cwd {
+ # Return cwd, but under cygwin, convert to MSWin path
+ # so that result can be used for input to MSWin programs
+ # as well as cygwin programs
+ my $cwd = cwd();
+ if ( $^O eq "cygwin" ) {
+ my $cmd = "cygpath -w \"$cwd\"";
+ my $Win_cwd = `$cmd`;
+ chomp $Win_cwd;
+ if ( $Win_cwd ) {
+ $cwd = $Win_cwd;
+ }
+ else {
+ warn "$My_name: Could not correctly run command\n",
+ " '$cmd'\n",
+ " to get MSWin version of cygwin path\n",
+ " '$cwd'\n",
+ " The result was\n",
+ " 'Win_cwd'\n";
+ }
+ }
+ return $cwd;
+}
+
+#============================================
+
# Directory stack routines
sub pushd {