21 |
|
|
22 |
my @archs = ( 'i386', 'x86_64' ); |
my @archs = ( 'i386', 'x86_64' ); |
23 |
|
|
24 |
my $repos = { 'smeos' => { prio => 17, inc => 1, ver => 1, rel => 1, os => 1 }, |
my $repos = { 'smeos' => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
25 |
'smeupdates' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
'smeupdates' => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
26 |
'smeupdates-testing' => { prio => 15, inc => 1, ver => 1, rel => 1 }, |
'smeupdates-testing' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
27 |
'smeextras' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
'smeextras' => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
28 |
'smeaddons' => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
'smeaddons' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
29 |
'smecontribs' => { prio => 12, inc => 0, ver => 1, rel => 1 }, |
'smecontribs' => { prio => 13, inc => 0, ver => 1, rel => 1, contribs => 1 }, |
30 |
'smetest' => { prio => 11, inc => 1, ver => 2, rel => 2, devel => 2 }, |
'smetest' => { prio => 12, inc => 1, ver => 2, rel => 2, devel => 2 }, |
31 |
'smedev' => { prio => 10, inc => 0, ver => 2, rel => 2, devel => 1 }, |
'smedev' => { prio => 11, inc => 0, ver => 2, rel => 2, devel => 1 }, |
32 |
'centos' => { prio => 9, inc => 0, ver => 0, rel => 0, base => 1 }, |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
33 |
'fedora/epel' => { prio => 8, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
34 |
'fedora/extras' => { prio => 7, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/extras' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
35 |
'rpmforge' => { prio => 6, inc => 0, ver => 0, rel => 0, base => 1 }, |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
36 |
'atrpms' => { prio => 5, inc => 0, ver => 0, rel => 0, base => 1 }, |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
37 |
'fedora/core' => { prio => 4, inc => 0, ver => 0, rel => 0, base => 1 }, |
'fedora/core' => { prio => 5, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
38 |
'base' => { prio => 3, inc => 0, ver => 0, rel => 0, base => 1 }, |
'base' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
39 |
'builds' => { prio => 2, inc => 0, ver => 0, rel => 0, builds => 1 }, |
'builds' => { prio => 3, inc => 0, ver => 0, rel => 0, orig => 1 }, |
40 |
|
'contribs' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
41 |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
42 |
}; |
}; |
43 |
|
|
44 |
my $distrepo = { '7' => { active => 1, |
my $distrepo = { '7' => { active => 1, |
45 |
centos => 4, |
centos => 4, |
46 |
fedora => 3, |
fedora => 3, |
47 |
repo => '/releases/7/', |
repo => '/releases/7/', |
48 |
os => 'SME/RPMS/', |
os => 'SME/RPMS/', |
49 |
builds => '/builds/smeserver-7-core/', |
builds => '/builds/smeserver-7-core/', |
50 |
stage => '/stage/7/', |
contribs => '/builds/smeserver-7-contribs/', |
51 |
|
stage => '/stage/7/', |
52 |
}, |
}, |
53 |
'8' => { active => 1, |
'8' => { active => 1, |
54 |
centos => 5, |
centos => 5, |
55 |
fedora => 6, |
fedora => 6, |
56 |
repo => '/releases/testing/8/', |
repo => '/releases/testing/8/', |
57 |
os => 'SME/', |
os => 'SME/', |
58 |
builds => '/builds/smeserver-8-core/', |
builds => '/builds/smeserver-8-core/', |
59 |
stage => '/stage/8/', |
contribs => '/builds/smeserver-8-contribs/', |
60 |
|
stage => '/stage/8/', |
61 |
}, |
}, |
62 |
}; |
}; |
63 |
|
|
91 |
|
|
92 |
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; |
93 |
$devel2 ||= $devel1; |
$devel2 ||= $devel1; |
94 |
|
my ($contribs) = sort { $repos->{$a}->{contribs} <=> $repos->{$b}->{contribs} } grep { $repos->{$_}->{contribs} } keys %$repos; |
95 |
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
96 |
|
|
97 |
my ($rel, @rpms, %latest, %sources, $archs, $rebuild, $newline); |
my ($rel, @rpms, %latest, %sources, $archs, $rebuild, $newline); |
103 |
$rebuild = (); |
$rebuild = (); |
104 |
|
|
105 |
# Load distro packages |
# Load distro packages |
106 |
find( { wanted => \&loadpkg, no_chdir => 1, follow_fast => 1 }, map { $distrepo->{$smever}->{$_} } ('repo','builds','stage') ); |
find( { wanted => \&loadpkg, no_chdir => 1, follow_fast => 1 }, map { $distrepo->{$smever}->{$_} } ('repo','builds','contribs','stage') ); |
107 |
printline('white', 0, "Distro (SME Server $rel) packages loaded.\n"); |
printline('white', 0, "Distro (SME Server $rel) packages loaded.\n"); |
108 |
|
|
109 |
# Load base packages |
# Load base packages |
147 |
} |
} |
148 |
|
|
149 |
# Move packages from base/builds to correct area |
# Move packages from base/builds to correct area |
150 |
elsif ( rprop($pkg, 'base') || rprop($pkg, 'builds') ) { |
elsif ( rprop($pkg, 'orig') ) { |
151 |
printline('dark blue', 1, ' - checking base/builds') if $opts{d}; |
printline('dark blue', 1, ' - checking base/builds/contribs') if $opts{d}; |
152 |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
my $repo = $names{$pkg->{name}} && $names{$pkg->{name}} > 1 ? $devel2 : $devel1; |
153 |
|
$repo = $contribs if $pkg->{repo} eq 'contribs'; |
154 |
if ( $pkg->{nonbase} ) { |
if ( $pkg->{nonbase} ) { |
155 |
foreach my $up ( @pkgs ) { |
foreach my $up ( @pkgs ) { |
156 |
next if rprop($up, 'builds') || rprop($up, 'base'); |
next if rprop($up, 'orig'); |
157 |
next if $up->{name} ne $pkg->{name} || ! $up->{obsolete} || $up->{rpm} ge $pkg->{rpm}; |
next if $up->{name} ne $pkg->{name} || ! $up->{obsolete} || $up->{rpm} ge $pkg->{rpm}; |
158 |
$repo = $up->{repo}; |
$repo = $up->{repo}; |
159 |
last; |
last; |
160 |
} |
} |
161 |
} |
} |
162 |
next if rprop($pkg, 'base') && $repo eq $devel1 && $devel1 ne $devel2; |
next if rprop($pkg, 'base') && $repo eq $devel1; |
163 |
movepkg($pkg, $repo); |
movepkg($pkg, $repo); |
164 |
%names = names($pkg, @pkgs); |
%names = names($pkg, @pkgs); |
165 |
$seen{$pkg->{nvra}}++; |
$seen{$pkg->{nvra}}++; |
194 |
tagpkg($cmp, 'inuse'); |
tagpkg($cmp, 'inuse'); |
195 |
$pkg->{srpm}->{latest}++; |
$pkg->{srpm}->{latest}++; |
196 |
} |
} |
197 |
if ( $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds') || ( $cmp->{oldrepo} && $pkg->{repo} eq $cmp->{oldrepo} ) ) { |
if ( $pkg->{repo} eq $cmp->{repo} || ( $cmp->{oldrepo} && $pkg->{repo} eq $cmp->{oldrepo} ) || rprop($cmp, 'orig') ) { |
198 |
tagpkg($cmp, 'inuse') |
tagpkg($cmp, 'inuse') |
199 |
} |
} |
200 |
} |
} |
225 |
tagpkg($cmp, 'inuse'); |
tagpkg($cmp, 'inuse'); |
226 |
$pkg->{srpm}->{latest}++; |
$pkg->{srpm}->{latest}++; |
227 |
} |
} |
228 |
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'base') || rprop($cmp, 'builds'); |
tagpkg($cmp, 'inuse') if $pkg->{repo} eq $cmp->{repo} || rprop($cmp, 'orig'); |
229 |
} |
} |
230 |
} |
} |
231 |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
} elsif ( $cmp->{rpm} eq $pkg->{rpm} ) { |
237 |
$_->{latest}++ foreach grep { $_->{nvra} eq $cmp->{nvra} && $_->{latest} && $_->{done} } @pkgs; |
$_->{latest}++ foreach grep { $_->{nvra} eq $cmp->{nvra} && $_->{latest} && $_->{done} } @pkgs; |
238 |
tagpkg($cmp, 'correct', 1); |
tagpkg($cmp, 'correct', 1); |
239 |
} elsif ( $seen{$cmp->{nvra}} ) { |
} elsif ( $seen{$cmp->{nvra}} ) { |
240 |
$orig++ if rprop($cmp, 'base') || rprop($cmp, 'builds'); |
$orig++ if rprop($cmp, 'orig'); |
241 |
movepkg($cmp, 'delete', 1); |
movepkg($cmp, 'delete', 1); |
242 |
} else { |
} else { |
243 |
movepkg($cmp, $pkg->{repo}, 1, 1); |
movepkg($cmp, $pkg->{repo}, 1, 1); |
304 |
} |
} |
305 |
} |
} |
306 |
finddepth(sub{rmdir}, $distrepo->{$rel}->{builds}); |
finddepth(sub{rmdir}, $distrepo->{$rel}->{builds}); |
307 |
|
finddepth(sub{rmdir}, $distrepo->{$rel}->{contribs}); |
308 |
printline('white', 0, "Finished copying/moving.\n"); |
printline('white', 0, "Finished copying/moving.\n"); |
309 |
|
|
310 |
foreach my $repo ( sort keys %repochg ) { |
foreach my $repo ( sort keys %repochg ) { |
311 |
next if ! $repos->{$repo} || $repos->{$repo}->{base} || $repos->{$repo}->{builds} || $repos->{$repo}->{stage}; |
next if ! $repos->{$repo} || $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
312 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
313 |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$rel}->{repo} . "$repo/$arch"; |
314 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
341 |
my @rpms = @_; |
my @rpms = @_; |
342 |
return map { $_->{name} => rprop($_, 'inc') ? 2 : 1 } grep { $_->{base} eq $pkg->{base} && |
return map { $_->{name} => rprop($_, 'inc') ? 2 : 1 } grep { $_->{base} eq $pkg->{base} && |
343 |
rprop($_, 'prio') >= rprop($pkg, 'prio') && |
rprop($_, 'prio') >= rprop($pkg, 'prio') && |
344 |
! rprop($_, 'base') && |
! rprop($_, 'orig') && |
|
! rprop($_, 'builds') && |
|
345 |
! $_->{rpm}->is_source_package |
! $_->{rpm}->is_source_package |
346 |
} @rpms; |
} @rpms; |
347 |
} |
} |
381 |
my ($pkg, $repo, $done, $remove) = @_; |
my ($pkg, $repo, $done, $remove) = @_; |
382 |
defined $done or $done = 2; |
defined $done or $done = 2; |
383 |
defined $remove or $remove = 0; |
defined $remove or $remove = 0; |
384 |
$remove = 0 if rprop($pkg, 'base') || rprop($pkg, 'builds'); |
$remove = 0 if rprop($pkg, 'orig'); |
385 |
$remove = 1 if $repo eq 'delete'; |
$remove = 1 if $repo eq 'delete'; |
386 |
|
|
387 |
if ( $repo eq 'delete' && ( rprop($pkg, 'base') || ( rprop($pkg, 'builds') && $done == 1 ) ) ) { |
if ( $repo eq 'delete' && ( rprop($pkg, 'base') || ( rprop($pkg, 'orig') && $done == 1 ) ) ) { |
388 |
tagpkg($pkg, 'inuse', 1); |
tagpkg($pkg, 'inuse', 1); |
389 |
} else { |
} else { |
390 |
printline('bold magenta', 1, " - ($repo) ", $pkg->{rpm}->filename) if $opts{d}; |
printline('bold magenta', 1, " - ($repo) ", $pkg->{rpm}->filename) if $opts{d}; |
391 |
my $color = 'bold white'; |
my $color = 'bold white'; |
392 |
$color = 'bold yellow' if rprop($pkg, 'builds'); |
$color = 'bold yellow' if rprop($pkg, 'orig'); |
393 |
$color = 'dark green' if $repos->{$repo} && $repos->{$repo}->{devel}; |
$color = 'dark green' if $repos->{$repo} && $repos->{$repo}->{devel}; |
394 |
$color = 'dark red' if $repo eq 'delete'; |
$color = 'dark red' if $repo eq 'delete'; |
395 |
push @{$pkg->{repos}}, $repo unless $repo eq 'delete'; |
push @{$pkg->{repos}}, $repo unless $repo eq 'delete'; |
417 |
$pkg->{done}++; |
$pkg->{done}++; |
418 |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
delete $pkg->{obsolete} if $pkg->{obsolete}; |
419 |
|
|
420 |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'base') && ! rprop($pkg, 'builds') ) { |
if ( $repos->{$pkg->{repo}} && ! rprop($pkg, 'orig') ) { |
421 |
# FIXME: Nasty hack for comps package |
# FIXME: Nasty hack for comps package |
422 |
if ( $pkg->{name} eq 'comps' ) { |
if ( $pkg->{name} eq 'comps' ) { |
423 |
if ( ! $latest{$pkg->{name}.'.'.$pkg->{arch}} || $latest{$pkg->{name}.'.'.$pkg->{arch}}->{rpm} eq $pkg->{rpm} ) { |
if ( ! $latest{$pkg->{name}.'.'.$pkg->{arch}} || $latest{$pkg->{name}.'.'.$pkg->{arch}}->{rpm} eq $pkg->{rpm} ) { |
476 |
my $reponame = 'unknown'; |
my $reponame = 'unknown'; |
477 |
if ( substr($_, 0, length($distrepo->{$rel}->{builds})) eq $distrepo->{$rel}->{builds} ) { |
if ( substr($_, 0, length($distrepo->{$rel}->{builds})) eq $distrepo->{$rel}->{builds} ) { |
478 |
$reponame = 'builds'; |
$reponame = 'builds'; |
479 |
|
} elsif ( substr($_, 0, length($distrepo->{$rel}->{contribs})) eq $distrepo->{$rel}->{contribs} ) { |
480 |
|
$reponame = 'contribs'; |
481 |
} elsif ( substr($_, 0, length($distrepo->{$rel}->{stage})) eq $distrepo->{$rel}->{stage} ) { |
} elsif ( substr($_, 0, length($distrepo->{$rel}->{stage})) eq $distrepo->{$rel}->{stage} ) { |
482 |
$reponame = 'stage'; |
$reponame = 'stage'; |
483 |
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
} elsif ( (dirname $pkg->filename) =~ m{\d/(sme[^/]+)/} ) { |
484 |
$reponame = $1; |
$reponame = $1; |
485 |
} |
} |
486 |
if ( $nosig && ( ! -f "$HOME/.rpmpass" || $reponame eq 'builds' ) ) { |
if ( $nosig && ( ! -f "$HOME/.rpmpass" || ! $repos->{$reponame}->{orig} ) ) { |
487 |
printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); |
printline('bold yellow on_red', 1, ' - ', $pkg->filename, ' (missing signature)'); |
488 |
return; |
return; |
489 |
} |
} |