ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/scramds
Revision: 1.1.2.3
Committed: Tue Mar 28 11:09:53 2000 UTC (25 years, 1 month ago) by williamc
Branch: V0_9branch
CVS Tags: V0_10_19, V0_10_18
Changes since 1.1.2.2: +8 -2 lines
Log Message:
Have to bring local source forward in time - when there is no buildproduct availaible locally to change the times

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 williamc 1.1.2.3 # we have to bring the src time forward to fool make
40     my $now=time();
41     utime($now,$now,$file);
42 williamc 1.1.2.2 }
43     }
44 williamc 1.1.2.1 $self->{moddate}{$file}=(stat($file))[9];
45     if ( $self->{moddate}{$file} != $self->{file}{$file} ) {
46     $date=$self->{moddate}{$file}-1;
47     $needsupdate=1;
48     }
49     }
50     }
51    
52 williamc 1.1.2.3 # time stamp the product file to be older than the dependencies
53 williamc 1.1.2.1 if ( $needsupdate==1 ) { # touch file into the past
54     if ( $ENV{DEBUG} ) {
55     print "Blasting $productfile to the past\n";
56     }
57 williamc 1.1.2.3 if ( -f $productfile ) {
58     # If the productfile exists - make it older
59     utime($date,$date,$productfile);
60     }
61 williamc 1.1.2.1 }
62     else {
63     if ( $ENV{DEBUG} ) {
64     print "No need to touch $productfile\n";
65     }
66     }