Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /Utilities/ReleaseScripts/ignominy/mindeps is written in an unsupported language. File is not indexed.

0001 #!/usr/bin/env perl
0002 
0003 my $file=shift || die "missing file name";
0004 my $pack=shift;
0005 
0006 if(!-f $file){die "$file does not exist.";}
0007 if ($pack!~/^\^/){$pack=".*$pack";}
0008 else{$pack=~s/^\^//;}
0009 if ($pack!~/\$$/){$pack="$pack.*";}
0010 else{$pack=~s/\$$//;}
0011 
0012 my %matched=();
0013 my @lines=();
0014 foreach my $line (`cat $file`){chomp $line;push @lines, $line;}
0015 &check_pack ($pack);
0016 
0017 foreach my $line (sort keys %matched)
0018 {
0019   my $count=$matched{$line};
0020   print "${count}${line}\n";
0021 }
0022 exit 0;
0023 
0024 sub check_pack()
0025 {
0026   my $p=shift;
0027   $p=~s/\+/\\\+/g;
0028   my $regexp=shift || [];
0029   foreach my $exp (@$regexp){if ($p=~/$exp/){return;}}
0030   my $exp=qr/^$p$/;
0031   push @$regexp, $exp;
0032   my @notmatched=();
0033   my @deps=();
0034   foreach my $line (@lines)
0035   {
0036     if($line=~/^(\s*\d+[\s]+)(([^\s]+)\s+([^\s]+)(\s+.+|\s*))$/)
0037     {
0038       my $count=$1;
0039       my $nline=$2;
0040       my $s=$3;
0041       my $d=$4;
0042       if ($s=~/$exp/)
0043       {
0044         $matched{$nline}=$count;
0045         push @deps,($s,$d);
0046       }
0047       else{push @notmatched,$line;}
0048     }
0049     else{print STDERR "WRONG LINE FORMAT:$line\n";}
0050   }
0051   @lines=@notmatched;
0052   foreach my $exp (@deps){&check_pack($exp,$regexp);}
0053 }