/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Utilities/ReleaseScripts/ignominy/mindeps
53 строки
1 KB
Giulio Eulisse
Snapshot of CMSSW_6_2_0_pre8.
26 июн 2013, 18:12
26 июн 2013, 18:12
214ab73
Код
Авторство
О чём код?
#!/usr/bin/env perl my $file=shift || die "missing file name"; my $pack=shift; if(!-f $file){die "$file does not exist.";} if ($pack!~/^\^/){$pack=".*$pack";} else{$pack=~s/^\^//;} if ($pack!~/\$$/){$pack="$pack.*";} else{$pack=~s/\$$//;} my %matched=(); my @lines=(); foreach my $line (`cat $file`){chomp $line;push @lines, $line;} &check_pack ($pack); foreach my $line (sort keys %matched) { my $count=$matched{$line}; print "${count}${line}\n"; } exit 0; sub check_pack() { my $p=shift; $p=~s/\+/\\\+/g; my $regexp=shift || []; foreach my $exp (@$regexp){if ($p=~/$exp/){return;}} my $exp=qr/^$p$/; push @$regexp, $exp; my @notmatched=(); my @deps=(); foreach my $line (@lines) { if($line=~/^(\s*\d+[\s]+)(([^\s]+)\s+([^\s]+)(\s+.+|\s*))$/) { my $count=$1; my $nline=$2; my $s=$3; my $d=$4; if ($s=~/$exp/) { $matched{$nline}=$count; push @deps,($s,$d); } else{push @notmatched,$line;} } else{print STDERR "WRONG LINE FORMAT:$line\n";} } @lines=@notmatched; foreach my $exp (@deps){&check_pack($exp,$regexp);} }