| 1 |
#!/usr/bin/perl -w
|
| 2 |
use strict;
|
| 3 |
|
| 4 |
my ($arch, $patfile, $infile, $outfile, $libdir, $thread_arch) = @ARGV;
|
| 5 |
|
| 6 |
if (not $arch or not $patfile or not $infile or not $outfile or not $libdir) {
|
| 7 |
die "Usage: $0 arch thread_arch pattern-file in-file out-file libdir [ threadarch ]";
|
| 8 |
}
|
| 9 |
|
| 10 |
$thread_arch ||= '';
|
| 11 |
|
| 12 |
open IN, "<$infile"
|
| 13 |
or die "Can't open $infile: $!";
|
| 14 |
open OUT, ">$outfile"
|
| 15 |
or die "Can't open $outfile: $!";
|
| 16 |
open PATTERN, "<$patfile"
|
| 17 |
or die "Can't open $patfile: $!";
|
| 18 |
|
| 19 |
my @patterns = <PATTERN>;
|
| 20 |
chomp @patterns;
|
| 21 |
for my $p (@patterns) {
|
| 22 |
$p =~ s/%{_libdir}/$libdir/g;
|
| 23 |
$p =~ s/%{_arch}/$arch/g;
|
| 24 |
$p =~ s/%{thread_arch}/$thread_arch/g;
|
| 25 |
}
|
| 26 |
|
| 27 |
my %exclude = map { $_ => 1 } @patterns;
|
| 28 |
|
| 29 |
close PATTERN;
|
| 30 |
|
| 31 |
while(<IN>) {
|
| 32 |
chomp;
|
| 33 |
|
| 34 |
print OUT "$_\n"
|
| 35 |
unless exists $exclude{$_}
|
| 36 |
}
|
| 37 |
|
| 38 |
close IN;
|
| 39 |
close OUT;
|