summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2005-03-26 22:45:09 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-03-27 13:30:18 +0000
commit07774ea50cf81fba91dfac948ad397acfc648735 (patch)
treebd57be9768012788545618e1b942b308ce15aebf
parent455e7c7e393760be85dbcc8b0ed3557dd1388d96 (diff)
downloadperl-07774ea50cf81fba91dfac948ad397acfc648735.tar.gz
Fix -C option of mktables (for VMS)
Subject: Re: [PATCH] Consting five Message-ID: <9b18b311050326124563db5113@mail.gmail.com> p4raw-id: //depot/perl@24085
-rw-r--r--lib/unicore/mktables39
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index 4988e9669f..c3320ed3b4 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -31,6 +31,8 @@ my %BaseNames;
my $Verbose = 0;
my $MakeTestScript = 0;
my $AlwaysWrite = 0;
+my $UseDir = "";
+my $FileList = "$0.lst";
while (@ARGV)
{
@@ -41,21 +43,23 @@ while (@ARGV)
$Verbose = 0;
} elsif ($arg eq '-w') {
$AlwaysWrite = 1; # update the files even if they havent changed
+ $FileList = "";
} elsif ($arg eq '-maketest') {
$MakeTestScript = 1;
- } elsif ($arg eq '-C' && defined (my $dir = shift)) {
- chdir $dir or die "chdir $_: $!";
+ } elsif ($arg eq '-C' && defined ($UseDir = shift)) {
+ -d $UseDir or die "Unknown directory '$UseDir'";
+ } elsif ($arg eq '-L' && defined ($FileList = shift)) {
+ -e $FileList or die "Filelist '$FileList' doesn't appear to exist!";
} else {
- die "usage: $0 [-v|-q|-C dir] [-maketest]";
+ die "usage: $0 [-v|-q|-C dir|-L filelist] [-maketest]\n";
}
}
-if (!$AlwaysWrite) {
- print "Reading file list...\n"
+if ($FileList) {
+ print "Reading file list '$FileList'\n"
if $Verbose;
- open my $fh,"<","mktables.lst"
- or die "Failed to read mktables.lst:$!";
- my @input =( $0 );
+ open my $fh,"<",$FileList or die "Failed to read '$FileList':$!";
+ my @input;
my @output;
for my $list ( \@input, \@output ) {
while (<$fh>) {
@@ -69,19 +73,25 @@ if (!$AlwaysWrite) {
@$list = grep !$dupe{ $_ }++, @$list;
}
close $fh;
- die "No input or output files in mktables.lst!"
+ die "No input or output files in '$FileList'!"
if !@input or !@output;
if ( $Verbose ) {
print "Expecting ".scalar( @input )." input files. ",
"Checking ".scalar( @output )." output files.\n";
}
- my $maxtime = 0;
+ # we set maxtime to be the youngest input file, including $0 itself.
+ my $maxtime = -M $0; # do this before the chdir!
+ if ($UseDir) {
+ chdir $UseDir or die "Failed to chdir to '$UseDir':$!";
+ }
foreach my $in (@input) {
my $time = -M $in;
die "Missing input file '$in'" unless defined $time;
$maxtime = $time if $maxtime < $time;
}
+ # now we check to see if any output files are older than maxtime, if
+ # they are we need to continue on, otherwise we can presumably bail.
my $ok = 1;
foreach my $out (@output) {
if ( ! -e $out ) {
@@ -103,8 +113,13 @@ if (!$AlwaysWrite) {
}
print "Must rebuild tables.\n"
if $Verbose;
-} elsif ($Verbose) {
- print "Not checking file list as -w option set.\n";
+} else {
+ if ($Verbose) {
+ print "Not checking filelist.\n";
+ }
+ if ($UseDir) {
+ chdir $UseDir or die "Failed to chdir to '$UseDir':$!";
+ }
}
foreach my $lib ('To', 'lib',