X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=config%2Fcheckspool.pl;fp=config%2Fcheckspool.pl;h=2ee0066f82aeb7734f4f4c43fa1ae1ba01407983;hb=6855525e48fad5de270500a5445c4f4ff85d8bda;hp=0000000000000000000000000000000000000000;hpb=e69709aa8ee6108a1197e46b45367ba8dab55a52;p=diogenes.git diff --git a/config/checkspool.pl b/config/checkspool.pl new file mode 100755 index 0000000..2ee0066 --- /dev/null +++ b/config/checkspool.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl + +use strict; +my $revision = '$Revision: 1.1 $'; + + +# compare two directories recursively +sub scandir { + my ($rRoot,$oRoot,$rPat,$oPat,$curdir) = @_; + + opendir(SPOOL,"$rRoot/$curdir") || die "can't open '$rRoot/$curdir'"; + my @entries = grep { ! /^\.{1,2}$/ } readdir SPOOL; + closedir SPOOL; + + my @children; + + # process entries + foreach my $entry(@entries) { + my $fentry = $curdir ? "$curdir/$entry" : $entry; + if ( -d "$rRoot/$fentry" ) { + if ( -d "$oRoot/$fentry" ) { + push @children,$fentry; + } else { + print "[d] $fentry\n"; + } + } else { + $fentry =~ s/$rPat/$oPat/; + ( -f "$oRoot/$fentry") or + print "[f] $fentry\n"; + } + } + + # recurse + foreach my $child(@children) { + &scandir($rRoot,$oRoot,$rPat,$oPat,$child); + } +} + + +# display usage +sub syntax { + $revision =~ s/(\$)Revision: (.*) \$$/v\2/; + + print "[ This is checkspool.pl ($revision), a checker for Diogenes's spool ]\n\n", + "Syntax:\n", + " checkspool.pl \n\n", + " Arguments:\n", + " rcs - the RCS root\n", + " spool - the spool directory\n", + "\n"; +} + + +# the main routine +sub main { + + if (@ARGV < 2) { + &syntax; + exit(1); + } + + my $rcs = $ARGV[0]; + my $spool = $ARGV[1]; + + # forward scan + print "\nNot in RCS (ignore templates_c) :\n"; + &scandir($spool,$rcs,'$',',v'); + + # reverse scan + print "\nNot in spool :\n"; + &scandir($rcs,$spool,',v$',''); +} + +&main