prtwash.pl: use a hash map to test files against the keeplist
This commit is contained in:
parent
c04e9cf3e8
commit
9ca23cc68d
@ -180,17 +180,16 @@ sub do_wash {
|
|||||||
print "WARN: no Pkgfile found in $port. Skipping.\n";
|
print "WARN: no Pkgfile found in $port. Skipping.\n";
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
my @keepers = keeplist($port); my $iswanted;
|
my @keepers = keeplist($port);
|
||||||
my $allbuilds = pop(@keepers);
|
my $allbuilds = pop(@keepers);
|
||||||
my $currbuild = pop(@keepers);
|
my $currbuild = pop(@keepers);
|
||||||
|
my %iswanted = map { $_ => 1 } @keepers;
|
||||||
|
|
||||||
opendir (DIR,$port) or return;
|
opendir (DIR,$port) or return;
|
||||||
print "=====> washing $port\n" unless $options{quiet} == 1;
|
print "=====> washing $port\n" unless $options{quiet} == 1;
|
||||||
foreach my $f (sort(readdir(DIR))) {
|
foreach my $f (sort(readdir(DIR))) {
|
||||||
next if ($f eq '.' or $f eq '..');
|
next if ($f eq '.' or $f eq '..');
|
||||||
$f =~ s/\+/\\\+/g; # plus sign in filenames interferes with regex search
|
if ($iswanted{$f} or ($options{pkgtoo}==0)*($f =~ /$currbuild/)
|
||||||
$iswanted = ( grep (/$f/, @keepers ) >= 1 );
|
|
||||||
if ($iswanted or ($options{pkgtoo}==0)*($f =~ /$currbuild/)
|
|
||||||
or ($options{oldver}==0)*($f =~ /$allbuilds/)*($f !~ /$currbuild/)) {
|
or ($options{oldver}==0)*($f =~ /$allbuilds/)*($f !~ /$currbuild/)) {
|
||||||
print "... keeping file $port/$f.\n" unless $options{quiet} == 1;
|
print "... keeping file $port/$f.\n" unless $options{quiet} == 1;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user