1 |
slords |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use warnings; |
5 |
|
|
use RPM2; |
6 |
slords |
1.20 |
use File::Find; |
7 |
|
|
use File::Basename; |
8 |
|
|
use Getopt::Std; |
9 |
slords |
1.1 |
use Data::Dumper; |
10 |
|
|
|
11 |
slords |
1.20 |
delete $ENV{PATH}; |
12 |
|
|
my $HOME=$ENV{HOME}; |
13 |
|
|
umask 002; |
14 |
slords |
1.30 |
$| = 1; |
15 |
|
|
|
16 |
|
|
my %opts; |
17 |
slords |
1.73 |
getopts( 'ostr:', \%opts ); |
18 |
slords |
1.30 |
$opts{r} ||= ''; |
19 |
slords |
1.20 |
|
20 |
slords |
1.72 |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
21 |
slords |
1.20 |
|
22 |
slords |
1.52 |
my $osdir = 'SME'; |
23 |
|
|
my $disttag = 'sme'; |
24 |
|
|
my $repotag = 'sme'; |
25 |
|
|
|
26 |
slords |
1.20 |
my @archs = ( 'i386', 'x86_64' ); |
27 |
|
|
|
28 |
slords |
1.73 |
my $distrepo = { '8' => { active => 1, |
29 |
slords |
1.53 |
centos => 5, |
30 |
slords |
1.70 |
repo => '/build/smeserver/repo/8/', |
31 |
slords |
1.71 |
builds => ['/build/builds/smeserver-8-core/'], |
32 |
slords |
1.70 |
community => '/build/builds/smeserver-8-contribs/', |
33 |
|
|
stage => '/build/smeserver/stage/8/', |
34 |
slords |
1.67 |
sign => 1, |
35 |
slords |
1.73 |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
36 |
slords |
1.66 |
checksum => 'sha', |
37 |
slords |
1.20 |
}, |
38 |
slords |
1.71 |
'9' => { active => 1, |
39 |
|
|
centos => 6, |
40 |
|
|
repo => '/build/smeserver/repo/testing/9/', |
41 |
|
|
builds => ['/build/builds/smeserver-9-core/'], |
42 |
|
|
community => '/build/builds/smeserver-9-contribs/', |
43 |
|
|
stage => '/build/smeserver/stage/9/', |
44 |
slords |
1.72 |
sign => 1, |
45 |
slords |
1.73 |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
46 |
slords |
1.71 |
checksum => 'sha256', |
47 |
|
|
}, |
48 |
slords |
1.20 |
}; |
49 |
|
|
|
50 |
slords |
1.67 |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
51 |
|
|
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
52 |
|
|
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
53 |
|
|
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
54 |
|
|
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
55 |
|
|
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
56 |
|
|
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
57 |
|
|
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
58 |
slords |
1.52 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
59 |
|
|
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
60 |
|
|
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
61 |
|
|
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
62 |
|
|
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
63 |
slords |
1.53 |
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
64 |
slords |
1.52 |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
65 |
slords |
1.30 |
}; |
66 |
|
|
|
67 |
slords |
1.71 |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
68 |
|
|
"~S${repotag}updates/~A/" => "${repotag}updates", |
69 |
|
|
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
70 |
|
|
"~S${repotag}extras/~A/" => "${repotag}extras", |
71 |
|
|
"~S${repotag}addons/~A/" => "${repotag}addons", |
72 |
|
|
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
73 |
|
|
"~S${repotag}test/~A/" => "${repotag}test", |
74 |
|
|
"~S${repotag}dev/~A/" => "${repotag}dev", |
75 |
|
|
"/build/smeserver/stage/~s/~A/" => 'stage', |
76 |
|
|
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
77 |
|
|
'/mirrors/centos/~C/updates/~A/' => 'centos', |
78 |
|
|
'/mirrors/centos/~C/os/~A/' => 'centos', |
79 |
|
|
'/mirrors/centos/~C/extras/~A/' => 'centos', |
80 |
|
|
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
81 |
|
|
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
82 |
|
|
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
83 |
|
|
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
84 |
slords |
1.30 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
85 |
|
|
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
86 |
slords |
1.71 |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
87 |
|
|
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
88 |
slords |
1.60 |
'/mirrors/rpmforge/source/' => 'rpmforge', |
89 |
slords |
1.30 |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
90 |
|
|
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
91 |
|
|
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
92 |
|
|
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
93 |
|
|
}; |
94 |
|
|
|
95 |
slords |
1.73 |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
96 |
slords |
1.58 |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
97 |
slords |
1.68 |
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'html2ps', 'horde', 'libtalloc', 'libtdb', 'oidentd', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'smolt' ) }, |
98 |
slords |
1.67 |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
99 |
slords |
1.20 |
}, |
100 |
slords |
1.73 |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
101 |
slords |
1.71 |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
102 |
|
|
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
103 |
|
|
}, |
104 |
slords |
1.20 |
}; |
105 |
|
|
|
106 |
slords |
1.30 |
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
107 |
slords |
1.20 |
my ($devel1, $devel2) = sort { $repos->{$a}->{devel} <=> $repos->{$b}->{devel} } grep { $repos->{$_}->{devel} } keys %$repos; |
108 |
|
|
$devel2 ||= $devel1; |
109 |
|
|
|
110 |
slords |
1.30 |
my ($rpms, %base, %latest, %sources); |
111 |
slords |
1.52 |
foreach my $ver ( sort { $a <=> $b } keys %$distrepo ) { |
112 |
|
|
next unless $distrepo->{$ver}->{active}; |
113 |
slords |
1.30 |
my %repochg = (); |
114 |
|
|
$rpms = (); |
115 |
slords |
1.21 |
%latest = (); |
116 |
slords |
1.20 |
%sources = (); |
117 |
slords |
1.30 |
%base = (); |
118 |
slords |
1.20 |
|
119 |
slords |
1.30 |
foreach my $dir ( sort { $repos->{$baserepo->{$b}}->{prio} <=> $repos->{$baserepo->{$a}}->{prio} || $a cmp $b } keys %$baserepo ) { |
120 |
|
|
my $bdir = $dir; |
121 |
slords |
1.52 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
122 |
|
|
$bdir =~ s/~s/$ver/; |
123 |
|
|
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
124 |
slords |
1.30 |
for my $arch ( @archs, 'SRPMS/' ) { |
125 |
|
|
my $adir = $bdir; |
126 |
|
|
if ( $arch eq 'SRPMS/' ) { |
127 |
slords |
1.71 |
$adir =~ s/~A.*//; |
128 |
|
|
if ( -d "${adir}SRPMS" ) { |
129 |
|
|
$adir .= "SRPMS/"; |
130 |
|
|
} elsif ( -d "${adir}Source/SPackages" ) { |
131 |
|
|
$adir .= "Source/SPackages/"; |
132 |
|
|
} |
133 |
slords |
1.30 |
} else { |
134 |
|
|
$adir =~ s/~A/$arch/; |
135 |
slords |
1.73 |
if ( -d "${adir}RPMS" ) { |
136 |
slords |
1.71 |
$adir .= "RPMS/"; |
137 |
|
|
} elsif ( -d "${adir}Packages" ) { |
138 |
|
|
$adir .= "Packages/"; |
139 |
|
|
} elsif ( -d "${adir}CentOS" ) { |
140 |
|
|
$adir .= "CentOS/"; |
141 |
|
|
} elsif ( -d "${adir}$osdir" ) { |
142 |
|
|
$adir .= "$osdir/"; |
143 |
|
|
} |
144 |
slords |
1.30 |
} |
145 |
slords |
1.71 |
next unless -d $adir; |
146 |
slords |
1.30 |
opendir DIR, $adir or next; |
147 |
slords |
1.52 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
148 |
slords |
1.30 |
closedir DIR; |
149 |
|
|
last unless $dir =~ m{~A}; |
150 |
slords |
1.20 |
} |
151 |
|
|
} |
152 |
slords |
1.71 |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, "$_" ) foreach @{$distrepo->{$ver}->{'builds'}}; |
153 |
slords |
1.53 |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
154 |
slords |
1.20 |
|
155 |
slords |
1.30 |
foreach my $base ( sort keys %$rpms ) { |
156 |
slords |
1.35 |
next unless $rpms->{$base}->{rpms}; |
157 |
slords |
1.30 |
my %track = (); |
158 |
slords |
1.20 |
my %seen = (); |
159 |
slords |
1.30 |
my %counts = (); |
160 |
|
|
my $acnt = (); |
161 |
|
|
my $print = 0; |
162 |
|
|
%latest = (); |
163 |
|
|
|
164 |
|
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
165 |
|
|
next if $pkg->{done}; |
166 |
|
|
|
167 |
slords |
1.31 |
my $tmp = $pkg->{svr}; |
168 |
slords |
1.60 |
# srpm transformations to match up binary and source rpms |
169 |
slords |
1.31 |
SRC: { |
170 |
slords |
1.60 |
# Try to find the name the binary wants (no changes) |
171 |
|
|
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
172 |
|
|
|
173 |
|
|
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
174 |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf[btx]?)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
175 |
slords |
1.66 |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
176 |
slords |
1.60 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
177 |
slords |
1.66 |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
178 |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
179 |
slords |
1.60 |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
180 |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
181 |
|
|
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
182 |
|
|
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
183 |
|
|
|
184 |
slords |
1.66 |
# atrpms (remove .at) |
185 |
|
|
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
186 |
slords |
1.60 |
# atrpms (remove .el4.at) |
187 |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
188 |
|
|
# atrpms (remove .el4) |
189 |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
190 |
|
|
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
191 |
|
|
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
192 |
|
|
|
193 |
|
|
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
194 |
|
|
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
195 |
|
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
196 |
|
|
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
197 |
|
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
198 |
|
|
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
199 |
|
|
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
200 |
|
|
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
201 |
|
|
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
202 |
|
|
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
203 |
slords |
1.31 |
} |
204 |
|
|
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
205 |
|
|
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
206 |
slords |
1.30 |
$tmp->{svr} = $pkg->{svr}; |
207 |
slords |
1.31 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
208 |
|
|
$tmp->{added}++; |
209 |
slords |
1.30 |
} |
210 |
slords |
1.20 |
} |
211 |
|
|
|
212 |
slords |
1.30 |
my %orig = (); |
213 |
|
|
my %pkgs = (); |
214 |
|
|
my %reposrc = (); |
215 |
|
|
my $srpm = undef; |
216 |
slords |
1.31 |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
217 |
slords |
1.30 |
next unless $cmp->{svr} eq $pkg->{svr}; |
218 |
|
|
|
219 |
|
|
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
220 |
|
|
if ( $cmp->{src} ) { |
221 |
slords |
1.31 |
if ( ! $track{repo} ) { |
222 |
slords |
1.30 |
$cmp->{delete}++; |
223 |
slords |
1.31 |
$cmp->{done}++; |
224 |
|
|
next; |
225 |
slords |
1.30 |
} |
226 |
slords |
1.31 |
} else { |
227 |
|
|
$track{repo} = $cmp->{repo}; |
228 |
|
|
$track{svr} = $cmp->{svr}; |
229 |
|
|
} |
230 |
|
|
} |
231 |
|
|
if ( $cmp->{svr} eq $track{svr} ) { |
232 |
|
|
if ( $seen{$cmp->{nvra}} ) { |
233 |
slords |
1.30 |
if ( $track{repo} ne $cmp->{repo} ) { |
234 |
|
|
if ($repos->{$cmp->{repo}}->{stage} ) { |
235 |
|
|
if ( $seen{$cmp->{nvra}}->{latest} ) { |
236 |
|
|
$seen{$cmp->{nvra}}->{latest}++; |
237 |
slords |
1.60 |
delete $cmp->{delete} if $cmp->{delete}; |
238 |
slords |
1.30 |
} else { |
239 |
|
|
$cmp->{delete}++; |
240 |
|
|
} |
241 |
slords |
1.62 |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
242 |
slords |
1.30 |
$orig{$cmp->{nvra}}++; |
243 |
slords |
1.42 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
244 |
slords |
1.73 |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
245 |
slords |
1.45 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
246 |
slords |
1.42 |
} |
247 |
slords |
1.62 |
} elsif ( $cmp->{src} ) { |
248 |
|
|
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
249 |
slords |
1.60 |
$cmp->{repo} = $cmp->{oldrepo}; |
250 |
|
|
delete $cmp->{delete}; |
251 |
|
|
} |
252 |
slords |
1.62 |
if ( $reposrc{$cmp->{repo}} ) { |
253 |
slords |
1.60 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
254 |
|
|
$srpm = $cmp if ! $srpm; |
255 |
slords |
1.62 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
256 |
slords |
1.60 |
$cmp->{delete}++; |
257 |
|
|
} |
258 |
slords |
1.62 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
259 |
|
|
$cmp->{delete}++; |
260 |
slords |
1.26 |
} |
261 |
slords |
1.62 |
} elsif ( $cmp->{src} ) { |
262 |
|
|
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
263 |
|
|
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
264 |
|
|
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
265 |
|
|
]; |
266 |
|
|
|
267 |
|
|
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
268 |
|
|
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
269 |
|
|
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
270 |
|
|
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
271 |
|
|
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
272 |
|
|
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
273 |
|
|
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
274 |
|
|
} else { |
275 |
|
|
warn "How did I get here??"; |
276 |
|
|
} |
277 |
|
|
} else { |
278 |
|
|
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
279 |
|
|
} |
280 |
|
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
281 |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
282 |
slords |
1.20 |
} |
283 |
slords |
1.66 |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
284 |
slords |
1.30 |
$cmp->{delete}++; |
285 |
|
|
} else { |
286 |
slords |
1.31 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
287 |
slords |
1.30 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
288 |
|
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
289 |
|
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
290 |
|
|
if ( $cmp->{repo} ne $dest ) { |
291 |
|
|
push @{$cmp->{repos}}, $dest; |
292 |
|
|
if ( $repos->{$cmp->{repo}}->{orig} ) { |
293 |
|
|
$orig{$cmp->{nvra}}++; |
294 |
slords |
1.42 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
295 |
slords |
1.73 |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
296 |
slords |
1.45 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
297 |
slords |
1.42 |
} |
298 |
slords |
1.31 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
299 |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
300 |
slords |
1.30 |
} else { |
301 |
|
|
$cmp->{delete}++; |
302 |
slords |
1.21 |
} |
303 |
slords |
1.30 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
304 |
|
|
$cmp->{repo} = $dest; |
305 |
slords |
1.39 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
306 |
slords |
1.38 |
$track{repo} = $dest; |
307 |
slords |
1.39 |
$track{svr} = $cmp->{svr}; |
308 |
slords |
1.38 |
} |
309 |
slords |
1.20 |
} |
310 |
slords |
1.31 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
311 |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
312 |
|
|
} |
313 |
slords |
1.20 |
} |
314 |
slords |
1.30 |
} else { |
315 |
|
|
if ( $track{repo} eq $cmp->{repo} ) { |
316 |
|
|
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
317 |
|
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
318 |
slords |
1.32 |
} elsif ( $cmp->{src} ) { |
319 |
|
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
320 |
slords |
1.18 |
} else { |
321 |
slords |
1.30 |
$track{svr} = $cmp->{svr}; |
322 |
slords |
1.11 |
} |
323 |
slords |
1.30 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
324 |
slords |
1.36 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
325 |
|
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
326 |
|
|
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
327 |
|
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
328 |
|
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
329 |
slords |
1.55 |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
330 |
slords |
1.60 |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
331 |
|
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
332 |
slords |
1.73 |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
333 |
slords |
1.60 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
334 |
|
|
} |
335 |
|
|
push @{$cmp->{repos}}, $dest; |
336 |
|
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
337 |
|
|
$cmp->{repo} = $dest; |
338 |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
339 |
|
|
$orig{$cmp->{nvra}}++; |
340 |
slords |
1.44 |
} |
341 |
slords |
1.36 |
} |
342 |
|
|
} else { |
343 |
|
|
$cmp->{delete}++; |
344 |
|
|
} |
345 |
slords |
1.30 |
} |
346 |
|
|
} |
347 |
|
|
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
348 |
|
|
$pkgs{$cmp->{nvra}}++; |
349 |
|
|
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
350 |
slords |
1.31 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
351 |
slords |
1.60 |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
352 |
|
|
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
353 |
slords |
1.20 |
} |
354 |
slords |
1.60 |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
355 |
slords |
1.62 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
356 |
slords |
1.20 |
} |
357 |
slords |
1.30 |
$cmp->{done}++; |
358 |
slords |
1.20 |
} |
359 |
slords |
1.30 |
if ( $srpm ) { |
360 |
slords |
1.31 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
361 |
slords |
1.30 |
unless ( $reposrc{$r}->{srpm} ) { |
362 |
slords |
1.31 |
unshift @{$srpm->{repos}}, $r; |
363 |
slords |
1.30 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
364 |
|
|
$srpm->{repo} = $r; |
365 |
|
|
$reposrc{$r}->{srpm} = $srpm; |
366 |
|
|
} |
367 |
slords |
1.20 |
} |
368 |
slords |
1.31 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
369 |
slords |
1.52 |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
370 |
slords |
1.20 |
} |
371 |
slords |
1.52 |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
372 |
slords |
1.20 |
} |
373 |
slords |
1.30 |
|
374 |
|
|
foreach my $r ( keys %$acnt ) { |
375 |
|
|
foreach my $p ( keys %{$acnt->{$r}} ) { |
376 |
|
|
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
377 |
slords |
1.20 |
if ( $a eq 'noarch' ) { |
378 |
slords |
1.30 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
379 |
|
|
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
380 |
|
|
$p2->{oldrepo} = $p2->{repo}; |
381 |
|
|
push @{$p2->{repos}}, $p2->{repo}; |
382 |
|
|
} |
383 |
|
|
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
384 |
|
|
print "\n * many packages ($r, $a, $p)\n"; |
385 |
slords |
1.20 |
} |
386 |
|
|
} |
387 |
|
|
} |
388 |
|
|
} |
389 |
slords |
1.25 |
|
390 |
slords |
1.30 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
391 |
|
|
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
392 |
slords |
1.65 |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
393 |
slords |
1.63 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
394 |
|
|
$pkg->{repo} = $stage; |
395 |
|
|
push @{$pkg->{repos}}, $stage; |
396 |
|
|
} |
397 |
slords |
1.30 |
} |
398 |
slords |
1.20 |
|
399 |
slords |
1.73 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
400 |
|
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
401 |
|
|
$print++; |
402 |
|
|
} |
403 |
|
|
|
404 |
|
|
my $src = $pkg->{rpm}->filename; |
405 |
|
|
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
406 |
|
|
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
407 |
|
|
unless ( $opts{t} ) { |
408 |
|
|
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
409 |
|
|
if ($?) { |
410 |
|
|
print " * failed to sign package\n"; |
411 |
|
|
next; |
412 |
|
|
} |
413 |
|
|
} |
414 |
|
|
} |
415 |
slords |
1.20 |
|
416 |
|
|
if ( $pkg->{repos} ) { |
417 |
slords |
1.30 |
foreach my $repo ( @{$pkg->{repos}} ) { |
418 |
|
|
if ( $pkg->{delete} ) { |
419 |
|
|
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
420 |
|
|
$pkg->{delete} = 0; |
421 |
|
|
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
422 |
|
|
} elsif ( $pkg->{oldrepo} eq $repo ) { |
423 |
|
|
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
424 |
|
|
} else { |
425 |
|
|
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
426 |
|
|
} |
427 |
|
|
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
428 |
|
|
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
429 |
|
|
|
430 |
|
|
my @d = (); |
431 |
slords |
1.52 |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
432 |
|
|
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
433 |
slords |
1.71 |
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
434 |
slords |
1.30 |
if ( $pkg->{src} ) { |
435 |
|
|
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
436 |
|
|
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
437 |
|
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
438 |
|
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
439 |
|
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
440 |
|
|
} else { |
441 |
|
|
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
442 |
|
|
} |
443 |
|
|
foreach my $dest ( @d ) { |
444 |
|
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
445 |
|
|
} |
446 |
|
|
|
447 |
slords |
1.11 |
} |
448 |
slords |
1.30 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
449 |
|
|
} elsif ( $pkg->{delete} ) { |
450 |
slords |
1.34 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
451 |
slords |
1.31 |
qx(rm -f $src) unless $opts{t}; |
452 |
slords |
1.30 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
453 |
slords |
1.42 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
454 |
slords |
1.73 |
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
455 |
slords |
1.45 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
456 |
slords |
1.42 |
} |
457 |
slords |
1.20 |
} |
458 |
|
|
} |
459 |
slords |
1.59 |
|
460 |
|
|
if ( $rpms->{$base}->{srpms} ) { |
461 |
|
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
462 |
|
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
463 |
|
|
$pkg->{delete}++; |
464 |
|
|
my $src = $pkg->{rpm}->filename; |
465 |
slords |
1.67 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
466 |
slords |
1.59 |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
467 |
|
|
$print++; |
468 |
|
|
} |
469 |
|
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
470 |
|
|
qx(rm -f $src) unless $opts{t}; |
471 |
|
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
472 |
|
|
} |
473 |
|
|
} |
474 |
slords |
1.30 |
} |
475 |
|
|
|
476 |
|
|
if ( %repochg ) { |
477 |
slords |
1.52 |
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
478 |
slords |
1.30 |
} |
479 |
|
|
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
480 |
|
|
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
481 |
|
|
foreach my $arch ( @archs ) { |
482 |
slords |
1.52 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
483 |
slords |
1.30 |
$dir = qx(readlink -f $dir); |
484 |
slords |
1.71 |
if ( $dir ) { |
485 |
|
|
chomp $dir; |
486 |
|
|
} else { |
487 |
|
|
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
488 |
|
|
} |
489 |
slords |
1.30 |
print "rebuild $repo/$arch\n"; |
490 |
|
|
unless ( $opts{t} ) { |
491 |
slords |
1.66 |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
492 |
|
|
|
493 |
|
|
my $exclude = ""; |
494 |
slords |
1.71 |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
495 |
slords |
1.72 |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
496 |
slords |
1.66 |
|
497 |
|
|
my $groupfile = ""; |
498 |
slords |
1.72 |
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
499 |
slords |
1.66 |
|
500 |
|
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
501 |
slords |
1.20 |
qx(repoview $dir); |
502 |
slords |
1.66 |
|
503 |
slords |
1.20 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
504 |
|
|
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
505 |
slords |
1.60 |
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
506 |
|
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
507 |
|
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
508 |
slords |
1.20 |
} |
509 |
slords |
1.11 |
} |
510 |
slords |
1.20 |
} |
511 |
slords |
1.30 |
unless ( $opts{t} ) { |
512 |
slords |
1.71 |
foreach (@{$distrepo->{$ver}->{builds}}) |
513 |
|
|
{ |
514 |
|
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
515 |
|
|
} |
516 |
slords |
1.53 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
517 |
slords |
1.30 |
} |
518 |
slords |
1.1 |
} |
519 |
|
|
|
520 |
slords |
1.30 |
sub verrel { |
521 |
|
|
my $pkg = shift; |
522 |
|
|
my $repo = shift; |
523 |
|
|
my $counts = shift; |
524 |
slords |
1.20 |
|
525 |
slords |
1.31 |
return 0 if $pkg->{src}; |
526 |
slords |
1.30 |
$counts->{$repo}->{$pkg->{ver}}->{$pkg->{rel}}++; |
527 |
|
|
return 1 if $repos->{$repo}->{ver} && scalar keys %{$counts->{$repo}} > $repos->{$repo}->{ver}; |
528 |
|
|
return 1 if $repos->{$repo}->{rel} && scalar keys %{$counts->{$repo}->{$pkg->{ver}}} > $repos->{$repo}->{rel}; |
529 |
|
|
return 0; |
530 |
slords |
1.20 |
} |
531 |
|
|
|
532 |
slords |
1.30 |
sub pkgdest { |
533 |
slords |
1.20 |
my $pkg = shift; |
534 |
slords |
1.30 |
my $dest = shift; |
535 |
|
|
my $hirepo = shift; |
536 |
|
|
my $pkgs = shift; |
537 |
|
|
|
538 |
|
|
foreach my $cmp ( @$pkgs ) { |
539 |
slords |
1.31 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
540 |
|
|
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
541 |
slords |
1.30 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
542 |
|
|
$dest = $hirepo; |
543 |
|
|
last; |
544 |
slords |
1.20 |
} else { |
545 |
slords |
1.30 |
$dest = $cmp->{repo}; |
546 |
slords |
1.20 |
} |
547 |
|
|
} |
548 |
slords |
1.30 |
return $dest; |
549 |
slords |
1.20 |
} |
550 |
|
|
|
551 |
slords |
1.30 |
sub process_rpm { |
552 |
|
|
my $rpm = shift; |
553 |
slords |
1.52 |
my $ver = shift; |
554 |
slords |
1.30 |
my $repo = shift; |
555 |
|
|
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
556 |
|
|
my $base = $1; |
557 |
|
|
return unless ! $opts{r} || $base =~ m[$opts{r}]; |
558 |
|
|
return unless $latest{$base} || $sources{$base} || ! $repos->{$repo}->{base}; |
559 |
slords |
1.20 |
|
560 |
|
|
my $pkg; |
561 |
slords |
1.30 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
562 |
|
|
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
563 |
slords |
1.20 |
eval { my $sig = $pkg->siggpg }; |
564 |
slords |
1.72 |
|
565 |
|
|
my $nosig = 1; |
566 |
|
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
567 |
|
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
568 |
|
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
569 |
|
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
570 |
|
|
|
571 |
slords |
1.30 |
my $cmp = $latest{$pkg->name}; |
572 |
|
|
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
573 |
|
|
return unless $cmp; |
574 |
|
|
return if $repos->{$cmp->{repo}}->{base} && $repos->{$cmp->{repo}}->{prio} > $repos->{$repo}->{prio} && $pkg ge $cmp->{rpm}; |
575 |
|
|
} |
576 |
|
|
my ($src, $version, $release) = ($pkg->is_source_package ? $pkg->filename : $pkg->sourcerpm) =~ m{(?:^|/)([^/]*)-([^-]+)-([^-]+)\.\w+\.rpm$}; |
577 |
slords |
1.52 |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
578 |
slords |
1.71 |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
579 |
slords |
1.30 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
580 |
slords |
1.34 |
my $arch = 'unknown'; |
581 |
|
|
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
582 |
|
|
$arch = 'x86_64' if $pkg->filename =~ m{[/-]x86_64/}; |
583 |
|
|
$arch = 'i386' if $pkg->filename =~ m{[/-](i[356]86)/}; |
584 |
|
|
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
585 |
slords |
1.30 |
|
586 |
|
|
my $rpmhash = { base => $src, |
587 |
|
|
name => $pkg->name, |
588 |
|
|
repo => $repo, |
589 |
|
|
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
590 |
|
|
svr => $src.'-'.$version.'-'.$release, |
591 |
|
|
src => $pkg->is_source_package, |
592 |
slords |
1.34 |
arch => $arch, |
593 |
slords |
1.30 |
ver => $version, |
594 |
|
|
rel => $release, |
595 |
|
|
rpm => $pkg, |
596 |
|
|
nosig => $nosig, |
597 |
|
|
}; |
598 |
|
|
if ( $pkg->is_source_package ) { |
599 |
|
|
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
600 |
|
|
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
601 |
|
|
} else { |
602 |
|
|
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
603 |
slords |
1.26 |
} |
604 |
slords |
1.30 |
$sources{$src}++; |
605 |
slords |
1.20 |
|
606 |
slords |
1.30 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
607 |
|
|
if ( ! $repos->{$repo}->{base} ) { |
608 |
|
|
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
609 |
|
|
$latest{$pkg->name} = $rpmhash; |
610 |
slords |
1.20 |
} |
611 |
slords |
1.30 |
} elsif ( ( $repos->{$repo}->{prio} >= $repos->{$cmp->{repo}}->{prio} || ! $repos->{$cmp->{repo}}->{base} ) && $pkg ge $cmp->{rpm} ) { |
612 |
|
|
$latest{$pkg->name} = $rpmhash; |
613 |
slords |
1.20 |
} |
614 |
slords |
1.1 |
} |