2004-09-09 10:00:05 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
|
2004-09-09 10:04:11 +00:00
|
|
|
my ($arch, $patfile, $infile, $outfile, $libdir, $thread_arch) = @ARGV;
|
2004-09-09 10:00:05 +00:00
|
|
|
|
2004-09-09 10:04:11 +00:00
|
|
|
if (not $arch or not $patfile or not $infile or not $outfile or not $libdir) {
|
|
|
|
die "Usage: $0 arch thread_arch pattern-file in-file out-file libdir [ threadarch ]";
|
2004-09-09 10:00:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$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) {
|
2004-09-09 10:04:11 +00:00
|
|
|
$p =~ s/%{_libdir}/$libdir/g;
|
2004-09-09 10:00:05 +00:00
|
|
|
$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;
|