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; |
21 |
$rpm_flags |= RPM2->vsf_nosha1 | RPM2->vsf_nomd5 | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
$rpm_flags |= RPM2->vsf_nosha1 | RPM2->vsf_nomd5 | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
22 |
|
|
23 |
|
my $osdir = 'SME'; |
24 |
|
my $disttag = 'sme'; |
25 |
|
my $repotag = 'sme'; |
26 |
|
|
27 |
my @archs = ( 'i386', 'x86_64' ); |
my @archs = ( 'i386', 'x86_64' ); |
28 |
|
|
29 |
my $distrepo = { '7' => { active => 1, |
my $distrepo = { '7' => { active => 1, |
30 |
centos => 4, |
centos => 4, |
31 |
fedora => 3, |
fedora => 3, |
32 |
repo => '/releases/7/', |
repo => '/releases/7/', |
33 |
os => 'RPMS/', |
os => 'RPMS/', |
34 |
builds => '/builds/smeserver-7-core/', |
builds => '/builds/smeserver-7-core/', |
35 |
contribs => '/builds/smeserver-7-contribs/', |
community => '/builds/smeserver-7-contribs/', |
36 |
qa => '/builds/smeserver-7-qa/', |
stage => '/stage/7/', |
|
stage => '/stage/7/', |
|
37 |
}, |
}, |
38 |
'8' => { active => 1, |
'8' => { active => 1, |
39 |
centos => 5, |
centos => 5, |
40 |
fedora => 6, |
fedora => 6, |
41 |
repo => '/releases/testing/8/', |
repo => '/releases/testing/8/', |
42 |
os => '', |
os => '', |
43 |
builds => '/builds/smeserver-8-core/', |
builds => '/builds/smeserver-8-core/', |
44 |
contribs => '/builds/smeserver-8-contribs/', |
community => '/builds/smeserver-8-contribs/', |
45 |
qa => '/builds/smeserver-8-qa/', |
stage => '/stage/8/', |
|
stage => '/stage/8/', |
|
46 |
}, |
}, |
47 |
}; |
}; |
48 |
|
|
49 |
my $repos = { 'smeos' => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
my $repos = { "${repotag}os" => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
50 |
'smeupdates' => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
"${repotag}updates" => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
51 |
'smeupdates-testing' => { prio => 16, inc => 1, ver => 1, rel => 1 }, |
"${repotag}updates-testing" => { prio => 16, inc => 1, ver => 1, rel => 3 }, |
52 |
'smeextras' => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
"${repotag}extras" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
53 |
'smeaddons' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
"${repotag}addons" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
54 |
'smecontribs' => { prio => 13, inc => 0, ver => 1, rel => 2 }, |
"${repotag}contribs" => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
55 |
'smetest' => { prio => 12, inc => 0, ver => 2, rel => 2, devel => 2 }, |
"${repotag}test" => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
56 |
'smedev' => { prio => 11, inc => 0, ver => 2, rel => 2, devel => 1 }, |
"${repotag}dev" => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
57 |
'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 }, |
58 |
'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 }, |
59 |
'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 }, |
60 |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
61 |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
62 |
'fedora' => { prio => 5, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'fedora' => { prio => 5, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
63 |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
64 |
'contribs' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
65 |
'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 }, |
66 |
}; |
}; |
67 |
|
|
68 |
my $baserepo = { '~Ssmeos/~A/SME/~O' => 'smeos', |
my $baserepo = { "~S${repotag}os/~A/$osdir/~O" => "${repotag}os", |
69 |
'~Ssmeupdates/~A/RPMS/' => 'smeupdates', |
"~S${repotag}updates/~A/RPMS/" => "${repotag}updates", |
70 |
'~Ssmeupdates-testing/~A/RPMS/' => 'smeupdates-testing', |
"~S${repotag}updates-testing/~A/RPMS/" => "${repotag}updates-testing", |
71 |
'~Ssmeextras/~A/RPMS/' => 'smeextras', |
"~S${repotag}extras/~A/RPMS/" => "${repotag}extras", |
72 |
'~Ssmeaddons/~A/RPMS/' => 'smeaddons', |
"~S${repotag}addons/~A/RPMS/" => "${repotag}addons", |
73 |
'~Ssmecontribs/~A/RPMS/' => 'smecontribs', |
"~S${repotag}contribs/~A/RPMS/" => "${repotag}contribs", |
74 |
'~Ssmetest/~A/RPMS/' => 'smetest', |
"~S${repotag}test/~A/RPMS/" => "${repotag}test", |
75 |
'~Ssmedev/~A/RPMS/' => 'smedev', |
"~S${repotag}dev/~A/RPMS/" => "${repotag}dev", |
76 |
'/stage/~s/~A/SME/~O' => 'stage', |
"/stage/~s/~A/$osdir/~O" => 'stage', |
77 |
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
78 |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
79 |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
80 |
'/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', |
|
81 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
82 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
83 |
'/mirrors/fedora/extras/~F/~A/' => 'fedora-extras', |
'/mirrors/fedora/extras/~F/~A/' => 'fedora-extras', |
91 |
'/mirrors/fedora/core/updates/~F/~A/' => 'fedora', |
'/mirrors/fedora/core/updates/~F/~A/' => 'fedora', |
92 |
}; |
}; |
93 |
|
|
94 |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3', 'vim' ) }, |
if ( $opts{q} ) { |
95 |
'epel' => { map { $_ => 1 } ( 'perl-Razor-Agent' ) }, |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
96 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
97 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
98 |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
99 |
|
} |
100 |
|
|
101 |
|
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
102 |
|
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'ocsinventory', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-DateTime', 'perl-Razor-Agent', 'perl-Text-Iconv', 'proftpd' ) }, |
103 |
|
'fedora-extras' => { map { $_ => 1 } ( 'ddclient', 'hddtemp', 'pam_abl', 'perl-Compress-Bzip2', 'perl-Error', 'perl-HTML-Format', 'perl-MIME-Types', 'perl-Net-IP', 'perl-Archive-Zip', 'perl-Class-Singleton', 'perl-Razor-Agent', 'perl-Test-Inline', 'perl-Text-Autoformat', 'perl-Text-Iconv', 'perl-Text-Reform', 'perl-XML-RSS' ) }, |
104 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
105 |
'atrpms' => { map { $_ => 1 } ( 'dovecot', 'trac', 'yum' ) }, |
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
106 |
}, |
}, |
107 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
108 |
'fedora' => { map { $_ => 1 } ( 'kernel-xen' ) }, |
'fedora' => { map { $_ => 1 } ( 'kernel', 'kernel-xen', 'libgsf' ) }, |
109 |
'epel' => { map { $_ => 1 } ( 'perl-Razor-Agent', 'smolt' ) }, |
'epel' => { map { $_ => 1 } ( 'clamav', 'horde', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'proftpd', 'smolt' ) }, |
110 |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Compress-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
111 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
112 |
}, |
}, |
113 |
}; |
}; |
117 |
$devel2 ||= $devel1; |
$devel2 ||= $devel1; |
118 |
|
|
119 |
my ($rpms, %base, %latest, %sources); |
my ($rpms, %base, %latest, %sources); |
120 |
foreach my $smever ( sort { $a <=> $b } keys %$distrepo ) { |
foreach my $ver ( sort { $a <=> $b } keys %$distrepo ) { |
121 |
next unless $distrepo->{$smever}->{active}; |
next unless $distrepo->{$ver}->{active}; |
122 |
my %repochg = (); |
my %repochg = (); |
123 |
$rpms = (); |
$rpms = (); |
124 |
%latest = (); |
%latest = (); |
127 |
|
|
128 |
foreach my $dir ( sort { $repos->{$baserepo->{$b}}->{prio} <=> $repos->{$baserepo->{$a}}->{prio} || $a cmp $b } keys %$baserepo ) { |
foreach my $dir ( sort { $repos->{$baserepo->{$b}}->{prio} <=> $repos->{$baserepo->{$a}}->{prio} || $a cmp $b } keys %$baserepo ) { |
129 |
my $bdir = $dir; |
my $bdir = $dir; |
130 |
$bdir =~ s/~O/$distrepo->{$smever}->{os}/; |
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
131 |
$bdir =~ s/~S/$distrepo->{$smever}->{repo}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
132 |
$bdir =~ s/~s/$smever/; |
$bdir =~ s/~s/$ver/; |
133 |
$bdir =~ s/~C/$distrepo->{$smever}->{centos}/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
134 |
$bdir =~ s/~F/$distrepo->{$smever}->{fedora}/; |
$bdir =~ s/~F/$distrepo->{$ver}->{fedora}/; |
135 |
for my $arch ( @archs, 'SRPMS/' ) { |
for my $arch ( @archs, 'SRPMS/' ) { |
136 |
my $adir = $bdir; |
my $adir = $bdir; |
137 |
if ( $arch eq 'SRPMS/' ) { |
if ( $arch eq 'SRPMS/' ) { |
141 |
} |
} |
142 |
opendir DIR, $adir or next; |
opendir DIR, $adir or next; |
143 |
next unless -d $adir; |
next unless -d $adir; |
144 |
process_rpm("$adir$_", $smever, $baserepo->{$dir}) foreach readdir DIR; |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
145 |
closedir DIR; |
closedir DIR; |
146 |
last unless $dir =~ m{~A}; |
last unless $dir =~ m{~A}; |
147 |
} |
} |
148 |
} |
} |
149 |
find( { wanted => sub { process_rpm($_, $smever, 'builds'); }, no_chdir => 1, follow_fast => 1 }, ( $distrepo->{$smever}->{'builds'}, $distrepo->{$smever}->{'qa'} ) ); |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'builds'} ); |
150 |
find( { wanted => sub { process_rpm($_, $smever, 'contribs'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{'contribs'} ); |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
151 |
|
|
152 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
153 |
|
next unless $rpms->{$base}->{rpms}; |
154 |
my %track = (); |
my %track = (); |
155 |
my %seen = (); |
my %seen = (); |
156 |
my %counts = (); |
my %counts = (); |
161 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
162 |
next if $pkg->{done}; |
next if $pkg->{done}; |
163 |
|
|
164 |
if ( $rpms->{$base}->{vers}->{$pkg->{svr}} ) { |
my $tmp = $pkg->{svr}; |
165 |
foreach my $tmp ( @{$rpms->{$base}->{vers}->{$pkg->{svr}}} ) { |
SRC: { |
166 |
|
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
167 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
168 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
169 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
170 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
171 |
|
($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
172 |
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
173 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
174 |
|
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
175 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
176 |
|
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
177 |
|
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
178 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
179 |
|
} |
180 |
|
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
181 |
|
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
182 |
$tmp->{svr} = $pkg->{svr}; |
$tmp->{svr} = $pkg->{svr}; |
183 |
push @{$rpms->{$base}->{rpms}}, $tmp; |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
184 |
} |
$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; |
|
|
} |
|
185 |
} |
} |
186 |
} |
} |
187 |
|
|
189 |
my %pkgs = (); |
my %pkgs = (); |
190 |
my %reposrc = (); |
my %reposrc = (); |
191 |
my $srpm = undef; |
my $srpm = undef; |
192 |
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}} ) { |
193 |
next unless $cmp->{svr} eq $pkg->{svr}; |
next unless $cmp->{svr} eq $pkg->{svr}; |
194 |
|
|
195 |
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} ) { |
|
196 |
if ( $cmp->{src} ) { |
if ( $cmp->{src} ) { |
197 |
$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} ) { |
|
198 |
$cmp->{delete}++; |
$cmp->{delete}++; |
199 |
|
$cmp->{done}++; |
200 |
|
next; |
201 |
} |
} |
202 |
} elsif ( $seen{$cmp->{nvra}} ) { |
} else { |
203 |
|
$track{repo} = $cmp->{repo}; |
204 |
|
$track{svr} = $cmp->{svr}; |
205 |
|
} |
206 |
|
} |
207 |
|
if ( $cmp->{svr} eq $track{svr} ) { |
208 |
|
if ( $seen{$cmp->{nvra}} ) { |
209 |
if ( $track{repo} ne $cmp->{repo} ) { |
if ( $track{repo} ne $cmp->{repo} ) { |
210 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
if ($repos->{$cmp->{repo}}->{stage} ) { |
211 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
215 |
} |
} |
216 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
217 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
218 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
219 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
220 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
221 |
|
} |
222 |
|
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
223 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
224 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
225 |
$cmp->{delete}++; |
$cmp->{delete}++; |
226 |
} |
} |
228 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
229 |
$cmp->{delete}++; |
$cmp->{delete}++; |
230 |
} else { |
} else { |
231 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
232 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
233 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
234 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
236 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
237 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
238 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
239 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
240 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
241 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
242 |
|
} |
243 |
|
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
244 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
245 |
} else { |
} else { |
246 |
$cmp->{delete}++; |
$cmp->{delete}++; |
247 |
} |
} |
248 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
249 |
$cmp->{repo} = $dest; |
$cmp->{repo} = $dest; |
250 |
|
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
251 |
|
$track{repo} = $dest; |
252 |
|
$track{svr} = $cmp->{svr}; |
253 |
|
} |
254 |
|
} |
255 |
|
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
256 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
257 |
} |
} |
258 |
} |
} |
259 |
} else { |
} else { |
260 |
if ( $track{repo} eq $cmp->{repo} ) { |
if ( $track{repo} eq $cmp->{repo} ) { |
261 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
262 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
263 |
|
} elsif ( $cmp->{src} ) { |
264 |
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
265 |
} else { |
} else { |
266 |
$track{svr} = $cmp->{svr}; |
$track{svr} = $cmp->{svr}; |
267 |
} |
} |
268 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
269 |
$cmp->{delete}++; |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
270 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
271 |
|
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
272 |
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
273 |
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
274 |
|
if ( $cmp->{src} && ! $reposrc{$dest} ) { |
275 |
|
$cmp->{delete}++; |
276 |
|
} elsif ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
277 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
278 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
279 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
280 |
|
} |
281 |
|
push @{$cmp->{repos}}, $dest; |
282 |
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
283 |
|
$cmp->{repo} = $dest; |
284 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
285 |
|
$orig{$cmp->{nvra}}++; |
286 |
|
} else { |
287 |
|
$cmp->{delete}++; |
288 |
|
} |
289 |
|
} else { |
290 |
|
$cmp->{delete}++; |
291 |
|
} |
292 |
} |
} |
293 |
} |
} |
|
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{delete} || $repos->{$cmp->{repo}}->{base}; |
|
294 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
295 |
$pkgs{$cmp->{nvra}}++; |
$pkgs{$cmp->{nvra}}++; |
296 |
$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}}; |
297 |
|
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
298 |
unless ( $seen{$cmp->{nvra}} ) { |
unless ( $seen{$cmp->{nvra}} ) { |
299 |
$seen{$cmp->{nvra}} = $cmp; |
$seen{$cmp->{nvra}} = $cmp; |
300 |
$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}; |
304 |
$cmp->{done}++; |
$cmp->{done}++; |
305 |
} |
} |
306 |
if ( $srpm ) { |
if ( $srpm ) { |
307 |
foreach my $r ( keys %reposrc ) { |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
|
next if $repos->{$r}->{orig}; |
|
308 |
unless ( $reposrc{$r}->{srpm} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
309 |
push @{$srpm->{repos}}, $r; |
unshift @{$srpm->{repos}}, $r; |
|
$pkgs{$srpm->{nvra}}++; |
|
|
$orig{$srpm->{nvra}}++ if $repos->{$srpm->{repo}}->{orig}; |
|
310 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
311 |
$srpm->{repo} = $r; |
$srpm->{repo} = $r; |
312 |
$reposrc{$r}->{srpm} = $srpm; |
$reposrc{$r}->{srpm} = $srpm; |
313 |
} |
} |
314 |
} |
} |
315 |
} elsif ( scalar keys %pkgs ) { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
316 |
print "\n * missing source (", $pkg->{svr}, ")\n"; |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
317 |
} |
} |
318 |
print "\n * missing originals (", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
319 |
} |
} |
320 |
|
|
321 |
foreach my $r ( keys %$acnt ) { |
foreach my $r ( keys %$acnt ) { |
341 |
push @{$pkg->{repos}}, $stage; |
push @{$pkg->{repos}}, $stage; |
342 |
} |
} |
343 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
344 |
print "\n$base (sme$smever)\n", "=" x length("$base (sme$smever)"), "\n"; |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
345 |
$print++; |
$print++; |
346 |
} |
} |
347 |
|
|
372 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
373 |
|
|
374 |
my @d = (); |
my @d = (); |
375 |
my $head = $distrepo->{$smever}->{repo} . $repo . '/'; |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
376 |
$head = $distrepo->{$smever}->{stage} if $repos->{$repo}->{stage}; |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
377 |
my $tail = $repos->{$repo}->{os} ? 'SME/' . $distrepo->{$smever}->{os} : 'RPMS/'; |
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
378 |
if ( $pkg->{src} ) { |
if ( $pkg->{src} ) { |
379 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
380 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
391 |
} |
} |
392 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
393 |
} elsif ( $pkg->{delete} ) { |
} elsif ( $pkg->{delete} ) { |
394 |
print "delete from ", $pkg->{repo}, " (", basename($pkg->{rpm}->filename), ")\n"; |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
395 |
qx(rm -f $src); |
qx(rm -f $src) unless $opts{t}; |
396 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
397 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
398 |
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
399 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
400 |
|
} |
401 |
} |
} |
402 |
} |
} |
403 |
} |
} |
404 |
|
|
405 |
if ( %repochg ) { |
if ( %repochg ) { |
406 |
print "\nrebuild repo (sme$smever)\n", "=" x length("rebuild repo (sme$smever)"), "\n"; |
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
407 |
} |
} |
408 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
409 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
410 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
411 |
my $dir = $distrepo->{$smever}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
412 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
413 |
chomp $dir; |
chomp $dir; |
414 |
print "rebuild $repo/$arch\n"; |
print "rebuild $repo/$arch\n"; |
415 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
416 |
if ( -f "$dir/repodata/comps.xml" ) { |
if ( -f "$dir/repodata/comps.xml" ) { |
417 |
qx(createrepo -g $dir/repodata/comps.xml $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
418 |
} else { |
} else { |
419 |
qx(createrepo $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
420 |
} |
} |
421 |
qx(repoview $dir); |
qx(repoview $dir); |
422 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
425 |
} |
} |
426 |
} |
} |
427 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
428 |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs','qa'); |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
429 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
430 |
} |
} |
431 |
} |
} |
432 |
|
|
435 |
my $repo = shift; |
my $repo = shift; |
436 |
my $counts = shift; |
my $counts = shift; |
437 |
|
|
438 |
|
return 0 if $pkg->{src}; |
439 |
$counts->{$repo}->{$pkg->{ver}}->{$pkg->{rel}}++; |
$counts->{$repo}->{$pkg->{ver}}->{$pkg->{rel}}++; |
440 |
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}; |
441 |
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}; |
449 |
my $pkgs = shift; |
my $pkgs = shift; |
450 |
|
|
451 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
452 |
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}; |
453 |
|
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
454 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
455 |
$dest = $hirepo; |
$dest = $hirepo; |
456 |
last; |
last; |
463 |
|
|
464 |
sub process_rpm { |
sub process_rpm { |
465 |
my $rpm = shift; |
my $rpm = shift; |
466 |
my $smever = shift; |
my $ver = shift; |
467 |
my $repo = shift; |
my $repo = shift; |
468 |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
469 |
my $base = $1; |
my $base = $1; |
482 |
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}; |
483 |
} |
} |
484 |
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$}; |
485 |
return if $skippkg->{$smever}->{$repo} && $skippkg->{$smever}->{$repo}->{$src}; |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
486 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig; |
487 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
488 |
|
my $arch = 'unknown'; |
489 |
|
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
490 |
|
$arch = 'x86_64' if $pkg->filename =~ m{[/-]x86_64/}; |
491 |
|
$arch = 'i386' if $pkg->filename =~ m{[/-](i[356]86)/}; |
492 |
|
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
493 |
|
|
494 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
495 |
name => $pkg->name, |
name => $pkg->name, |
497 |
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') ), |
498 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
499 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
500 |
|
arch => $arch, |
501 |
ver => $version, |
ver => $version, |
502 |
rel => $release, |
rel => $release, |
503 |
rpm => $pkg, |
rpm => $pkg, |