21 |
|
|
22 |
my @archs = ( 'i386', 'x86_64' ); |
my @archs = ( 'i386', 'x86_64' ); |
23 |
|
|
24 |
my $repos = { 'smeos' => { prio => 16, inc => 1, ver => 1, rel => 1, os => 1 }, |
my $repos = { 'smeos' => { prio => 17, inc => 1, ver => 1, rel => 1, os => 1 }, |
25 |
'smeupdates' => { prio => 15, inc => 1, ver => 1, rel => 1 }, |
'smeupdates' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
26 |
'smeupdates-testing' => { prio => 14, inc => 1, ver => 1, rel => 1 }, |
'smeupdates-testing' => { prio => 15, inc => 1, ver => 1, rel => 1 }, |
27 |
'smeextras' => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
'smeextras' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
28 |
'smeaddons' => { prio => 12, inc => 0, ver => 1, rel => 1 }, |
'smeaddons' => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
29 |
'smecontribs' => { prio => 11, inc => 0, ver => 1, rel => 1 }, |
'smecontribs' => { prio => 12, inc => 0, ver => 1, rel => 1 }, |
30 |
'smetest' => { prio => 10, inc => 1, ver => 2, rel => 2, devel => 2 }, |
'smetest' => { prio => 11, inc => 1, ver => 2, rel => 2, devel => 2 }, |
31 |
'smedev' => { prio => 9, inc => 0, ver => 2, rel => 2, devel => 1 }, |
'smedev' => { prio => 10, inc => 0, ver => 2, rel => 2, devel => 1 }, |
32 |
'centos' => { prio => 8, inc => 0, ver => 0, rel => 0, base => 1 }, |
'centos' => { prio => 9, inc => 0, ver => 0, rel => 0, base => 1 }, |
33 |
'fedora/epel' => { prio => 7, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/epel' => { prio => 8, inc => 0, ver => 0, rel => 0, base => 1 }, |
34 |
'fedora/extras' => { prio => 6, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/extras' => { prio => 7, inc => 0, ver => 0, rel => 0, base => 1 }, |
35 |
'rpmforge' => { prio => 5, inc => 0, ver => 0, rel => 0, base => 1 }, |
'rpmforge' => { prio => 6, inc => 0, ver => 0, rel => 0, base => 1 }, |
36 |
'atrpms' => { prio => 4, inc => 0, ver => 0, rel => 0, base => 1 }, |
'atrpms' => { prio => 5, inc => 0, ver => 0, rel => 0, base => 1 }, |
37 |
'fedora/core' => { prio => 3, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/core' => { prio => 4, inc => 0, ver => 0, rel => 0, base => 1 }, |
38 |
'base' => { prio => 2, inc => 0, ver => 0, rel => 0, base => 1 }, |
'base' => { prio => 3, inc => 0, ver => 0, rel => 0, base => 1 }, |
39 |
'builds' => { prio => 1, inc => 0, ver => 0, rel => 0, builds => 1 }, |
'builds' => { prio => 2, inc => 0, ver => 0, rel => 0, builds => 1 }, |
40 |
|
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
41 |
}; |
}; |
42 |
|
|
43 |
my $distrepo = { '7' => { active => 1, |
my $distrepo = { '7' => { active => 1, |
45 |
fedora => 3, |
fedora => 3, |
46 |
repo => '/releases/7/', |
repo => '/releases/7/', |
47 |
os => 'SME/RPMS/', |
os => 'SME/RPMS/', |
48 |
builds => '/builds2/smeserver-7-core/', |
builds => '/builds/smeserver-7-core/', |
49 |
|
stage => '/stage/7/', |
50 |
}, |
}, |
51 |
'8' => { active => 1, |
'8' => { active => 1, |
52 |
centos => 5, |
centos => 5, |
53 |
fedora => 6, |
fedora => 6, |
54 |
repo => '/releases/testing/8/', |
repo => '/releases/testing/8/', |
55 |
os => 'SME/', |
os => 'SME/', |
56 |
builds => '/builds2/smeserver-8-core/', |
builds => '/builds/smeserver-8-core/', |
57 |
|
stage => '/stage/8/', |
58 |
}, |
}, |
59 |
}; |
}; |
60 |
|
|
88 |
|
|
89 |
my ($devel1, $devel2) = sort { $repos->{$a}->{devel} <=> $repos->{$b}->{devel} } grep { $repos->{$_}->{devel} } keys %$repos; |
my ($devel1, $devel2) = sort { $repos->{$a}->{devel} <=> $repos->{$b}->{devel} } grep { $repos->{$_}->{devel} } keys %$repos; |
90 |
$devel2 ||= $devel1; |
$devel2 ||= $devel1; |
91 |
|
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
92 |
|
|
93 |
my ($rel, @rpms, %pkgnames, %sources, $archs, $rebuild, $newline); |
my ($rel, @rpms, %latest, %sources, $archs, $rebuild, $newline); |
94 |
foreach my $smever ( sort { $a <=> $b } grep { $distrepo->{$_}->{active} } keys %$distrepo ) { |
foreach my $smever ( sort { $a <=> $b } grep { $distrepo->{$_}->{active} } keys %$distrepo ) { |
95 |
$rel = $smever; |
$rel = $smever; |
96 |
%pkgnames = (); |
%latest = (); |
97 |
%sources = (); |
%sources = (); |
98 |
@rpms = (); |
@rpms = (); |
99 |
$rebuild = (); |
$rebuild = (); |
100 |
|
|
101 |
# Load distro packages |
# Load distro packages |
102 |
find( { wanted => \&loadpkg, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{repo}, $distrepo->{$smever}->{builds} ); |
find( { wanted => \&loadpkg, no_chdir => 1, follow_fast => 1 }, map { $distrepo->{$smever}->{$_} } ('repo','builds','stage') ); |
103 |
printline('white', 0, "Distro (SME Server $rel) packages loaded.\n"); |
printline('white', 0, "Distro (SME Server $rel) packages loaded.\n"); |
104 |
|
|
105 |
# Load base packages |
# Load base packages |
119 |
} |
} |
120 |
printline('white', 0, 'Base (Centos: ', $distrepo->{$smever}->{centos}, ', Fedora: ', $distrepo->{$smever}->{fedora}, ") packages loaded.\n"); |
printline('white', 0, 'Base (Centos: ', $distrepo->{$smever}->{centos}, ', Fedora: ', $distrepo->{$smever}->{fedora}, ") packages loaded.\n"); |
121 |
|
|
122 |
|
%latest = (); |
123 |
foreach my $name ( sort keys %{{ map { $_->{base} => 1 } @rpms }} ) { |
foreach my $name ( sort keys %{{ map { $_->{base} => 1 } @rpms }} ) { |
124 |
printline('white', 0, "Processing: $name"); |
printline('white', 0, "Processing: $name"); |
125 |
my @pkgs = sort pkgsrt grep { $_->{base} eq $name } @rpms; |
my @pkgs = sort pkgsrt grep { $_->{base} eq $name } @rpms; |
128 |
$archs = (); |
$archs = (); |
129 |
|
|
130 |
foreach my $pkg ( @pkgs ) { |
foreach my $pkg ( @pkgs ) { |
131 |
next if $pkg->{done} || $pkg->{obsolete} || $pkg->{rpm}->is_source_package || ! $repos->{$pkg->{repo}}; |
next if $pkg->{done} || $pkg->{obsolete} || $pkg->{rpm}->is_source_package || ! $repos->{$pkg->{repo}} || rprop($pkg, 'stage'); |
132 |
printline('bold black', 1, ' - ', $pkg->{rpm}->filename) if $opts{d}; |
printline('bold black', 1, ' - ', $pkg->{rpm}->filename) if $opts{d}; |
133 |
my $orig = 0; |
my $orig = 0; |
134 |
|
|
140 |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
141 |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
142 |
if ( $pkg->{nonbase} ) { |
if ( $pkg->{nonbase} ) { |
143 |
foreach my $up ( grep { $_->{name} eq $pkg->{name} && $_->{rpm} lt $pkg->{rpm} && $_->{obsolete} } @rpms ) { |
foreach my $up ( @pkgs ) { |
144 |
next if rprop($up, 'builds') || rprop($up, 'base'); |
next if rprop($up, 'builds') || rprop($up, 'base'); |
145 |
|
next if $up->{name} ne $pkg->{name} || ! $up->{obsolete} || $up->{rpm} ge $pkg->{rpm}; |
146 |
$repo = $up->{repo}; |
$repo = $up->{repo}; |
147 |
last; |
last; |
148 |
} |
} |
173 |
if ( $cmp->{rpm}->is_source_package ) { |
if ( $cmp->{rpm}->is_source_package ) { |
174 |
if ( $cmp->{name} eq $pkg->{base} ) { |
if ( $cmp->{name} eq $pkg->{base} ) { |
175 |
if ( $cmp->{rpm} eq $pkg->{rpm} ) { |
if ( $cmp->{rpm} eq $pkg->{rpm} ) { |
176 |
$pkg->{srpm} = $cmp if ! $pkg->{srpm} || $pkg->{srpm}->{rpm} ne $pkg->{rpm} || $pkg->{srpm}->{repo} ne $pkg->{repo}; |
if ( $pkg->{repo} eq $cmp->{repo} || ! $pkg->{srpm} || $pkg->{srpm}->{rpm} ne $pkg->{rpm} ) { |
177 |
tagpkg($cmp, 'inuse', 0) if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
delete $pkg->{srpm}->{latest} if $pkg->{latest} && $pkg->{srpm} && $pkg->{srpm}->{latest}; |
178 |
|
$pkg->{srpm} = $cmp; |
179 |
|
$pkg->{srpm}->{latest}++ if $pkg->{latest}; |
180 |
|
} |
181 |
|
if ( $pkg->{latest} && rprop($cmp, 'stage') ) { |
182 |
|
tagpkg($cmp, 'inuse'); |
183 |
|
$pkg->{srpm}->{latest}++; |
184 |
|
} |
185 |
|
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
186 |
} |
} |
187 |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
188 |
|
|
202 |
$src = ''; |
$src = ''; |
203 |
} |
} |
204 |
if ( $src eq $source && ( ! $pkg->{srpm} || $pkg->{srpm}->{rpm} eq $cmp->{rpm} ) ) { |
if ( $src eq $source && ( ! $pkg->{srpm} || $pkg->{srpm}->{rpm} eq $cmp->{rpm} ) ) { |
205 |
$pkg->{srpm} = $cmp if ! $pkg->{srpm} || ( $pkg->{srpm}->{rpm} eq $pkg->{rpm} && $pkg->{srpm}->{repo} ne $pkg->{repo} ); |
if ( ! $pkg->{srpm} || $pkg->{repo} eq $cmp->{repo} ) { |
206 |
tagpkg($cmp, 'inuse', 0) if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
delete $pkg->{srpm}->{latest} if $pkg->{latest} && $pkg->{srpm} && $pkg->{srpm}->{latest}; |
207 |
|
$pkg->{srpm} = $cmp; |
208 |
|
$pkg->{srpm}->{latest}++ if $pkg->{latest}; |
209 |
|
} |
210 |
|
if ( $pkg->{latest} && rprop($cmp, 'stage') ) { |
211 |
|
tagpkg($cmp, 'inuse'); |
212 |
|
$pkg->{srpm}->{latest}++; |
213 |
|
} |
214 |
|
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
215 |
} |
} |
216 |
} |
} |
217 |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
219 |
if ( $pkg->{repo} eq $cmp->{repo} ) { |
if ( $pkg->{repo} eq $cmp->{repo} ) { |
220 |
tagpkg($cmp, 'correct', 1); |
tagpkg($cmp, 'correct', 1); |
221 |
$seen{$cmp->{nvra}}++; |
$seen{$cmp->{nvra}}++; |
222 |
|
} elsif ( $seen{$cmp->{nvra}} && rprop($cmp, 'stage') && $pkg->{latest} ) { |
223 |
|
$_->{latest}++ foreach grep { $_->{nvra} eq $cmp->{nvra} && $_->{latest} && $_->{done} } @pkgs; |
224 |
|
tagpkg($cmp, 'correct', 1); |
225 |
} elsif ( $seen{$cmp->{nvra}} ) { |
} elsif ( $seen{$cmp->{nvra}} ) { |
226 |
$orig++ if rprop($cmp, 'base') || rprop($cmp, 'builds'); |
$orig++ if rprop($cmp, 'base') || rprop($cmp, 'builds'); |
227 |
movepkg($cmp, 'delete', 1); |
movepkg($cmp, 'delete', 1); |
230 |
$seen{$cmp->{nvra}}++; |
$seen{$cmp->{nvra}}++; |
231 |
} |
} |
232 |
} else { |
} else { |
233 |
tagpkg($cmp, 'nonbase', 0); |
tagpkg($cmp, 'nonbase'); |
234 |
} |
} |
235 |
} elsif ( rprop($cmp, 'prio') < rprop($pkg, 'prio') ) { |
} elsif ( rprop($cmp, 'prio') < rprop($pkg, 'prio') ) { |
236 |
tagpkg($cmp, 'obsolete', 0); |
tagpkg($cmp, 'obsolete'); |
237 |
} |
} |
238 |
} |
} |
239 |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
248 |
} |
} |
249 |
} |
} |
250 |
} |
} |
251 |
|
printline('bold black', 1, ' - missing stage packages') if $opts{d}; |
252 |
|
movepkg($_, $stage, 0) foreach grep { $_->{latest} && $_->{latest} == 1 } @pkgs; |
253 |
|
|
254 |
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
255 |
movepkg($_, 'delete') foreach grep { ! rprop($_, 'base') && ! $_->{done} && ( $_->{obsolete} || ( $_->{rpm}->is_source_package && ! $_->{inuse} ) ) } @pkgs; |
movepkg($_, 'delete') foreach grep { ! rprop($_, 'base') && ! $_->{done} && ( $_->{obsolete} || ( $_->{rpm}->is_source_package && ! $_->{inuse} ) ) } @pkgs; |
256 |
|
|
280 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null) if $pkg->{nosig}; |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null) if $pkg->{nosig}; |
281 |
if ( $pkg->{repos} ) { |
if ( $pkg->{repos} ) { |
282 |
foreach my $dest ( dest($pkg, @{$pkg->{repos}}) ) { |
foreach my $dest ( dest($pkg, @{$pkg->{repos}}) ) { |
283 |
qx(cp --preserve=timestamps $src $dest) unless -f $dest; |
qx(cp --preserve=timestamps $src $dest) unless -f "$dest"; |
284 |
} |
} |
285 |
$repochg{$_}++ foreach @{$pkg->{repos}}; |
$repochg{$_}++ foreach @{$pkg->{repos}}; |
286 |
} |
} |
313 |
} |
} |
314 |
|
|
315 |
sub pkgsrt { |
sub pkgsrt { |
316 |
return $b->{rpm} cmp $a->{rpm} || rprop($b, 'prio') <=> rprop($a, 'prio') || $a->{arch} cmp $b->{arch} || $a->{name} cmp $b->{name}; |
return $a->{rpm}->is_source_package <=> $b->{rpm}->is_source_package || $b->{rpm} cmp $a->{rpm} || rprop($b, 'prio') <=> rprop($a, 'prio'); |
317 |
} |
} |
318 |
|
|
319 |
sub rprop { |
sub rprop { |
336 |
my ($pkg, @repos) = @_; |
my ($pkg, @repos) = @_; |
337 |
my @d = (); |
my @d = (); |
338 |
foreach my $repo ( @repos ) { |
foreach my $repo ( @repos ) { |
339 |
|
my $base = $distrepo->{$rel}->{repo}; |
340 |
|
$base = $distrepo->{$rel}->{stage} if $repos->{$repo}->{stage}; |
341 |
if ( $pkg->{arch} eq 'noarch' ) { |
if ( $pkg->{arch} eq 'noarch' ) { |
342 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base$repo/i386/" . |
|
"$repo/i386/" . |
|
343 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
344 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
345 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base$repo/x86_64/" . |
|
"$repo/x86_64/" . |
|
346 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
347 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
348 |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
349 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base$repo/i386/" . |
|
"$repo/i386/" . |
|
350 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
351 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
352 |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
353 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base$repo/x86_64/" . |
|
"$repo/x86_64/" . |
|
354 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
355 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
356 |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
357 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base$repo/SRPMS/" . |
|
"$repo/SRPMS/" . |
|
358 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
359 |
} else { |
} else { |
360 |
printline('bold yellow on_red', 1, ' - ', $pkg->{rpm}->filename, ' (bad arch: ', $pkg->{arch}, ')'); |
printline('bold yellow on_red', 1, ' - ', $pkg->{rpm}->filename, ' (bad arch: ', $pkg->{arch}, ')'); |
389 |
|
|
390 |
sub tagpkg { |
sub tagpkg { |
391 |
my ($pkg, $tag, $done) = @_; |
my ($pkg, $tag, $done) = @_; |
392 |
|
defined $done or $done = 0; |
393 |
|
|
394 |
printline('bold magenta', 1, " - ($tag) ", $pkg->{rpm}->filename) if $opts{d}; |
printline('bold magenta', 1, " - ($tag) ", $pkg->{rpm}->filename) if $opts{d}; |
395 |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
404 |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
405 |
|
|
406 |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'base') && ! rprop($pkg, 'builds') ) { |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'base') && ! rprop($pkg, 'builds') ) { |
407 |
|
# FIXME: Nasty hack for comps package |
408 |
|
if ( $pkg->{name} eq 'comps' ) { |
409 |
|
if ( ! $latest{$pkg->{name}.'.'.$pkg->{arch}} || $latest{$pkg->{name}.'.'.$pkg->{arch}}->{rpm} eq $pkg->{rpm} ) { |
410 |
|
if ( rprop($pkg, 'inc') && ! $pkg->{rpm}->is_source_package ) { |
411 |
|
$latest{$pkg->{name}.'.'.$pkg->{arch}} = $pkg if ! $latest{$pkg->{name}.'.'.$pkg->{arch}}; |
412 |
|
$pkg->{latest}++; |
413 |
|
} |
414 |
|
} |
415 |
|
} elsif ( ! $latest{$pkg->{name}} || $latest{$pkg->{name}}->{rpm} eq $pkg->{rpm} ) { |
416 |
|
if ( rprop($pkg, 'inc') && ! $pkg->{rpm}->is_source_package ) { |
417 |
|
$latest{$pkg->{name}} = $pkg if ! $latest{$pkg->{name}}; |
418 |
|
$pkg->{latest}++; |
419 |
|
} |
420 |
|
} |
421 |
unless ( $pkg->{oldrepo} ) { |
unless ( $pkg->{oldrepo} ) { |
422 |
my $goodarch = 0; |
my $goodarch = 0; |
423 |
$goodarch++ if $pkg->{rpm}->filename =~ m{/(i386|x86_64)/.*\.noarch\.rpm$}; |
$goodarch++ if $pkg->{rpm}->filename =~ m{/(i386|x86_64)/.*\.noarch\.rpm$}; |
463 |
|
|
464 |
my ($srcname, $version, $release) = ($pkg->is_source_package ? basename $pkg->filename : $pkg->sourcerpm) =~ m{^([^/]*)-([^-]+)-([^-]+)\.\w+.rpm}; |
my ($srcname, $version, $release) = ($pkg->is_source_package ? basename $pkg->filename : $pkg->sourcerpm) =~ m{^([^/]*)-([^-]+)-([^-]+)\.\w+.rpm}; |
465 |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { return if (dirname $pkg->filename) =~ m{/$repo/} && grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; } |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { return if (dirname $pkg->filename) =~ m{/$repo/} && grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; } |
466 |
(my $reponame = dirname $pkg->filename) =~ s{^.*\d/(sme[^/]+)/.*$}{$1}; |
my $reponame = 'unknown'; |
467 |
$reponame = 'builds' if ( dirname $pkg->filename) =~ m{/smeserver-\d+-core/}; |
if ( substr($_, 0, length($distrepo->{$rel}->{builds})) eq $distrepo->{$rel}->{builds} ) { |
468 |
|
$reponame = 'builds'; |
469 |
|
} elsif ( substr($_, 0, length($distrepo->{$rel}->{stage})) eq $distrepo->{$rel}->{stage} ) { |
470 |
|
$reponame = 'stage'; |
471 |
|
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
472 |
|
$reponame = $1; |
473 |
|
} |
474 |
|
|
475 |
push @rpms, { base => $srcname, |
push @rpms, { base => $srcname, |
476 |
name => $pkg->name, |
name => $pkg->name, |
477 |
repo => $reponame, |
repo => $reponame, |
478 |
nvra => $pkg->as_nvre . '.' . ( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
479 |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
480 |
version => $version, |
version => $version, |
481 |
release => $release, |
release => $release, |
483 |
nosig => $nosig, |
nosig => $nosig, |
484 |
}; |
}; |
485 |
$sources{$srcname}++; |
$sources{$srcname}++; |
486 |
$pkgnames{$pkg->name} = $rpms[$#rpms] if ! $pkg->is_source_package && ( ! $pkgnames{$pkg->name} || $pkg gt $pkgnames{$pkg->name}->{rpm} ); |
$latest{$pkg->name} = $rpms[$#rpms] if ! $pkg->is_source_package && ( ! $latest{$pkg->name} || $pkg gt $latest{$pkg->name}->{rpm} ); |
487 |
} |
} |
488 |
|
|
489 |
sub loadbase { |
sub loadbase { |
490 |
printline('white', 0, "Loading: $_") if -d _; |
printline('white', 0, "Loading: $_") if -d _; |
491 |
return unless m{/([^/]*)-[^-]+-[^-]+\.\w+.rpm} && ($pkgnames{$1} || $sources{$1}); |
return unless m{/([^/]*)-[^-]+-[^-]+\.\w+.rpm} && ($latest{$1} || $sources{$1}); |
492 |
|
|
493 |
my $pkg; |
my $pkg; |
494 |
eval { $pkg = RPM2->open_package($_, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($_, $rpm_flags); }; |
496 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
497 |
unless ($@) { printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); return; } |
unless ($@) { printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); return; } |
498 |
|
|
499 |
my $cmp = $pkgnames{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
500 |
my ($srcname, $version, $release) = ($pkg->is_source_package ? basename $pkg->filename : $pkg->sourcerpm) =~ m{^([^/]*)-([^-]+)-([^-]+)\.\w+.rpm}; |
my ($srcname, $version, $release) = ($pkg->is_source_package ? basename $pkg->filename : $pkg->sourcerpm) =~ m{^([^/]*)-([^-]+)-([^-]+)\.\w+.rpm}; |
501 |
my $pkgrepo = 'base'; |
my $pkgrepo = 'base'; |
502 |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { |
512 |
push @rpms, { base => $srcname, |
push @rpms, { base => $srcname, |
513 |
name => $pkg->name, |
name => $pkg->name, |
514 |
repo => $pkgrepo, |
repo => $pkgrepo, |
515 |
nvra => $pkg->as_nvre . '.' . ( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
516 |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
517 |
version => $version, |
version => $version, |
518 |
release => $release, |
release => $release, |
520 |
nosig => 0, |
nosig => 0, |
521 |
}; |
}; |
522 |
if ( ! $pkg->is_source_package && $pkg ge $cmp->{rpm} && ( $repos->{$pkgrepo}->{prio} >= rprop($cmp, 'prio') || ! rprop($cmp, 'base') ) ) { |
if ( ! $pkg->is_source_package && $pkg ge $cmp->{rpm} && ( $repos->{$pkgrepo}->{prio} >= rprop($cmp, 'prio') || ! rprop($cmp, 'base') ) ) { |
523 |
$pkgnames{$pkg->name} = $rpms[$#rpms]; |
$latest{$pkg->name} = $rpms[$#rpms]; |
524 |
} |
} |
525 |
} |
} |
526 |
|
|