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; |
135 |
# Find names of packages in same or higher repos |
# Find names of packages in same or higher repos |
136 |
my %names = names($pkg, @pkgs); |
my %names = names($pkg, @pkgs); |
137 |
|
|
138 |
|
# Stage packages should never be most current |
139 |
|
if ( rprop($pkg, 'stage') ) { |
140 |
|
tagpkg($pkg, 'obsolete'); |
141 |
|
next; |
142 |
|
} |
143 |
|
|
144 |
# Move packages from base/builds to correct area |
# Move packages from base/builds to correct area |
145 |
if ( rprop($pkg, 'base') || rprop($pkg, 'builds') ) { |
elsif ( rprop($pkg, 'base') || rprop($pkg, 'builds') ) { |
146 |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
147 |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
148 |
if ( $pkg->{nonbase} ) { |
if ( $pkg->{nonbase} ) { |
149 |
foreach my $up ( grep { $_->{name} eq $pkg->{name} && $_->{rpm} lt $pkg->{rpm} && $_->{obsolete} } @rpms ) { |
foreach my $up ( @pkgs ) { |
150 |
next if rprop($up, 'builds') || rprop($up, 'base'); |
next if rprop($up, 'builds') || rprop($up, 'base'); |
151 |
|
next if $up->{name} ne $pkg->{name} || ! $up->{obsolete} || $up->{rpm} ge $pkg->{rpm}; |
152 |
$repo = $up->{repo}; |
$repo = $up->{repo}; |
153 |
last; |
last; |
154 |
} |
} |
179 |
if ( $cmp->{rpm}->is_source_package ) { |
if ( $cmp->{rpm}->is_source_package ) { |
180 |
if ( $cmp->{name} eq $pkg->{base} ) { |
if ( $cmp->{name} eq $pkg->{base} ) { |
181 |
if ( $cmp->{rpm} eq $pkg->{rpm} ) { |
if ( $cmp->{rpm} eq $pkg->{rpm} ) { |
182 |
$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} ) { |
183 |
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}; |
184 |
|
$pkg->{srpm} = $cmp; |
185 |
|
$pkg->{srpm}->{latest}++ if $pkg->{latest}; |
186 |
|
} |
187 |
|
if ( $pkg->{latest} && rprop($cmp, 'stage') ) { |
188 |
|
tagpkg($cmp, 'inuse'); |
189 |
|
$pkg->{srpm}->{latest}++; |
190 |
|
} |
191 |
|
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
192 |
} |
} |
193 |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
194 |
|
|
208 |
$src = ''; |
$src = ''; |
209 |
} |
} |
210 |
if ( $src eq $source && ( ! $pkg->{srpm} || $pkg->{srpm}->{rpm} eq $cmp->{rpm} ) ) { |
if ( $src eq $source && ( ! $pkg->{srpm} || $pkg->{srpm}->{rpm} eq $cmp->{rpm} ) ) { |
211 |
$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} ) { |
212 |
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}; |
213 |
|
$pkg->{srpm} = $cmp; |
214 |
|
$pkg->{srpm}->{latest}++ if $pkg->{latest}; |
215 |
|
} |
216 |
|
if ( $pkg->{latest} && rprop($cmp, 'stage') ) { |
217 |
|
tagpkg($cmp, 'inuse'); |
218 |
|
$pkg->{srpm}->{latest}++; |
219 |
|
} |
220 |
|
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
221 |
} |
} |
222 |
} |
} |
223 |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
225 |
if ( $pkg->{repo} eq $cmp->{repo} ) { |
if ( $pkg->{repo} eq $cmp->{repo} ) { |
226 |
tagpkg($cmp, 'correct', 1); |
tagpkg($cmp, 'correct', 1); |
227 |
$seen{$cmp->{nvra}}++; |
$seen{$cmp->{nvra}}++; |
228 |
|
} elsif ( $seen{$cmp->{nvra}} && rprop($cmp, 'stage') && $pkg->{latest} ) { |
229 |
|
$_->{latest}++ foreach grep { $_->{nvra} eq $cmp->{nvra} && $_->{latest} && $_->{done} } @pkgs; |
230 |
|
tagpkg($cmp, 'correct', 1); |
231 |
} elsif ( $seen{$cmp->{nvra}} ) { |
} elsif ( $seen{$cmp->{nvra}} ) { |
232 |
$orig++ if rprop($cmp, 'base') || rprop($cmp, 'builds'); |
$orig++ if rprop($cmp, 'base') || rprop($cmp, 'builds'); |
233 |
movepkg($cmp, 'delete', 1); |
movepkg($cmp, 'delete', 1); |
236 |
$seen{$cmp->{nvra}}++; |
$seen{$cmp->{nvra}}++; |
237 |
} |
} |
238 |
} else { |
} else { |
239 |
tagpkg($cmp, 'nonbase', 0); |
tagpkg($cmp, 'nonbase'); |
240 |
} |
} |
241 |
} elsif ( rprop($cmp, 'prio') < rprop($pkg, 'prio') ) { |
} elsif ( rprop($cmp, 'prio') < rprop($pkg, 'prio') ) { |
242 |
tagpkg($cmp, 'obsolete', 0); |
tagpkg($cmp, 'obsolete'); |
243 |
} |
} |
244 |
} |
} |
245 |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
254 |
} |
} |
255 |
} |
} |
256 |
} |
} |
257 |
|
printline('bold black', 1, ' - missing stage packages') if $opts{d}; |
258 |
|
movepkg($_, $stage, 0) foreach grep { $_->{latest} && $_->{latest} == 1 } @pkgs; |
259 |
|
|
260 |
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
261 |
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; |
262 |
|
|
286 |
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}; |
287 |
if ( $pkg->{repos} ) { |
if ( $pkg->{repos} ) { |
288 |
foreach my $dest ( dest($pkg, @{$pkg->{repos}}) ) { |
foreach my $dest ( dest($pkg, @{$pkg->{repos}}) ) { |
289 |
qx(cp --preserve=timestamps $src $dest) unless -f $dest; |
qx(cp --preserve=timestamps $src $dest) unless -f "$dest"; |
290 |
} |
} |
291 |
$repochg{$_}++ foreach @{$pkg->{repos}}; |
$repochg{$_}++ foreach @{$pkg->{repos}}; |
292 |
} |
} |
299 |
printline('white', 0, "Finished copying/moving.\n"); |
printline('white', 0, "Finished copying/moving.\n"); |
300 |
|
|
301 |
foreach my $repo ( sort keys %repochg ) { |
foreach my $repo ( sort keys %repochg ) { |
302 |
next if ! $repos->{$repo} || $repos->{$repo}->{base} || $repos->{$repo}->{builds}; |
next if ! $repos->{$repo} || $repos->{$repo}->{base} || $repos->{$repo}->{builds} || $repos->{$repo}->{stage}; |
303 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
304 |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
305 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
319 |
} |
} |
320 |
|
|
321 |
sub pkgsrt { |
sub pkgsrt { |
322 |
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'); |
323 |
} |
} |
324 |
|
|
325 |
sub rprop { |
sub rprop { |
342 |
my ($pkg, @repos) = @_; |
my ($pkg, @repos) = @_; |
343 |
my @d = (); |
my @d = (); |
344 |
foreach my $repo ( @repos ) { |
foreach my $repo ( @repos ) { |
345 |
|
my $base = $distrepo->{$rel}->{repo} . $repo; |
346 |
|
$base = $distrepo->{$rel}->{stage} if $repos->{$repo}->{stage}; |
347 |
if ( $pkg->{arch} eq 'noarch' ) { |
if ( $pkg->{arch} eq 'noarch' ) { |
348 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base/i386/" . |
|
"$repo/i386/" . |
|
349 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
350 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
351 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base/x86_64/" . |
|
"$repo/x86_64/" . |
|
352 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
353 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
354 |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
355 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base/i386/" . |
|
"$repo/i386/" . |
|
356 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
357 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
358 |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
359 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base/x86_64/" . |
|
"$repo/x86_64/" . |
|
360 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
361 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
362 |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
363 |
push @d, $distrepo->{$rel}->{repo} . |
push @d, "$base/SRPMS/" . |
|
"$repo/SRPMS/" . |
|
364 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
365 |
} else { |
} else { |
366 |
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}, ')'); |
395 |
|
|
396 |
sub tagpkg { |
sub tagpkg { |
397 |
my ($pkg, $tag, $done) = @_; |
my ($pkg, $tag, $done) = @_; |
398 |
|
defined $done or $done = 0; |
399 |
|
|
400 |
printline('bold magenta', 1, " - ($tag) ", $pkg->{rpm}->filename) if $opts{d}; |
printline('bold magenta', 1, " - ($tag) ", $pkg->{rpm}->filename) if $opts{d}; |
401 |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
410 |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
411 |
|
|
412 |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'base') && ! rprop($pkg, 'builds') ) { |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'base') && ! rprop($pkg, 'builds') ) { |
413 |
|
# FIXME: Nasty hack for comps package |
414 |
|
if ( $pkg->{name} eq 'comps' ) { |
415 |
|
if ( ! $latest{$pkg->{name}.'.'.$pkg->{arch}} || $latest{$pkg->{name}.'.'.$pkg->{arch}}->{rpm} eq $pkg->{rpm} ) { |
416 |
|
if ( rprop($pkg, 'inc') && ! $pkg->{rpm}->is_source_package ) { |
417 |
|
$latest{$pkg->{name}.'.'.$pkg->{arch}} = $pkg if ! $latest{$pkg->{name}.'.'.$pkg->{arch}}; |
418 |
|
$pkg->{latest}++; |
419 |
|
} |
420 |
|
} |
421 |
|
} elsif ( ! $latest{$pkg->{name}} || $latest{$pkg->{name}}->{rpm} eq $pkg->{rpm} ) { |
422 |
|
if ( rprop($pkg, 'inc') && ! $pkg->{rpm}->is_source_package ) { |
423 |
|
$latest{$pkg->{name}} = $pkg if ! $latest{$pkg->{name}}; |
424 |
|
$pkg->{latest}++; |
425 |
|
} |
426 |
|
} |
427 |
unless ( $pkg->{oldrepo} ) { |
unless ( $pkg->{oldrepo} ) { |
428 |
my $goodarch = 0; |
my $goodarch = 0; |
429 |
$goodarch++ if $pkg->{rpm}->filename =~ m{/(i386|x86_64)/.*\.noarch\.rpm$}; |
$goodarch++ if $pkg->{rpm}->filename =~ m{/(i386|x86_64)/.*\.noarch\.rpm$}; |
469 |
|
|
470 |
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}; |
471 |
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}}; } |
472 |
(my $reponame = dirname $pkg->filename) =~ s{^.*\d/(sme[^/]+)/.*$}{$1}; |
my $reponame = 'unknown'; |
473 |
$reponame = 'builds' if ( dirname $pkg->filename) =~ m{/smeserver-\d+-core/}; |
if ( substr($_, 0, length($distrepo->{$rel}->{builds})) eq $distrepo->{$rel}->{builds} ) { |
474 |
|
$reponame = 'builds'; |
475 |
|
} elsif ( substr($_, 0, length($distrepo->{$rel}->{stage})) eq $distrepo->{$rel}->{stage} ) { |
476 |
|
$reponame = 'stage'; |
477 |
|
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
478 |
|
$reponame = $1; |
479 |
|
} |
480 |
|
|
481 |
push @rpms, { base => $srcname, |
push @rpms, { base => $srcname, |
482 |
name => $pkg->name, |
name => $pkg->name, |
483 |
repo => $reponame, |
repo => $reponame, |
484 |
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') ), |
485 |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
486 |
version => $version, |
version => $version, |
487 |
release => $release, |
release => $release, |
489 |
nosig => $nosig, |
nosig => $nosig, |
490 |
}; |
}; |
491 |
$sources{$srcname}++; |
$sources{$srcname}++; |
492 |
$pkgnames{$pkg->name} = $rpms[$#rpms] if ! $pkg->is_source_package && ( ! $pkgnames{$pkg->name} || $pkg gt $pkgnames{$pkg->name}->{rpm} ); |
if ( ! $pkg->is_source_package && ! $repos->{$reponame}->{stage} ) { |
493 |
|
$latest{$pkg->name} = $rpms[$#rpms] if ! $latest{$pkg->name} || $pkg gt $latest{$pkg->name}->{rpm}; |
494 |
|
} |
495 |
} |
} |
496 |
|
|
497 |
sub loadbase { |
sub loadbase { |
498 |
printline('white', 0, "Loading: $_") if -d _; |
printline('white', 0, "Loading: $_") if -d _; |
499 |
return unless m{/([^/]*)-[^-]+-[^-]+\.\w+.rpm} && ($pkgnames{$1} || $sources{$1}); |
return unless m{/([^/]*)-[^-]+-[^-]+\.\w+.rpm} && ($latest{$1} || $sources{$1}); |
500 |
|
|
501 |
my $pkg; |
my $pkg; |
502 |
eval { $pkg = RPM2->open_package($_, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($_, $rpm_flags); }; |
504 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
505 |
unless ($@) { printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); return; } |
unless ($@) { printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); return; } |
506 |
|
|
507 |
my $cmp = $pkgnames{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
508 |
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}; |
509 |
my $pkgrepo = 'base'; |
my $pkgrepo = 'base'; |
510 |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { |
foreach my $repo ( keys %{$skippkg->{$rel}} ) { |
512 |
return if grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; |
return if grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; |
513 |
$pkgrepo = $repo; |
$pkgrepo = $repo; |
514 |
return unless $pkg->is_source_package || $cmp; |
return unless $pkg->is_source_package || $cmp; |
515 |
return if ! $pkg->is_source_package && $pkg gt $cmp->{rpm} && rprop($cmp, 'base') && rprop($cmp, 'prio') > $repos->{$pkgrepo}->{prio}; |
return if ! $pkg->is_source_package && $pkg ge $cmp->{rpm} && rprop($cmp, 'base') && rprop($cmp, 'prio') > $repos->{$pkgrepo}->{prio}; |
516 |
last; |
last; |
517 |
} |
} |
518 |
} |
} |
520 |
push @rpms, { base => $srcname, |
push @rpms, { base => $srcname, |
521 |
name => $pkg->name, |
name => $pkg->name, |
522 |
repo => $pkgrepo, |
repo => $pkgrepo, |
523 |
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') ), |
524 |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
arch => $pkg->is_source_package ? 'zsrc' : $pkg->tag('ARCH'), |
525 |
version => $version, |
version => $version, |
526 |
release => $release, |
release => $release, |
528 |
nosig => 0, |
nosig => 0, |
529 |
}; |
}; |
530 |
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') ) ) { |
531 |
$pkgnames{$pkg->name} = $rpms[$#rpms]; |
$latest{$pkg->name} = $rpms[$#rpms]; |
532 |
} |
} |
533 |
} |
} |
534 |
|
|