summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-02-07 01:42:27 +0000
committerKarl Berry <karl@freefriends.org>2006-02-07 01:42:27 +0000
commit40670b7d02158d6200fc1e8e7cd355e3f02781f6 (patch)
treecaed9b1e270f09ea1a8fb3e7cdf5a59557a5dd77
parent2b652798b3d6b353a048551f8647ca52945b86d6 (diff)
(formatdate): need $MasterDir when looking for the .tpm.
git-svn-id: svn://tug.org/texlive/trunk@1505 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/Tools/Tpm.pm47
1 files changed, 38 insertions, 9 deletions
diff --git a/Master/Tools/Tpm.pm b/Master/Tools/Tpm.pm
index 9720770a47c..e810d5bfc4f 100644
--- a/Master/Tools/Tpm.pm
+++ b/Master/Tools/Tpm.pm
@@ -601,9 +601,12 @@ sub getFileList {
}
if (wantarray) {
+ #print "getfilelist($n) returning list: @l\n";
+ #&debug_hash ("$n", $self->{$n});
return @l;
}
else {
+ #print "getfilelist($n) returning scalar: @l\n";
if (@l) {
return (join "\n", @l);
}
@@ -979,7 +982,7 @@ sub testSync {
}
}
-
+
sub formatdate {
return sprintf("%4d/%02d/%02d %02d:%02d:%02d",
$_[5]+1900, $_[4]+1, $_[3], $_[2], $_[1], $_[0]);
@@ -1015,16 +1018,17 @@ sub max_date
{
my ($olddate, @files) = @_;
my ($f, $tpmdate);
-# print "olddate was " . &formatdate(gmtime($oldate)) . "\n";
+ #print " olddate was " . &formatdate(gmtime($oldate)) . ", files=@files\n";
foreach $f (@files) {
if ($f =~ m@^texmf-dist/tpm/.*\.tpm@) {
- $tpmdate = ${stat($f)}[9];
+ $tpmdate = (stat("$MasterDir/$f"))[9];
+ #print " tpm itself, found $tpmdate\n";
}
else {
my @st = stat("$MasterDir/$f");
-# print "file $f is " . &formatdate(gmtime($st[9])) . "\n";
+ #print " file $f is " . &formatdate(gmtime($st[9])) . "\n";
if ($st[9] > $olddate) {
-# print "replacing\n";
+ #print " replacing\n";
$olddate = $st[9];
}
}
@@ -1032,7 +1036,7 @@ sub max_date
if ($olddate == 0) {
$olddate = $tpmdate;
}
-# print "newdate is " . &formatdate(gmtime($oldate)) . "\n";
+# print " newdate is " . &formatdate(gmtime($oldate)) . "\n";
return $olddate;
}
@@ -1044,16 +1048,19 @@ sub fixDate {
$newdate = &max_date($newdate, ${$s}{"text"});
}
}
-# print "#### newdate is " . &formatdate(gmtime($newdate)) . "\n";
+ #print " newdate after bin: " . &formatdate(gmtime($newdate)) . "\n";
$newdate = &max_date($newdate, $self->getFileList("RunFiles"));
-# print "#### newdate is " . &formatdate(gmtime($newdate)) . "\n";
+ #print " newdate after run: " . &formatdate(gmtime($newdate)) . "\n";
$newdate = &max_date($newdate, $self->getFileList("DocFiles"));
-# print "#### newdate is " . &formatdate(gmtime($newdate)) . "\n";
+ #print " newdate after doc: " . &formatdate(gmtime($newdate)) . "\n";
$newdate = &max_date($newdate, $self->getFileList("SourceFiles"));
+ #print " newdate after source: " . &formatdate(gmtime($newdate)) . "\n";
$newdate = &max_date($newdate, $self->getFileList("RemoteFiles"));
+ #print " newdate after remote: " . &formatdate(gmtime($newdate)) . "\n";
$self->setAttribute("Date", &formatdate(gmtime($newdate)));
}
+
sub fixRequires {
my ($self, $test) = @_;
@@ -1722,4 +1729,26 @@ sub Remove {
} $self->getAllFileList();
}
+
+# Log LABEL followed by hash elements, all on one line.
+#
+sub debug_hash
+{
+ my ($label) = shift;
+ my (%hash) = (ref $_[0] && $_[0] =~ /.*HASH.*/) ? %{$_[0]} : @_;
+
+ my $str = "$label: {";
+ my @items = ();
+ for my $key (sort keys %hash) {
+ my $val = $hash{$key};
+ $key =~ s/\n/\\n/g;
+ $val =~ s/\n/\\n/g;
+ push (@items, "$key:$val");
+ }
+ $str .= join (",", @items);
+ $str .= "}";
+
+ print "$str\n";
+}
+
1;