/[smeserver]/builds_bin/checkrpms
ViewVC logotype

Contents of /builds_bin/checkrpms

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Fri Jun 30 00:18:36 2006 UTC (18 years, 5 months ago) by gordonr
Branch: MAIN
Changes since 1.2: +0 -1 lines
Checkpoint

1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use RPM2;
6 use Data::Dumper;
7
8 my $rpm_flags = RPM2->vsf_nodsa;
9 my $build_dir = "/builds/RPMS";
10 my @repositories = qw(
11 /mirrors/centos/4/updates/i386/RPMS/
12 /mirrors/centos/4/os/i386/CentOS/RPMS/
13 /mirrors/dag/redhat/el4/en/i386/dag/RPMS/
14 /mirrors/atrpms/el4-i386/atrpms/stable/
15 /mirrors/dries/redhat/el3/en/i386/RPMS.dries
16 /mirrors/fedora/updates/3/i386/
17 /mirrors/fedora/3/i386/os/Fedora/RPMS/
18 /builds/rpms/RPMS/i686/
19 /builds/rpms/RPMS/i586/
20 /builds/rpms/RPMS/i386/
21 /builds/rpms/RPMS/noarch/
22 );
23
24 opendir RPMS, $build_dir or die "Couldn't opendir $build_dir";
25 my %rpms = map { my $x = RPM2->open_package("$build_dir/$_", $rpm_flags); $x->tag('NAME') => $x; } grep { /\.rpm$/ } readdir RPMS;
26 closedir RPMS;
27
28 my %repos;
29 foreach my $repo (reverse @repositories)
30 {
31 my %temp_repo = map { $_ => $repo } grep { /\.rpm$/ } readdir RPMS if ( opendir RPMS, $repo );
32 closedir RPMS;
33 %repos = (%repos, %temp_repo);
34 }
35
36 foreach my $rpm ( sort keys %rpms )
37 {
38 my (@headers, $header);
39
40 my $rpmfix = $rpm;
41 $rpmfix =~ s@\+@\\+@g;
42 @headers = ();
43 foreach my $file ( grep { /^$rpmfix-[0-9].*\.rpm$/ } keys %repos )
44 {
45 $header = RPM2->open_package("$repos{$file}/$file", $rpm_flags);
46 if ($header ge $rpms{$rpm} || $header->filename =~ m#/centos.*/(os|updates)/#)
47 {
48 push @headers, $header;
49 }
50 }
51 @headers = reverse sort { $a cmp $b } @headers;
52 if (grep { $_->filename =~ m#/centos/[\d.]+/updates/# } @headers)
53 {
54 @headers = grep { $_->filename !~ m#/centos/[\d.]+/os/# } @headers;
55 }
56 if (grep { $_->filename =~ m#/centos/[\d.]+/(updates|os)/# || $_->filename =~ m#/dag/# } @headers)
57 {
58 @headers = grep { $_->filename !~ m#/fedora/# } @headers;
59 @headers = grep { $_->filename !~ m#/atrpms/# } @headers;
60 }
61 if ($#headers < 0)
62 {
63 print "$rpm\n";
64 print " ***** can't find $rpm in any repository *****\n";
65 }
66 elsif ( $headers[0]->filename !~ m#/centos/[\d.]+/(updates|os)/# || $headers[0] ne $rpms{$rpm} )
67 {
68 if (grep { $_ ne $rpms{$rpm} } @headers)
69 {
70 print "$rpm\n";
71 foreach $header ( @headers)
72 {
73 my $path = $header->filename;
74 $path =~ s@^(.*)/.*@$1@;
75 print " " . ($header eq $rpms{$rpm} ? "** " : "-- ") . $header->as_nvre . " ($path)\n";
76 }
77 }
78 }
79 }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed