From 9ca23cc68dd88e2d0cefa1785f6fcbcc301cd08f Mon Sep 17 00:00:00 2001 From: John McQuah Date: Mon, 7 Aug 2023 08:46:44 -0400 Subject: [PATCH] prtwash.pl: use a hash map to test files against the keeplist --- scripts/prtwash.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/prtwash.pl b/scripts/prtwash.pl index 95077bc..dc4cd64 100755 --- a/scripts/prtwash.pl +++ b/scripts/prtwash.pl @@ -180,17 +180,16 @@ sub do_wash { print "WARN: no Pkgfile found in $port. Skipping.\n"; return; } else { - my @keepers = keeplist($port); my $iswanted; + my @keepers = keeplist($port); my $allbuilds = pop(@keepers); my $currbuild = pop(@keepers); + my %iswanted = map { $_ => 1 } @keepers; opendir (DIR,$port) or return; print "=====> washing $port\n" unless $options{quiet} == 1; foreach my $f (sort(readdir(DIR))) { next if ($f eq '.' or $f eq '..'); - $f =~ s/\+/\\\+/g; # plus sign in filenames interferes with regex search - $iswanted = ( grep (/$f/, @keepers ) >= 1 ); - if ($iswanted or ($options{pkgtoo}==0)*($f =~ /$currbuild/) + if ($iswanted{$f} or ($options{pkgtoo}==0)*($f =~ /$currbuild/) or ($options{oldver}==0)*($f =~ /$allbuilds/)*($f !~ /$currbuild/)) { print "... keeping file $port/$f.\n" unless $options{quiet} == 1; } else {