--- loncom/build/filecompare.pl 2001/12/06 23:14:33 1.10 +++ loncom/build/filecompare.pl 2002/05/16 00:23:04 1.13 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # filecompare.pl - script used to help probe and compare file statistics # -# $Id: filecompare.pl,v 1.10 2001/12/06 23:14:33 harris41 Exp $ +# $Id: filecompare.pl,v 1.13 2002/05/16 00:23:04 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -72,7 +72,7 @@ Options (before file/dir names): -a show all files (with comparisons) -q only show file names (based on first file/dir) -v verbose mode (default) --bN buildmode (controls exit code of this script; 0 unless...) +-bN buildmode (controls EXIT code of this script; 0 unless...) N=1: md5sum=same --> 1; cvstime<0 --> 2 N=2: same as N=1 except without md5sum N=3: md5sum=same --> 1; age<0 --> 2 @@ -423,7 +423,7 @@ FLOOP: foreach my $file (@files) { $showflag=1; } } - if ($buildmode==1) { + if ($buildmode==1) { # -b1 if ($md5sum eq 'same') { exit(1); } @@ -434,7 +434,7 @@ FLOOP: foreach my $file (@files) { exit(0); } } - elsif ($buildmode==2) { + elsif ($buildmode==2) { # -b2 if ($cvstime<0) { exit(2); } @@ -442,7 +442,7 @@ FLOOP: foreach my $file (@files) { exit(0); } } - elsif ($buildmode==3) { + elsif ($buildmode==3) { # -b3 if ($md5sum eq 'same') { exit(1); } @@ -453,7 +453,7 @@ FLOOP: foreach my $file (@files) { exit(0); } } - elsif ($buildmode==4) { + elsif ($buildmode==4) { # -b4 if ($existence=~/no$/) { exit(3); } @@ -503,12 +503,18 @@ sub cvstime { } my $cvstime; if ($buildmode!=3) { - my $entry=`grep '^/$file/' ${path}CVS/Entries` or - die('*** ERROR *** cannot grep against '.${path}. - 'CVS/Entries for ' .$file . "\n"); - my @fields=split(/\//,$entry); - $cvstime=`date -d '$fields[3] UTC' --utc +"%s"`; - chomp $cvstime; + my $entry=`grep '^/$file/' ${path}CVS/Entries 2>/dev/null`; +# or +# die('*** WARNING *** cannot grep against '.${path}. +# 'CVS/Entries for ' .$file . "\n"); + if ($entry) { + my @fields=split(/\//,$entry); + $cvstime=`date -d '$fields[3] UTC' --utc +"%s"`; + chomp $cvstime; + } + else { + $cvstime='n/a'; + } } else { $cvstime='n/a';