ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/scramds
Revision: 1.1.2.2
Committed: Mon Mar 27 17:51:33 2000 UTC (25 years, 1 month ago) by williamc
Branch: V0_9branch
Changes since 1.1.2.1: +10 -0 lines
Log Message:
Add mechanism to check whetehr a local file should override a local release file

File Contents

# User Rev Content
1 williamc 1.1.2.1 #!/usr/local/bin/perl5 -w
2    
3     #
4     # Check a product composition file to see if any of its components have
5     # changed
6     #
7    
8     use FileHandle;
9    
10     my $datefile=shift @ARGV;
11     my $productfile=shift @ARGV;
12     my $needsupdate=0;
13 williamc 1.1.2.2 my $tempfile;
14    
15 williamc 1.1.2.1 $self={};
16     # read in dependencies and dates
17     my $file;
18     if ( -f $datefile ) {
19     $fh=FileHandle->new();
20     open ($fh, "<".$datefile );
21     while ( <$fh> ) {
22     $file=$_;
23     chomp $file;
24     $self->{file}{$file}=<$fh>;
25     chomp $self->{file}{$file};
26     }
27     close $fh;
28     }
29    
30     # now get dates in our dependency list
31     foreach $file ( keys %{$self->{file}} ) {
32     if ( -f $file ) {
33 williamc 1.1.2.2 # -- check to see if we have a new local copy
34     if ( $file=~/$ENV{RELEASETOP}/ ) {
35     ($tempfile=$file)=~s/$ENV{RELEASETOP}/$ENV{LOCALTOP}/;
36     if ( -f $tempfile ) {
37     $self->{file}{$tempfile}=$self->{file}{$file};
38     $file=$tempfile;
39     }
40     }
41 williamc 1.1.2.1 $self->{moddate}{$file}=(stat($file))[9];
42     if ( $self->{moddate}{$file} != $self->{file}{$file} ) {
43     $date=$self->{moddate}{$file}-1;
44     $needsupdate=1;
45     }
46     }
47     }
48    
49     # time stamp the product file to be older than th e dependencies
50     if ( $needsupdate==1 ) { # touch file into the past
51     if ( $ENV{DEBUG} ) {
52     print "Blasting $productfile to the past\n";
53     }
54     utime($date,$date,$productfile);
55     }
56     else {
57     if ( $ENV{DEBUG} ) {
58     print "No need to touch $productfile\n";
59     }
60     }