/[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.1.1.1 - (hide annotations) (download) (vendor branch)
Thu Sep 15 23:55:09 2005 UTC (19 years, 2 months ago) by gordonr
Branch: SME
CVS Tags: V1_0
Changes since 1.1: +0 -0 lines
Initial import

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

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