4 |
use warnings; |
use warnings; |
5 |
use RPM2; |
use RPM2; |
6 |
use Data::Dumper; |
use Data::Dumper; |
7 |
|
use Getopt::Std; |
8 |
|
|
9 |
|
my %opts; |
10 |
|
getopts( "s:", \%opts ); |
11 |
|
my $src = $opts{s} || '/builds/RPMS'; |
12 |
|
|
13 |
my $rpm_flags = RPM2->vsf_nodsa; |
my $rpm_flags = RPM2->vsf_nodsa; |
|
my $build_dir = "/builds/RPMS"; |
|
14 |
my @repositories = qw( |
my @repositories = qw( |
15 |
/mirrors/centos/4/fasttrack/i386/RPMS/ |
/mirrors/centos/4/fasttrack/i386/RPMS/ |
16 |
/mirrors/centos/4/updates/i386/RPMS/ |
/mirrors/centos/4/updates/i386/RPMS/ |
27 |
/builds/rpms/RPMS/noarch/ |
/builds/rpms/RPMS/noarch/ |
28 |
); |
); |
29 |
|
|
30 |
opendir RPMS, $build_dir or die "Couldn't opendir $build_dir"; |
opendir RPMS, $src or die "Couldn't opendir $src"; |
31 |
my %rpms = map { my $x = RPM2->open_package("$build_dir/$_", $rpm_flags); $x->tag('NAME') => $x; } grep { /\.rpm$/ } readdir RPMS; |
my %rpms = map { my $x = RPM2->open_package("$src/$_", $rpm_flags); $x->tag('NAME') => $x; } grep { /\.rpm$/ } readdir RPMS; |
32 |
closedir RPMS; |
closedir RPMS; |
33 |
|
|
34 |
my %repos; |
my %repos; |
57 |
@headers = reverse sort { $a cmp $b } @headers; |
@headers = reverse sort { $a cmp $b } @headers; |
58 |
if (grep { $_->filename =~ m#/centos/[\d.]+/(updates|fasttrack)/# } @headers) |
if (grep { $_->filename =~ m#/centos/[\d.]+/(updates|fasttrack)/# } @headers) |
59 |
{ |
{ |
60 |
@headers = grep { $_->filename !~ m#/centos/[\d.]+/os/# } @headers; |
@headers = grep { $_->filename !~ m#/centos/[\d.]+/os/# || $_ eq $rpms{$rpm} } @headers; |
61 |
} |
} |
62 |
if (grep { $_->filename =~ m#/centos/[\d.]+/(os|updates|fasttrack|extras)/# || $_->filename =~ m#/dag/[^d]# } @headers) |
if (grep { $_->filename =~ m#/centos/[\d.]+/(os|updates|fasttrack|extras)/# || $_->filename =~ m#/dag/[^d]# } @headers) |
63 |
{ |
{ |
64 |
@headers = grep { $_->filename !~ m#/atrpms/# } @headers; |
@headers = grep { $_->filename !~ m#/atrpms/# || $_ eq $rpms{$rpm} } @headers; |
65 |
@headers = grep { $_->filename !~ m#/fedora/# } @headers; |
@headers = grep { $_->filename !~ m#/fedora/# || $_ eq $rpms{$rpm} } @headers; |
66 |
@headers = grep { $_->filename !~ m#/fedora-legacy/# } @headers; |
@headers = grep { $_->filename !~ m#/fedora-legacy/# || $_ eq $rpms{$rpm} } @headers; |
67 |
} |
} |
68 |
if ($#headers < 0) |
if ($#headers < 0) |
69 |
{ |
{ |
82 |
my $filename = $rpms{$rpm}->filename; |
my $filename = $rpms{$rpm}->filename; |
83 |
$filename =~ s@^.*/(.*)@$1@; |
$filename =~ s@^.*/(.*)@$1@; |
84 |
print " " . ($header eq $rpms{$rpm} ? "** " : "-- ") . $header->as_nvre . " ($path)\n"; |
print " " . ($header eq $rpms{$rpm} ? "** " : "-- ") . $header->as_nvre . " ($path)\n"; |
85 |
#print " - rm $build_dir/$filename; cp ". $header->filename . " $build_dir\n"; |
#print " - rm $src/$filename; cp ". $header->filename . " $src\n"; |
86 |
} |
} |
87 |
} |
} |
88 |
} |
} |