perl/clean-manifest.pl

39 lines
722 B
Perl
Raw Normal View History

#!/usr/bin/perl -w
use strict;
my ($arch, $patfile, $infile, $outfile, $thread_arch) = @ARGV;
if (not $arch or not $patfile or not $infile or not $outfile) {
die "Usage: $0 arch thread_arch pattern-file in-file out-file";
}
$thread_arch ||= '';
open IN, "<$infile"
or die "Can't open $infile: $!";
open OUT, ">$outfile"
or die "Can't open $outfile: $!";
open PATTERN, "<$patfile"
or die "Can't open $patfile: $!";
my @patterns = <PATTERN>;
chomp @patterns;
for my $p (@patterns) {
$p =~ s/%{_arch}/$arch/g;
$p =~ s/%{thread_arch}/$thread_arch/g;
}
my %exclude = map { $_ => 1 } @patterns;
close PATTERN;
while(<IN>) {
chomp;
print OUT "$_\n"
unless exists $exclude{$_}
}
close IN;
close OUT;