/[smeserver]/builds_bin/checkrpms
ViewVC logotype

Annotation of /builds_bin/checkrpms

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


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

1 gordonr 1.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 gordonr 1.2 /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 gordonr 1.1
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 gordonr 1.2 if (grep { $_->filename =~ m#/centos/[\d.]+/updates/# } @headers)
53 gordonr 1.1 {
54 gordonr 1.2 @headers = grep { $_->filename !~ m#/centos/[\d.]+/os/# } @headers;
55 gordonr 1.1 }
56 gordonr 1.2 if (grep { $_->filename =~ m#/centos/[\d.]+/(updates|os)/# || $_->filename =~ m#/dag/# } @headers)
57 gordonr 1.1 {
58 gordonr 1.2 @headers = grep { $_->filename !~ m#/fedora/# } @headers;
59     @headers = grep { $_->filename !~ m#/atrpms/# } @headers;
60 gordonr 1.1 }
61     if ($#headers < 0)
62     {
63     print "$rpm\n";
64     print " ***** can't find $rpm in any repository *****\n";
65     }
66 gordonr 1.2 elsif ( $headers[0]->filename !~ m#/centos/[\d.]+/(updates|os)/# || $headers[0] ne $rpms{$rpm} )
67 gordonr 1.1 {
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