+ my $local_date = gmtime($mtime);
+ if ($local_date ne $date &&
+ $file ne "lustre.spec.in") {
+ #print "$file : " . localtime($mtime) . "\n";
+ $pristine = 0;
+ }
+
+ if ($mtime > $last_mtime) {
+ $last_mtime = $mtime;
+ }
+
+ if ($date) {
+ my @t = split(/ +/, $date);
+ if (int(@t) != 5) {
+ #print "skipping: $date\n";
+ next;
+ }
+ my ($hours, $min, $sec) = split(/:/, $t[3]);
+ my ($mon, $mday, $year) = ($t[1], $t[2], $t[4]);
+ my $secs = 0;
+ $mon = $months{$mon};
+ $secs = timelocal($sec, $min, $hours, $mday, $mon, $year);
+ if ($secs > $last_mtime) {
+ $last_mtime = $secs;
+ }
+ }
+ }
+ $entry->close();
+ }
+ } elsif (-d ".git") {
+ # a git checkout
+ # TODO: figure out how to determine the most recently modified file
+ # in a git working copy.
+ # NOTE: this is not simply the newest file in the whole tree,
+ # but the newest file in the tree that is from the
+ # repository.
+ $last_mtime = time();
+ } else {
+ my $tree_status = new IO::File;
+ if (!$tree_status->open("tree_status")) {
+ die "unable to open the tree_status file: $!\n";
+ }
+ my $line;
+ while (defined($line = <$tree_status>)) {
+ if ($line =~ /^PRISTINE\s*=\s*(\d)/) {
+ $pristine = $1;
+ } elsif ($line =~ /^MTIME\s*=\s*(\d+)/) {
+ $last_mtime = $1;