summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexmk
diff options
context:
space:
mode:
authorDr. Clea F. Rees <cfrees@imapmail.org>2008-12-28 23:57:38 +0000
committerDr. Clea F. Rees <cfrees@imapmail.org>2008-12-28 23:57:38 +0000
commit6f46e3a44540030556c507573b834aec4046e113 (patch)
treeafcecfaabda8a768c39740161989783e6d209644 /Master/texmf-dist/scripts/latexmk
parent0ea692dfc516c549c696115ab6e0672659fde2dd (diff)
latexmk update 2008/12/28
git-svn-id: svn://tug.org/texlive/trunk@11743 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexmk')
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl79
1 files changed, 48 insertions, 31 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 45fbddd4208..73dfcb48d49 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -148,8 +148,8 @@ if 0;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.02b';
-$version_details = "$My_name, John Collins, 1 December 2008";
+$version_num = '4.03';
+$version_details = "$My_name, John Collins, 22 December 2008";
use Config;
@@ -218,7 +218,16 @@ else {
##
## Modification log for 24 Sep 2008 onwards in detail
##
-## 1 Dec 2008, John Collins -c and -C should also delete fdb_latex file
+## 22 Dec 2008, John Collins V. 4.03
+## 22 Dec 2008, John Collins Fix possibility that unwrapping of lines
+## in log_file is done incorrectly
+## 5 Dec 2008, John Collins Correct treatment of -e option
+## 2 Dec 2008, John Collins For home directory (where user's .latexmkrc
+## is located, when $ENV{'HOME'} does
+## not exist, use $ENV{USERPROFILE}
+## (suitable for MS-Win).
+## Clean up code in rdb_set_rules
+## 1 Dec 2008, John Collins -c and -C now also delete fdb_latex file
## 26 Nov 2008, John Collins Correct problem with invocation of MSWin
## with cygwin
## 25 Nov 2008, John Collins Correct problem with invocation of MSWin
@@ -1140,6 +1149,17 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
#==================================================
## Read rc files:
+# User's home directory
+$HOME = '';
+if (exists $ENV{'HOME'} ) {
+ $HOME = $ENV{'HOME'};
+}
+elsif (exists $ENV{'USERPROFILE'} ) {
+ $HOME = $ENV{'USERPROFILE'};
+}
+
+
+
sub read_first_rc_file_in_list {
foreach my $rc_file ( @_ ) {
#print "===Testing for rc file \"$rc_file\" ...\n";
@@ -1154,7 +1174,7 @@ sub read_first_rc_file_in_list {
# Read system rc file:
read_first_rc_file_in_list( @rc_system_files );
# Read user rc file.
-read_first_rc_file_in_list( "$ENV{'HOME'}/.latexmkrc" );
+read_first_rc_file_in_list( "$HOME/.latexmkrc" );
# Read rc file in current directory.
read_first_rc_file_in_list( "latexmkrc", ".latexmkrc" );
@@ -1250,12 +1270,10 @@ while ($_ = $ARGV[0])
elsif (/^-view=ps$/) { $view = "ps";}
elsif (/^-view=pdf$/) { $view = "pdf"; }
elsif (/^-e$/) {
- if ( $ARGV[0] eq '' ) {
+ if ( $#ARGV < 0 ) {
&exit_help( "No code to execute specified after -e switch");
}
- else {
- execute_code_string( $ARGV[0] );
- }
+ execute_code_string( $ARGV[0] );
shift;
}
elsif (/^-r$/) {
@@ -1904,11 +1922,10 @@ sub rdb_set_rules {
# Set up rule database from definitions
# Map of files to rules that MAKE them:
- local %from_rules = ();
%rule_db = ();
foreach my $Prule_list (@_) {
- foreach my $rule ( sort keys %$Prule_list) {
+ foreach my $rule ( keys %$Prule_list) {
my ( $cmd_type, $ext_cmd, $int_cmd, $source, $dest, $base, $test_kind ) = @{$$Prule_list{$rule}};
my $needs_making = 0;
# Substitute in the filename variables, since we will use
@@ -1926,21 +1943,7 @@ sub rdb_set_rules {
rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind,
$source, $dest, $base,
$needs_making );
- if ($dest) { $from_rules{$dest} = $rule ; }
}
- rdb_for_all(
- 0,
- sub{
- # my ($base, $path, $ext) = fileparse( $file, '\.[^\.]*' );
- # if ( exists $from_rules{$file} && ! exists $generated_exts_all{$ext} ) {
- # # Show how to make this file. But don't worry about generated
- # # files.
- if ( exists $from_rules{$file} ) {
- $$Pfrom_rule = $from_rules{$file};
- }
- #?? print "$rule: $file, $$Pfrom_rule\n";
- }
- );
} # End arguments of subroutine
&rdb_make_links;
} # END rdb_set_rules
@@ -2771,21 +2774,30 @@ sub parse_logB {
return 0;
}
-LINE:
+# Collect lines of log file
+ my @lines = ();
while(<$log_file>) {
# Could use chomp here, but that fails if there is a mismatch
# between the end-of-line sequence used by latex and that
# used by perl. (Notably a problem with MSWin latex and
# cygwin perl!)
s/[\n\r]*$//;
- if ( $. == 1 ){
+ push @lines, $_;
+ }
+ close $log_file;
+
+ my $line = 0;
+LINE:
+ while( $line <= $#lines ) {
+ $_ = $lines[$line];
+ $line ++;
+ if ( $line == 1 ){
if ( /^This is / ) {
# First line OK
next LINE;
} else {
warn "$My_name: Error on first line of '$log_name'. ".
"This is apparently not a TeX log file.\n";
- close $log_file;
$failure = 1;
$failure_msg = "Log file '$log_name' appears to have wrong format.";
return 0;
@@ -2794,10 +2806,16 @@ LINE:
# Handle wrapped lines:
# They are lines brutally broken at exactly $log_wrap chars
# excluding line-end.
+ # But a line can be of the length where the wrapping occurs, but
+ # there can be no wrapping. So for a long line, try parsing it
+ # as if it is wrapped, but leave the index variable $line as is,
+ # so that on the next loop over LINE, we also try parsing the
+ # succeeding line as if there was no wrapping:
my $len = length($_);
- while ($len == $log_wrap) {
- my $extra = <$log_file>;
- $extra =~ s/[\n\r]*$//;
+ my $next = $line;
+ while ( ($len == $log_wrap) && ($next <= $#lines) ) {
+ my $extra = $lines[$next];
+ $next++;
$len = length($extra);
$_ .= $extra;
}
@@ -3046,7 +3064,6 @@ LINE:
} # INCLUDE_NAME
} # INCLUDE_CANDIDATE
} # LINE
- close($log_file);
# Default includes are always definitive:
foreach (@default_includes) { $dependents{$_} = 4; }