14 |
$| = 1; |
$| = 1; |
15 |
|
|
16 |
my %opts; |
my %opts; |
17 |
getopts( 'otr:', \%opts ); |
getopts( 'osqtr:', \%opts ); |
18 |
$opts{r} ||= ''; |
$opts{r} ||= ''; |
19 |
|
|
20 |
my $rpm_flags = RPM2->vsf_nosha1header | RPM2->vsf_nomd5header | RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader; |
my $rpm_flags = RPM2->vsf_nosha1header | RPM2->vsf_nomd5header | RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader; |
29 |
os => 'RPMS/', |
os => 'RPMS/', |
30 |
builds => '/builds/smeserver-7-core/', |
builds => '/builds/smeserver-7-core/', |
31 |
contribs => '/builds/smeserver-7-contribs/', |
contribs => '/builds/smeserver-7-contribs/', |
|
qa => '/builds/smeserver-7-qa/', |
|
32 |
stage => '/stage/7/', |
stage => '/stage/7/', |
33 |
}, |
}, |
34 |
'8' => { active => 1, |
'8' => { active => 1, |
38 |
os => '', |
os => '', |
39 |
builds => '/builds/smeserver-8-core/', |
builds => '/builds/smeserver-8-core/', |
40 |
contribs => '/builds/smeserver-8-contribs/', |
contribs => '/builds/smeserver-8-contribs/', |
|
qa => '/builds/smeserver-8-qa/', |
|
41 |
stage => '/stage/8/', |
stage => '/stage/8/', |
42 |
}, |
}, |
43 |
}; |
}; |
47 |
'smeupdates-testing' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
'smeupdates-testing' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
48 |
'smeextras' => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
'smeextras' => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
49 |
'smeaddons' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
'smeaddons' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
50 |
'smecontribs' => { prio => 13, inc => 0, ver => 1, rel => 2 }, |
'smecontribs' => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
51 |
'smetest' => { prio => 12, inc => 0, ver => 2, rel => 2, devel => 2 }, |
'smetest' => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
52 |
'smedev' => { prio => 11, inc => 0, ver => 2, rel => 2, devel => 1 }, |
'smedev' => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
53 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
54 |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
55 |
'fedora-extras' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'fedora-extras' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
74 |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
75 |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
76 |
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
|
'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O' => 'centos', |
|
|
'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/' => 'centos', |
|
77 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
78 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
79 |
'/mirrors/fedora/extras/~F/~A/' => 'fedora-extras', |
'/mirrors/fedora/extras/~F/~A/' => 'fedora-extras', |
87 |
'/mirrors/fedora/core/updates/~F/~A/' => 'fedora', |
'/mirrors/fedora/core/updates/~F/~A/' => 'fedora', |
88 |
}; |
}; |
89 |
|
|
90 |
|
if ( $opts{q} ) { |
91 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
92 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
93 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
94 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
95 |
|
} |
96 |
|
|
97 |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3', 'vim' ) }, |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3', 'vim' ) }, |
98 |
'epel' => { map { $_ => 1 } ( 'perl-Razor-Agent' ) }, |
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'perl-Text-Iconv', 'proftpd' ) }, |
99 |
|
'fedora-extras' => { map { $_ => 1 } ( 'pam_abl', 'perl-Error', 'perl-HTML-Format', 'perl-MIME-Types', 'perl-Net-IP', 'perl-Razor-Agent', 'perl-Test-Inline', 'perl-Text-Autoformat', 'perl-Text-Iconv', 'perl-Text-Reform' ) }, |
100 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
101 |
'atrpms' => { map { $_ => 1 } ( 'dovecot', 'trac', 'yum' ) }, |
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
102 |
}, |
}, |
103 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
104 |
'fedora' => { map { $_ => 1 } ( 'kernel-xen' ) }, |
'fedora' => { map { $_ => 1 } ( 'kernel', 'kernel-xen' ) }, |
105 |
'epel' => { map { $_ => 1 } ( 'perl-Razor-Agent', 'smolt' ) }, |
'epel' => { map { $_ => 1 } ( 'clamav', 'horde', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'proftpd', 'smolt' ) }, |
106 |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
107 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
108 |
}, |
}, |
109 |
}; |
}; |
142 |
last unless $dir =~ m{~A}; |
last unless $dir =~ m{~A}; |
143 |
} |
} |
144 |
} |
} |
145 |
find( { wanted => sub { process_rpm($_, $smever, 'builds'); }, no_chdir => 1, follow_fast => 1 }, ( $distrepo->{$smever}->{'builds'}, $distrepo->{$smever}->{'qa'} ) ); |
find( { wanted => sub { process_rpm($_, $smever, 'builds'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{'builds'} ); |
146 |
find( { wanted => sub { process_rpm($_, $smever, 'contribs'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{'contribs'} ); |
find( { wanted => sub { process_rpm($_, $smever, 'contribs'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{'contribs'} ); |
147 |
|
|
148 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
149 |
|
next unless $rpms->{$base}->{rpms}; |
150 |
my %track = (); |
my %track = (); |
151 |
my %seen = (); |
my %seen = (); |
152 |
my %counts = (); |
my %counts = (); |
157 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
158 |
next if $pkg->{done}; |
next if $pkg->{done}; |
159 |
|
|
160 |
if ( $rpms->{$base}->{vers}->{$pkg->{svr}} ) { |
my $tmp = $pkg->{svr}; |
161 |
foreach my $tmp ( @{$rpms->{$base}->{vers}->{$pkg->{svr}}} ) { |
SRC: { |
162 |
|
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
163 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
164 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
165 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
166 |
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
167 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
168 |
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
169 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
170 |
|
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
171 |
|
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
172 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.sme$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
173 |
|
} |
174 |
|
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
175 |
|
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
176 |
$tmp->{svr} = $pkg->{svr}; |
$tmp->{svr} = $pkg->{svr}; |
177 |
push @{$rpms->{$base}->{rpms}}, $tmp; |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
178 |
} |
$tmp->{added}++; |
|
} else { |
|
|
my $tmp = $pkg->{svr}; |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.sme$}{} && $rpms->{$base}->{vers}->{$tmp} && last; |
|
|
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
|
|
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
|
|
$tmp->{svr} = $pkg->{svr}; |
|
|
push @{$rpms->{$base}->{rpms}}, $tmp; |
|
|
} |
|
179 |
} |
} |
180 |
} |
} |
181 |
|
|
183 |
my %pkgs = (); |
my %pkgs = (); |
184 |
my %reposrc = (); |
my %reposrc = (); |
185 |
my $srpm = undef; |
my $srpm = undef; |
186 |
foreach my $cmp ( sort { $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} || $a->{src} <=> $b->{src} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
187 |
next unless $cmp->{svr} eq $pkg->{svr}; |
next unless $cmp->{svr} eq $pkg->{svr}; |
188 |
|
|
189 |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
|
$track{repo} = $cmp->{repo}; |
|
|
$track{svr} = $cmp->{svr}; |
|
|
} |
|
|
if ( $cmp->{svr} eq $track{svr} ) { |
|
190 |
if ( $cmp->{src} ) { |
if ( $cmp->{src} ) { |
191 |
$srpm = $cmp unless $srpm; |
if ( ! $track{repo} ) { |
|
if ( $reposrc{$cmp->{repo}} ) { |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
|
|
$cmp->{latest}++ if $reposrc{$cmp->{repo}}->{latest}; |
|
|
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
|
192 |
$cmp->{delete}++; |
$cmp->{delete}++; |
193 |
|
$cmp->{done}++; |
194 |
|
next; |
195 |
} |
} |
196 |
} elsif ( $seen{$cmp->{nvra}} ) { |
} else { |
197 |
|
$track{repo} = $cmp->{repo}; |
198 |
|
$track{svr} = $cmp->{svr}; |
199 |
|
} |
200 |
|
} |
201 |
|
if ( $cmp->{svr} eq $track{svr} ) { |
202 |
|
if ( $seen{$cmp->{nvra}} ) { |
203 |
if ( $track{repo} ne $cmp->{repo} ) { |
if ( $track{repo} ne $cmp->{repo} ) { |
204 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
if ($repos->{$cmp->{repo}}->{stage} ) { |
205 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
209 |
} |
} |
210 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
211 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
212 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
213 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
214 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
215 |
|
} |
216 |
|
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
217 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
218 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
219 |
$cmp->{delete}++; |
$cmp->{delete}++; |
220 |
} |
} |
222 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
223 |
$cmp->{delete}++; |
$cmp->{delete}++; |
224 |
} else { |
} else { |
225 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
226 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
227 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
228 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
230 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
231 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
232 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
233 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
234 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
235 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
236 |
|
} |
237 |
|
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
238 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
239 |
} else { |
} else { |
240 |
$cmp->{delete}++; |
$cmp->{delete}++; |
241 |
} |
} |
242 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
243 |
$cmp->{repo} = $dest; |
$cmp->{repo} = $dest; |
244 |
|
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
245 |
|
$track{repo} = $dest; |
246 |
|
$track{svr} = $cmp->{svr}; |
247 |
|
} |
248 |
|
} |
249 |
|
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
250 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
251 |
} |
} |
252 |
} |
} |
253 |
} else { |
} else { |
254 |
if ( $track{repo} eq $cmp->{repo} ) { |
if ( $track{repo} eq $cmp->{repo} ) { |
255 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
256 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
257 |
|
} elsif ( $cmp->{src} ) { |
258 |
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
259 |
} else { |
} else { |
260 |
$track{svr} = $cmp->{svr}; |
$track{svr} = $cmp->{svr}; |
261 |
} |
} |
262 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
263 |
$cmp->{delete}++; |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
264 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
265 |
|
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
266 |
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
267 |
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
268 |
|
if ( $cmp->{src} && ! $reposrc{$dest} ) { |
269 |
|
$cmp->{delete}++; |
270 |
|
} elsif ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
271 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
272 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
273 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
274 |
|
} |
275 |
|
push @{$cmp->{repos}}, $dest; |
276 |
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
277 |
|
$cmp->{repo} = $dest; |
278 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
279 |
|
$orig{$cmp->{nvra}}++; |
280 |
|
} else { |
281 |
|
$cmp->{delete}++; |
282 |
|
} |
283 |
|
} else { |
284 |
|
$cmp->{delete}++; |
285 |
|
} |
286 |
} |
} |
287 |
} |
} |
|
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{delete} || $repos->{$cmp->{repo}}->{base}; |
|
288 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
289 |
$pkgs{$cmp->{nvra}}++; |
$pkgs{$cmp->{nvra}}++; |
290 |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
291 |
|
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
292 |
unless ( $seen{$cmp->{nvra}} ) { |
unless ( $seen{$cmp->{nvra}} ) { |
293 |
$seen{$cmp->{nvra}} = $cmp; |
$seen{$cmp->{nvra}} = $cmp; |
294 |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
298 |
$cmp->{done}++; |
$cmp->{done}++; |
299 |
} |
} |
300 |
if ( $srpm ) { |
if ( $srpm ) { |
301 |
foreach my $r ( keys %reposrc ) { |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
|
next if $repos->{$r}->{orig}; |
|
302 |
unless ( $reposrc{$r}->{srpm} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
303 |
push @{$srpm->{repos}}, $r; |
unshift @{$srpm->{repos}}, $r; |
|
$pkgs{$srpm->{nvra}}++; |
|
|
$orig{$srpm->{nvra}}++ if $repos->{$srpm->{repo}}->{orig}; |
|
304 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
305 |
$srpm->{repo} = $r; |
$srpm->{repo} = $r; |
306 |
$reposrc{$r}->{srpm} = $srpm; |
$reposrc{$r}->{srpm} = $srpm; |
307 |
} |
} |
308 |
} |
} |
309 |
} elsif ( scalar keys %pkgs ) { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
310 |
print "\n * missing source (", $pkg->{svr}, ")\n"; |
print "\n * missing source (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
311 |
} |
} |
312 |
print "\n * missing originals (", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
print "\n * missing originals (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
313 |
} |
} |
314 |
|
|
315 |
foreach my $r ( keys %$acnt ) { |
foreach my $r ( keys %$acnt ) { |
385 |
} |
} |
386 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
387 |
} elsif ( $pkg->{delete} ) { |
} elsif ( $pkg->{delete} ) { |
388 |
print "delete from ", $pkg->{repo}, " (", basename($pkg->{rpm}->filename), ")\n"; |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
389 |
qx(rm -f $src); |
qx(rm -f $src) unless $opts{t}; |
390 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
391 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
392 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
393 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
394 |
|
} |
395 |
} |
} |
396 |
} |
} |
397 |
} |
} |
408 |
print "rebuild $repo/$arch\n"; |
print "rebuild $repo/$arch\n"; |
409 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
410 |
if ( -f "$dir/repodata/comps.xml" ) { |
if ( -f "$dir/repodata/comps.xml" ) { |
411 |
qx(createrepo -g $dir/repodata/comps.xml $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
412 |
} else { |
} else { |
413 |
qx(createrepo $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
414 |
} |
} |
415 |
qx(repoview $dir); |
qx(repoview $dir); |
416 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
419 |
} |
} |
420 |
} |
} |
421 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
422 |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs','qa'); |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs'); |
423 |
} |
} |
424 |
} |
} |
425 |
|
|
428 |
my $repo = shift; |
my $repo = shift; |
429 |
my $counts = shift; |
my $counts = shift; |
430 |
|
|
431 |
|
return 0 if $pkg->{src}; |
432 |
$counts->{$repo}->{$pkg->{ver}}->{$pkg->{rel}}++; |
$counts->{$repo}->{$pkg->{ver}}->{$pkg->{rel}}++; |
433 |
return 1 if $repos->{$repo}->{ver} && scalar keys %{$counts->{$repo}} > $repos->{$repo}->{ver}; |
return 1 if $repos->{$repo}->{ver} && scalar keys %{$counts->{$repo}} > $repos->{$repo}->{ver}; |
434 |
return 1 if $repos->{$repo}->{rel} && scalar keys %{$counts->{$repo}->{$pkg->{ver}}} > $repos->{$repo}->{rel}; |
return 1 if $repos->{$repo}->{rel} && scalar keys %{$counts->{$repo}->{$pkg->{ver}}} > $repos->{$repo}->{rel}; |
442 |
my $pkgs = shift; |
my $pkgs = shift; |
443 |
|
|
444 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
445 |
next if $cmp->{src} || $cmp->{name} ne $pkg->{name} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
446 |
|
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
447 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
448 |
$dest = $hirepo; |
$dest = $hirepo; |
449 |
last; |
last; |
475 |
return if $repos->{$cmp->{repo}}->{base} && $repos->{$cmp->{repo}}->{prio} > $repos->{$repo}->{prio} && $pkg ge $cmp->{rpm}; |
return if $repos->{$cmp->{repo}}->{base} && $repos->{$cmp->{repo}}->{prio} > $repos->{$repo}->{prio} && $pkg ge $cmp->{rpm}; |
476 |
} |
} |
477 |
my ($src, $version, $release) = ($pkg->is_source_package ? $pkg->filename : $pkg->sourcerpm) =~ m{(?:^|/)([^/]*)-([^-]+)-([^-]+)\.\w+\.rpm$}; |
my ($src, $version, $release) = ($pkg->is_source_package ? $pkg->filename : $pkg->sourcerpm) =~ m{(?:^|/)([^/]*)-([^-]+)-([^-]+)\.\w+\.rpm$}; |
478 |
return if $skippkg->{$smever}->{$repo} && $skippkg->{$smever}->{$repo}->{$src}; |
return if $skippkg->{$smever}->{$repo} && ( $skippkg->{$smever}->{$repo}->{$src} || $skippkg->{$smever}->{$repo}->{$pkg->name} ); |
479 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig; |
480 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
481 |
|
my $arch = 'unknown'; |
482 |
|
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
483 |
|
$arch = 'x86_64' if $pkg->filename =~ m{[/-]x86_64/}; |
484 |
|
$arch = 'i386' if $pkg->filename =~ m{[/-](i[356]86)/}; |
485 |
|
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
486 |
|
|
487 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
488 |
name => $pkg->name, |
name => $pkg->name, |
490 |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
491 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
492 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
493 |
|
arch => $arch, |
494 |
ver => $version, |
ver => $version, |
495 |
rel => $release, |
rel => $release, |
496 |
rpm => $pkg, |
rpm => $pkg, |