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}} || rprop($pkg, 'stage'); |
next if $pkg->{done} || $pkg->{obsolete} || $pkg->{rpm}->is_source_package || ! $repos->{$pkg->{repo}}; |
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 |
|
|
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 |
|
printline('dark blue', 1, ' - checking stage') if $opts{d}; |
141 |
|
tagpkg($pkg, 'obsolete'); |
142 |
|
next; |
143 |
|
} |
144 |
|
|
145 |
# Move packages from base/builds to correct area |
# Move packages from base/builds to correct area |
146 |
if ( rprop($pkg, 'base') || rprop($pkg, 'builds') ) { |
elsif ( rprop($pkg, 'base') || rprop($pkg, 'builds') ) { |
147 |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
148 |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
149 |
if ( $pkg->{nonbase} ) { |
if ( $pkg->{nonbase} ) { |
189 |
tagpkg($cmp, 'inuse'); |
tagpkg($cmp, 'inuse'); |
190 |
$pkg->{srpm}->{latest}++; |
$pkg->{srpm}->{latest}++; |
191 |
} |
} |
192 |
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
if ( $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds') || ( $cmp->{oldrepo} && $pkg->{repo} eq $cmp->{oldrepo} ) ) { |
193 |
|
tagpkg($cmp, 'inuse') |
194 |
|
} |
195 |
} |
} |
196 |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
next if $pkg->{srpm} && $pkg->{srpm}->{rpm} eq $pkg->{rpm}; |
197 |
|
|
248 |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
printline('dark blue', 1, ' - checking source packages') if $opts{d}; |
249 |
if ( ! $pkg->{srpm} ) { |
if ( ! $pkg->{srpm} ) { |
250 |
printline('bold yellow on_red', 1, ' - ', $pkg->{rpm}->filename, ' (missing source ', $pkg->{rpm}->sourcerpm, ')'); |
printline('bold yellow on_red', 1, ' - ', $pkg->{rpm}->filename, ' (missing source ', $pkg->{rpm}->sourcerpm, ')'); |
251 |
} elsif ( $pkg->{srpm}->{repo} ne $pkg->{repo} ) { |
} elsif ( $pkg->{srpm}->{repo} ne $pkg->{repo} && ( ! $pkg->{srpm}->{oldrepo} || $pkg->{srpm}->{oldrepo} ne $pkg->{repo} ) ) { |
252 |
movepkg($pkg->{srpm}, $pkg->{repo}, 0); |
movepkg($pkg->{srpm}, $pkg->{repo}, 0); |
253 |
} |
} |
254 |
unless ( $orig ) { |
unless ( $orig ) { |
257 |
} |
} |
258 |
} |
} |
259 |
} |
} |
|
printline('bold black', 1, ' - missing stage packages') if $opts{d}; |
|
|
movepkg($_, $stage, 0) foreach grep { $_->{latest} && $_->{latest} == 1 } @pkgs; |
|
|
|
|
|
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
|
|
movepkg($_, 'delete') foreach grep { ! rprop($_, 'base') && ! $_->{done} && ( $_->{obsolete} || ( $_->{rpm}->is_source_package && ! $_->{inuse} ) ) } @pkgs; |
|
|
|
|
260 |
printline('bold black', 1, ' - arch count check') if $opts{d}; |
printline('bold black', 1, ' - arch count check') if $opts{d}; |
261 |
foreach my $r ( keys %$archs ) { |
foreach my $r ( keys %$archs ) { |
262 |
foreach my $p ( keys %{$archs->{$r}} ) { |
foreach my $p ( keys %{$archs->{$r}} ) { |
270 |
} |
} |
271 |
} |
} |
272 |
} |
} |
273 |
|
|
274 |
|
printline('bold black', 1, ' - missing stage packages') if $opts{d}; |
275 |
|
movepkg($_, $stage, 0) foreach grep { $_->{latest} && $_->{latest} == 1 } @pkgs; |
276 |
|
|
277 |
|
printline('bold black', 1, ' - obsolete packages') if $opts{d}; |
278 |
|
movepkg($_, 'delete') foreach grep { ! rprop($_, 'base') && ! $_->{done} && ( $_->{obsolete} || ( $_->{rpm}->is_source_package && ! $_->{inuse} ) ) } @pkgs; |
279 |
} |
} |
280 |
printline('white', 0, "Finished processing.\n"); |
printline('white', 0, "Finished processing.\n"); |
281 |
|
|
302 |
printline('white', 0, "Finished copying/moving.\n"); |
printline('white', 0, "Finished copying/moving.\n"); |
303 |
|
|
304 |
foreach my $repo ( sort keys %repochg ) { |
foreach my $repo ( sort keys %repochg ) { |
305 |
next if ! $repos->{$repo} || $repos->{$repo}->{base} || $repos->{$repo}->{builds}; |
next if ! $repos->{$repo} || $repos->{$repo}->{base} || $repos->{$repo}->{builds} || $repos->{$repo}->{stage}; |
306 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
307 |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
308 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
345 |
my ($pkg, @repos) = @_; |
my ($pkg, @repos) = @_; |
346 |
my @d = (); |
my @d = (); |
347 |
foreach my $repo ( @repos ) { |
foreach my $repo ( @repos ) { |
348 |
my $base = $distrepo->{$rel}->{repo}; |
my $base = $distrepo->{$rel}->{repo} . $repo; |
349 |
$base = $distrepo->{$rel}->{stage} if $repos->{$repo}->{stage}; |
$base = $distrepo->{$rel}->{stage} if $repos->{$repo}->{stage}; |
350 |
if ( $pkg->{arch} eq 'noarch' ) { |
if ( $pkg->{arch} eq 'noarch' ) { |
351 |
push @d, "$base$repo/i386/" . |
push @d, "$base/i386/" . |
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 |
push @d, "$base$repo/x86_64/" . |
push @d, "$base/x86_64/" . |
355 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
356 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
357 |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
} elsif ( $pkg->{arch} =~ m{^(i[356]86)$} ) { |
358 |
push @d, "$base$repo/i386/" . |
push @d, "$base/i386/" . |
359 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
360 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
361 |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
} elsif ( $pkg->{arch} eq 'x86_64' ) { |
362 |
push @d, "$base$repo/x86_64/" . |
push @d, "$base/x86_64/" . |
363 |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
( $repos->{$repo}->{os} ? $distrepo->{$rel}->{os} : 'RPMS/' ) . |
364 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
365 |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
} elsif ( $pkg->{arch} eq 'zsrc' ) { |
366 |
push @d, "$base$repo/SRPMS/" . |
push @d, "$base/SRPMS/" . |
367 |
basename $pkg->{rpm}->filename; |
basename $pkg->{rpm}->filename; |
368 |
} else { |
} else { |
369 |
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}, ')'); |
465 |
if ($@) { printline('bold yellow on_red', 1, "Corrupt package $_"); return; } |
if ($@) { printline('bold yellow on_red', 1, "Corrupt package $_"); return; } |
466 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
467 |
my $nosig = ! $@; |
my $nosig = ! $@; |
|
if ( $nosig && ! -f "$HOME/.rpmpass" ) { |
|
|
printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); |
|
|
return; |
|
|
} |
|
468 |
|
|
469 |
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}; |
470 |
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}}; } |
476 |
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
477 |
$reponame = $1; |
$reponame = $1; |
478 |
} |
} |
479 |
|
if ( $nosig && ( ! -f "$HOME/.rpmpass" || $reponame eq 'builds' ) ) { |
480 |
|
printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); |
481 |
|
return; |
482 |
|
} |
483 |
push @rpms, { base => $srcname, |
push @rpms, { base => $srcname, |
484 |
name => $pkg->name, |
name => $pkg->name, |
485 |
repo => $reponame, |
repo => $reponame, |
491 |
nosig => $nosig, |
nosig => $nosig, |
492 |
}; |
}; |
493 |
$sources{$srcname}++; |
$sources{$srcname}++; |
494 |
$latest{$pkg->name} = $rpms[$#rpms] if ! $pkg->is_source_package && ( ! $latest{$pkg->name} || $pkg gt $latest{$pkg->name}->{rpm} ); |
if ( ! $pkg->is_source_package && ! $repos->{$reponame}->{stage} ) { |
495 |
|
$latest{$pkg->name} = $rpms[$#rpms] if ! $latest{$pkg->name} || $pkg gt $latest{$pkg->name}->{rpm}; |
496 |
|
} |
497 |
} |
} |
498 |
|
|
499 |
sub loadbase { |
sub loadbase { |
514 |
return if grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; |
return if grep { $_ eq $srcname } @{$skippkg->{$rel}->{$repo}}; |
515 |
$pkgrepo = $repo; |
$pkgrepo = $repo; |
516 |
return unless $pkg->is_source_package || $cmp; |
return unless $pkg->is_source_package || $cmp; |
517 |
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}; |
518 |
last; |
last; |
519 |
} |
} |
520 |
} |
} |