14 |
$| = 1; |
$| = 1; |
15 |
|
|
16 |
my %opts; |
my %opts; |
17 |
getopts( 'osqtr:', \%opts ); |
getopts( 'ostr:', \%opts ); |
18 |
$opts{r} ||= ''; |
$opts{r} ||= ''; |
19 |
|
#available options |
20 |
|
#-o = verify we have originals of the packages in repos (not really used anymore) |
21 |
|
#-s = verify every package has a source package (so we can rebuild if necessary) |
22 |
|
#-t = test run (don't do anything just print out what would be done) |
23 |
|
#-r {regex} = regex of packages to run the script against |
24 |
|
|
25 |
my $rpm_flags = RPM2->vsf_nosha1header | RPM2->vsf_nomd5header | RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader; |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
$rpm_flags |= RPM2->vsf_nosha1 | RPM2->vsf_nomd5 | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
26 |
|
|
27 |
my $osdir = 'SME'; |
my $osdir = 'SME'; |
28 |
my $disttag = 'sme'; |
my $disttag = 'sme'; |
29 |
my $repotag = 'sme'; |
my $repotag = 'sme'; |
30 |
|
|
31 |
my @archs = ( 'i386', 'x86_64' ); |
my $distrepo = { '8' => { active => 1, |
32 |
|
centos => 5, |
33 |
my $distrepo = { '7' => { active => 1, |
archs => [ 'i386', 'x86_64' ], |
34 |
centos => 4, |
repo => '/build/smeserver/repo/8/', |
35 |
repo => '/releases/7/', |
builds => ['/build/builds/smeserver-8-core/'], |
36 |
os => 'RPMS/', |
community => '/build/builds/smeserver-8-contribs/', |
37 |
builds => '/builds/smeserver-7-core/', |
stage => '/build/smeserver/stage/8/', |
38 |
community => '/builds/smeserver-7-contribs/', |
sign => 1, |
39 |
stage => '/stage/7/', |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
40 |
|
checksum => 'sha', |
41 |
|
}, |
42 |
|
'9' => { active => 1, |
43 |
|
centos => 6, |
44 |
|
archs => [ 'i386', 'x86_64' ], |
45 |
|
repo => '/build/smeserver/repo/9/', |
46 |
|
builds => ['/build/builds/smeserver-9-core/'], |
47 |
|
community => '/build/builds/smeserver-9-contribs/', |
48 |
|
stage => '/build/smeserver/stage/9/', |
49 |
|
sign => 1, |
50 |
|
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
51 |
|
checksum => 'sha256', |
52 |
|
}, |
53 |
|
'10' => { active => 1, |
54 |
|
centos => 7, |
55 |
|
archs => [ 'x86_64' ], |
56 |
|
repo => '/build/smeserver/repo/testing/10/', |
57 |
|
builds => ['/build/builds/smeserver-10-core/'], |
58 |
|
community => '/build/builds/smeserver-10-contribs/', |
59 |
|
stage => '/build/smeserver/stage/10/', |
60 |
|
sign => 1, |
61 |
|
keyname => 'Koozali SME Server signing key (10) <bugteam@koozali.org>', |
62 |
|
checksum => 'sha256', |
63 |
|
}, |
64 |
|
}; |
65 |
|
|
66 |
|
# list here repo and priority |
67 |
|
# prio: highest priority will hide lowest priority |
68 |
|
# inc: include for iso ? |
69 |
|
# ver: |
70 |
|
# rel: |
71 |
|
# orig: |
72 |
|
# base, os, stage: |
73 |
|
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
74 |
|
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
75 |
|
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
76 |
|
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
77 |
|
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
78 |
|
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
79 |
|
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
80 |
|
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
81 |
|
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
82 |
|
'remi' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
83 |
|
'remisafe' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
84 |
|
'epel' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
85 |
|
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
86 |
|
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
87 |
|
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
88 |
|
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
89 |
|
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
90 |
|
}; |
91 |
|
|
92 |
|
# list here the path on our local mirror to each upstream and our mirrors |
93 |
|
# ~A will be expanded to architecture |
94 |
|
# ~C will be expanded to Centos main version number, i.e. 7 for SME 10. |
95 |
|
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
96 |
|
"~S${repotag}updates/~A/" => "${repotag}updates", |
97 |
|
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
98 |
|
"~S${repotag}extras/~A/" => "${repotag}extras", |
99 |
|
"~S${repotag}addons/~A/" => "${repotag}addons", |
100 |
|
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
101 |
|
"~S${repotag}test/~A/" => "${repotag}test", |
102 |
|
"~S${repotag}dev/~A/" => "${repotag}dev", |
103 |
|
"/build/smeserver/stage/~s/~A/" => 'stage', |
104 |
|
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
105 |
|
'/mirrors/centos/~C/updates/~A/' => 'centos', |
106 |
|
'/mirrors/centos/~C/os/~A/' => 'centos', |
107 |
|
'/mirrors/centos/~C/extras/~A/' => 'centos', |
108 |
|
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
109 |
|
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
110 |
|
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
111 |
|
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
112 |
|
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
113 |
|
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
114 |
|
'/mirrors/remi/enterprise/~C/remi/~A/' => 'remi', |
115 |
|
'/mirrors/remi/SRPMS/' => 'remi', |
116 |
|
'/mirrors/remi/enterprise/~C/safe/~A/' => 'remisafe', |
117 |
|
'/mirrors/remi/SRPMS/' => 'remisafe', |
118 |
|
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
119 |
|
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
120 |
|
'/mirrors/rpmforge/source/' => 'rpmforge', |
121 |
|
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
122 |
|
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
123 |
|
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
124 |
|
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
125 |
|
}; |
126 |
|
|
127 |
|
# add here packages to exclude |
128 |
|
# for each version, if a repo is listed and rpm are listed they will be ignored fromt his repo |
129 |
|
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
130 |
|
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
131 |
|
'epel' => { map { $_ => 1 } ( 'clamav', 'cppunit', 'fping', 'html2ps', 'horde', 'libtalloc', 'libtdb', 'oidentd', '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', 'smolt' ) }, |
132 |
|
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin', 'lzo', 'perl-Convert-TNEF', 'perl-Mail-SPF', 'proftpd', 'erlang', 'perl-DateTime-Format-Mail', 'perl-DateTime-Format-W3CDTF', 'perl-Email-Abstract', 'perl-Email-MIME-Attachment-Stripper', 'perl-Email-Reply', 'perl-Font-AFM', 'perl-IPC-Run', 'rkhunter') }, |
133 |
|
}, |
134 |
|
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
135 |
|
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
136 |
|
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin', 'portreserve', 'perl-libwww-perl' , 'lzo', 'perl-BSD-Resource', 'perl-Convert-ASN1', 'perl-Devel-StackTrace', 'perl-Digest-SHA1', 'perl-MIME-tools', 'perl-MailTools', 'perl-PPI', 'perl-URI', 'perl-XML-NamespaceSupport', 'perl-XML-Parser', 'perl-XML-SAX-Writer', 'perl-YAML-Syck', 'proftpd', 'syslinux') }, |
137 |
|
}, |
138 |
|
'10' => { |
139 |
|
}, |
140 |
|
}; |
141 |
|
|
142 |
|
# add here include only conditions |
143 |
|
# for each version if a repo is listed here, only listed rpm will be considered |
144 |
|
my $onlypkg = { '8' => { |
145 |
|
'remi' => { }, |
146 |
|
'remisafe' => { }, |
147 |
}, |
}, |
148 |
'8' => { active => 1, |
'9' => { |
149 |
centos => 5, |
'remi' => { }, |
|
repo => '/releases/testing/8/', |
|
|
os => '', |
|
|
builds => '/builds/smeserver-8-core/', |
|
|
community => '/builds/smeserver-8-contribs/', |
|
|
stage => '/stage/8/', |
|
150 |
}, |
}, |
151 |
}; |
'10' => { |
152 |
|
'remi' => { map { $_ => 1 } ( 'php-pear' )}, |
153 |
my $repos = { "${repotag}os" => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
}, |
154 |
"${repotag}updates" => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
}; |
|
"${repotag}updates-testing" => { prio => 16, inc => 1, ver => 1, rel => 3 }, |
|
|
"${repotag}extras" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}addons" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}contribs" => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}test" => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
|
|
"${repotag}dev" => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
|
|
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
|
|
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
|
|
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
|
|
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
|
|
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
|
|
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
|
|
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
|
|
}; |
|
|
|
|
|
my $baserepo = { "~S${repotag}os/~A/$osdir/~O" => "${repotag}os", |
|
|
"~S${repotag}updates/~A/RPMS/" => "${repotag}updates", |
|
|
"~S${repotag}updates-testing/~A/RPMS/" => "${repotag}updates-testing", |
|
|
"~S${repotag}extras/~A/RPMS/" => "${repotag}extras", |
|
|
"~S${repotag}addons/~A/RPMS/" => "${repotag}addons", |
|
|
"~S${repotag}contribs/~A/RPMS/" => "${repotag}contribs", |
|
|
"~S${repotag}test/~A/RPMS/" => "${repotag}test", |
|
|
"~S${repotag}dev/~A/RPMS/" => "${repotag}dev", |
|
|
"/stage/~s/~A/$osdir/~O" => 'stage', |
|
|
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
|
|
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
|
|
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
|
|
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
|
|
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/RPMS/' => 'rpmforge', |
|
|
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/RPMS/' => 'rpmforge', |
|
|
'/mirrors/rpmforge/source/' => 'rpmforge', |
|
|
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
|
|
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
|
|
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
|
|
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
|
|
}; |
|
|
|
|
|
if ( $opts{q} ) { |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
|
|
} |
|
|
|
|
|
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
|
|
'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' ) }, |
|
|
'rpmforge' => { map { $_ => 1 } ( 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
|
|
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
|
|
}, |
|
|
'8' => { 'atrpms' => { map { $_ => 1 } ( 'gnupg' ) }, |
|
|
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
|
|
'epel' => { map { $_ => 1 } ( 'clamav', 'horde', 'libtalloc', 'libtdb', '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', 'smolt' ) }, |
|
|
'rpmforge' => { map { $_ => 1 } ( 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
|
|
}, |
|
|
}; |
|
155 |
|
|
156 |
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; |
157 |
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; |
166 |
%sources = (); |
%sources = (); |
167 |
%base = (); |
%base = (); |
168 |
|
|
169 |
|
@{$distrepo->{$ver}->{all_archs}} = ('noarch', @{$distrepo->{$ver}->{'archs'}}); |
170 |
|
if ( grep $_ eq 'i386', @{$distrepo->{$ver}->{'archs'}} ) { |
171 |
|
push @{$distrepo->{$ver}->{all_archs}}, ('i586', 'i686'); |
172 |
|
} |
173 |
|
|
174 |
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 ) { |
175 |
my $bdir = $dir; |
my $bdir = $dir; |
176 |
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
177 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
$bdir =~ s/~s/$ver/; |
178 |
$bdir =~ s/~s/$ver/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
179 |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
for my $arch ( @{$distrepo->{$ver}->{'archs'}}, 'SRPMS/' ) { |
180 |
for my $arch ( @archs, 'SRPMS/' ) { |
my $adir = $bdir; |
181 |
my $adir = $bdir; |
if ( $arch eq 'SRPMS/' ) { |
182 |
if ( $arch eq 'SRPMS/' ) { |
$adir =~ s/~A.*//; |
183 |
$adir =~ s/~A.*/$arch/; |
if ( -d "${adir}SRPMS" ) { |
184 |
} else { |
$adir .= "SRPMS/"; |
185 |
$adir =~ s/~A/$arch/; |
} elsif ( -d "${adir}Source/SPackages" ) { |
186 |
} |
$adir .= "Source/SPackages/"; |
187 |
opendir DIR, $adir or next; |
} |
188 |
next unless -d $adir; |
} else { |
189 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
$adir =~ s/~A/$arch/; |
190 |
closedir DIR; |
if ( -d "${adir}RPMS" ) { |
191 |
last unless $dir =~ m{~A}; |
$adir .= "RPMS/"; |
192 |
} |
} elsif ( -d "${adir}Packages" ) { |
193 |
|
$adir .= "Packages/"; |
194 |
|
} elsif ( -d "${adir}CentOS" ) { |
195 |
|
$adir .= "CentOS/"; |
196 |
|
} elsif ( -d "${adir}$osdir" ) { |
197 |
|
$adir .= "$osdir/"; |
198 |
|
} |
199 |
|
} |
200 |
|
next unless -d $adir; |
201 |
|
opendir DIR, $adir or next; |
202 |
|
my @txt = grep { /\.rpm$/ && -f "$adir/$_" } readdir DIR; |
203 |
|
closedir DIR; |
204 |
|
if (scalar(@txt)) { |
205 |
|
opendir DIR, $adir or next; |
206 |
|
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
207 |
|
closedir DIR; |
208 |
|
} elsif ($baserepo->{$dir} eq 'epel') { |
209 |
|
# EPEL 7 uses a structure with subfolders of first letter of package |
210 |
|
find( { wanted => sub { process_rpm($_, $ver, $baserepo->{$dir}) if ($_ =~ m/\.rpm$/);}, no_chdir => 1, follow_fast => 1 }, $adir ); |
211 |
|
} |
212 |
|
last unless $dir =~ m{~A}; |
213 |
|
} |
214 |
} |
} |
215 |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'builds'} ); |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, "$_" ) foreach @{$distrepo->{$ver}->{'builds'}}; |
216 |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
217 |
|
|
218 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
219 |
next unless $rpms->{$base}->{rpms}; |
next unless $rpms->{$base}->{rpms}; |
220 |
my %track = (); |
my %track = (); |
221 |
my %seen = (); |
my %seen = (); |
222 |
my %counts = (); |
my %counts = (); |
223 |
my $acnt = (); |
my $acnt = (); |
224 |
my $print = 0; |
my $print = 0; |
225 |
%latest = (); |
%latest = (); |
226 |
|
|
227 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
228 |
next if $pkg->{done}; |
next if $pkg->{done}; |
229 |
|
|
230 |
my $tmp = $pkg->{svr}; |
my $tmp = $pkg->{svr}; |
231 |
# srpm transformations to match up binary and source rpms |
# srpm transformations to match up binary and source rpms |
232 |
SRC: { |
SRC: { |
233 |
# Try to find the name the binary wants (no changes) |
# Try to find the name the binary wants (no changes) |
234 |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
235 |
|
|
236 |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
237 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf[btx]?)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf[btx]?)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
238 |
# rpmforge (.el4.rfx to .rf, with rfb,rft,rfx switched to rf) |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
239 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
240 |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
241 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
242 |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
243 |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
244 |
|
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
245 |
# atrpms (remove .el4.at) |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
246 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
|
247 |
# atrpms (remove .el4) |
# atrpms (remove .at) |
248 |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
249 |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
# atrpms (remove .el4.at) |
250 |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
251 |
|
# atrpms (remove .el4) |
252 |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
253 |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
254 |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
255 |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
|
256 |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
257 |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
258 |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
259 |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
260 |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
261 |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
262 |
} |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
263 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
264 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
265 |
$tmp->{svr} = $pkg->{svr}; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
266 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
} |
267 |
$tmp->{added}++; |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
268 |
} |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
269 |
} |
$tmp->{svr} = $pkg->{svr}; |
270 |
|
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
271 |
my %orig = (); |
$tmp->{added}++; |
272 |
my %pkgs = (); |
} |
273 |
my %reposrc = (); |
} |
274 |
my $srpm = undef; |
|
275 |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
my %orig = (); |
276 |
next unless $cmp->{svr} eq $pkg->{svr}; |
my %pkgs = (); |
277 |
|
my %reposrc = (); |
278 |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
my $srpm = undef; |
279 |
if ( $cmp->{src} ) { |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
280 |
if ( ! $track{repo} ) { |
next unless $cmp->{svr} eq $pkg->{svr}; |
281 |
$cmp->{delete}++; |
|
282 |
$cmp->{done}++; |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
283 |
next; |
if ( $cmp->{src} ) { |
284 |
} |
if ( ! $track{repo} ) { |
285 |
} else { |
$cmp->{delete}++; |
286 |
$track{repo} = $cmp->{repo}; |
$cmp->{done}++; |
287 |
$track{svr} = $cmp->{svr}; |
next; |
288 |
} |
} |
289 |
} |
} else { |
290 |
if ( $cmp->{svr} eq $track{svr} ) { |
$track{repo} = $cmp->{repo}; |
291 |
if ( $seen{$cmp->{nvra}} ) { |
$track{svr} = $cmp->{svr}; |
292 |
if ( $track{repo} ne $cmp->{repo} ) { |
} |
293 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
} |
294 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
if ( $cmp->{svr} eq $track{svr} ) { |
295 |
$seen{$cmp->{nvra}}->{latest}++; |
if ( $seen{$cmp->{nvra}} ) { |
296 |
delete $cmp->{delete} if $cmp->{delete}; |
if ( $track{repo} ne $cmp->{repo} ) { |
297 |
} else { |
if ($repos->{$cmp->{repo}}->{stage} ) { |
298 |
$cmp->{delete}++; |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
299 |
} |
$seen{$cmp->{nvra}}->{latest}++; |
300 |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
delete $cmp->{delete} if $cmp->{delete}; |
301 |
$orig{$cmp->{nvra}}++; |
} else { |
302 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$cmp->{delete}++; |
303 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} |
304 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
305 |
} |
$orig{$cmp->{nvra}}++; |
306 |
} elsif ( $cmp->{src} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
307 |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
308 |
$cmp->{repo} = $cmp->{oldrepo}; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
309 |
delete $cmp->{delete}; |
} |
310 |
} |
} elsif ( $cmp->{src} ) { |
311 |
if ( $reposrc{$cmp->{repo}} ) { |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
312 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$cmp->{repo} = $cmp->{oldrepo}; |
313 |
$srpm = $cmp if ! $srpm; |
delete $cmp->{delete}; |
314 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
} |
315 |
$cmp->{delete}++; |
if ( $reposrc{$cmp->{repo}} ) { |
316 |
} |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
317 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
$srpm = $cmp if ! $srpm; |
318 |
$cmp->{delete}++; |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
319 |
} |
$cmp->{delete}++; |
320 |
} elsif ( $cmp->{src} ) { |
} |
321 |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
322 |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
$cmp->{delete}++; |
323 |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
} |
324 |
]; |
} elsif ( $cmp->{src} ) { |
325 |
|
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
326 |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
327 |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
328 |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
]; |
329 |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
|
330 |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
331 |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
332 |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
333 |
} else { |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
334 |
warn "How did I get here??"; |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
335 |
} |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
336 |
} else { |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
337 |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
} else { |
338 |
} |
warn "How did I get here??"; |
339 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
} |
340 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
} else { |
341 |
} |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
342 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} |
343 |
$cmp->{delete}++; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
344 |
} else { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
345 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
} |
346 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
347 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$cmp->{delete}++; |
348 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
} elsif ( $cmp->{src} || grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{all_archs}} ) { |
349 |
if ( $cmp->{repo} ne $dest ) { |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
350 |
push @{$cmp->{repos}}, $dest; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
351 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
352 |
$orig{$cmp->{nvra}}++; |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
353 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
if ( $cmp->{repo} ne $dest ) { |
354 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
push @{$cmp->{repos}}, $dest; |
355 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
356 |
} |
$orig{$cmp->{nvra}}++; |
357 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
358 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
359 |
} else { |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
360 |
$cmp->{delete}++; |
} |
361 |
} |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
362 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
363 |
$cmp->{repo} = $dest; |
} else { |
364 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
$cmp->{delete}++; |
365 |
$track{repo} = $dest; |
} |
366 |
$track{svr} = $cmp->{svr}; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
367 |
} |
$cmp->{repo} = $dest; |
368 |
} |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
369 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
$track{repo} = $dest; |
370 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$track{svr} = $cmp->{svr}; |
371 |
} |
} |
372 |
} |
} |
373 |
} else { |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
374 |
if ( $track{repo} eq $cmp->{repo} ) { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
375 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
} |
376 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
} |
377 |
} elsif ( $cmp->{src} ) { |
} else { |
378 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
if ( $track{repo} eq $cmp->{repo} ) { |
379 |
} else { |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
380 |
$track{svr} = $cmp->{svr}; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
381 |
} |
} elsif ( $cmp->{src} ) { |
382 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
383 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
} else { |
384 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$track{svr} = $cmp->{svr}; |
385 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
} |
386 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
387 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
388 |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
389 |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
390 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
391 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
392 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
393 |
} |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
394 |
push @{$cmp->{repos}}, $dest; |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
395 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
396 |
$cmp->{repo} = $dest; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
397 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
} |
398 |
$orig{$cmp->{nvra}}++; |
push @{$cmp->{repos}}, $dest; |
399 |
} |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
400 |
} |
$cmp->{repo} = $dest; |
401 |
} else { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
402 |
$cmp->{delete}++; |
$orig{$cmp->{nvra}}++; |
403 |
} |
} |
404 |
} |
} |
405 |
} |
} else { |
406 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
$cmp->{delete}++; |
407 |
$pkgs{$cmp->{nvra}}++; |
} |
408 |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
} |
409 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
} |
410 |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
411 |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
$pkgs{$cmp->{nvra}}++; |
412 |
} |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
413 |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
414 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
415 |
} |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
416 |
$cmp->{done}++; |
} |
417 |
} |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
418 |
if ( $srpm ) { |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
419 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
} |
420 |
unless ( $reposrc{$r}->{srpm} ) { |
$cmp->{done}++; |
421 |
unshift @{$srpm->{repos}}, $r; |
} |
422 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
if ( $srpm ) { |
423 |
$srpm->{repo} = $r; |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
424 |
$reposrc{$r}->{srpm} = $srpm; |
unless ( $reposrc{$r}->{srpm} ) { |
425 |
} |
unshift @{$srpm->{repos}}, $r; |
426 |
} |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
427 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
$srpm->{repo} = $r; |
428 |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
$reposrc{$r}->{srpm} = $srpm; |
429 |
} |
} |
430 |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
} |
431 |
} |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
432 |
|
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
433 |
foreach my $r ( keys %$acnt ) { |
} |
434 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
435 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
} |
436 |
if ( $a eq 'noarch' ) { |
|
437 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
foreach my $r ( keys %$acnt ) { |
438 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
foreach my $p ( keys %{$acnt->{$r}} ) { |
439 |
$p2->{oldrepo} = $p2->{repo}; |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
440 |
push @{$p2->{repos}}, $p2->{repo}; |
if ( $a eq 'noarch' ) { |
441 |
} |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
442 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
443 |
print "\n * many packages ($r, $a, $p)\n"; |
$p2->{oldrepo} = $p2->{repo}; |
444 |
} |
push @{$p2->{repos}}, $p2->{repo}; |
445 |
} |
} |
446 |
} |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
447 |
} |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
448 |
|
} |
449 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
} |
450 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
} |
451 |
unless ( grep { $_->{rpm} eq $pkg->{rpm} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
} |
452 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
|
453 |
$pkg->{repo} = $stage; |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
454 |
push @{$pkg->{repos}}, $stage; |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
455 |
} |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
456 |
} |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
457 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
$pkg->{repo} = $stage; |
458 |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
push @{$pkg->{repos}}, $stage; |
459 |
$print++; |
} |
460 |
} |
} |
461 |
|
|
462 |
my $src = $pkg->{rpm}->filename; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
463 |
if ( $pkg->{nosig} ) { |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
464 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
$print++; |
465 |
unless ( $opts{t} ) { |
} |
466 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
|
467 |
if ($?) { |
my $src = $pkg->{rpm}->filename; |
468 |
print " * failed to sign package\n"; |
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
469 |
next; |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
470 |
} |
unless ( $opts{t} ) { |
471 |
} |
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
472 |
} |
if ($?) { |
473 |
|
print " * failed to sign package\n"; |
474 |
if ( $pkg->{repos} ) { |
next; |
475 |
foreach my $repo ( @{$pkg->{repos}} ) { |
} |
476 |
if ( $pkg->{delete} ) { |
} |
477 |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} |
478 |
$pkg->{delete} = 0; |
|
479 |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
if ( $pkg->{repos} ) { |
480 |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
foreach my $repo ( @{$pkg->{repos}} ) { |
481 |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
if ( $pkg->{delete} ) { |
482 |
} else { |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
483 |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
$pkg->{delete} = 0; |
484 |
} |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
485 |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
486 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
487 |
|
} else { |
488 |
my @d = (); |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
489 |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
} |
490 |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
491 |
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
492 |
if ( $pkg->{src} ) { |
|
493 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
my @d = (); |
494 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
495 |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
496 |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
497 |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
if ( $pkg->{src} ) { |
498 |
} else { |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
499 |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
500 |
} |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
501 |
foreach my $dest ( @d ) { |
} elsif ($ver>=10 && $pkg->{rpm}->arch =~ m{^(i[356]86)$} && $pkg->{arch} =~ m{^(x86_64)$} ) { |
502 |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
#add copy of i686 packages in x86_64 folder for SME>=10 |
503 |
} |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
504 |
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
505 |
} |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
506 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
} else { |
507 |
} elsif ( $pkg->{delete} ) { |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
508 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
} |
509 |
qx(rm -f $src) unless $opts{t}; |
foreach my $dest ( @d ) { |
510 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
511 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
} |
512 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
|
513 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
} |
514 |
} |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
515 |
} |
} elsif ( $pkg->{delete} ) { |
516 |
} |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
517 |
|
qx(rm -f $src) unless $opts{t}; |
518 |
if ( $rpms->{$base}->{srpms} ) { |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
519 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
520 |
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
521 |
$pkg->{delete}++; |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
522 |
my $src = $pkg->{rpm}->filename; |
} |
523 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
} |
524 |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
} |
525 |
$print++; |
|
526 |
} |
if ( $rpms->{$base}->{srpms} ) { |
527 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
528 |
qx(rm -f $src) unless $opts{t}; |
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
529 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$pkg->{delete}++; |
530 |
} |
my $src = $pkg->{rpm}->filename; |
531 |
} |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
532 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
533 |
|
$print++; |
534 |
|
} |
535 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
536 |
|
qx(rm -f $src) unless $opts{t}; |
537 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
538 |
|
} |
539 |
|
} |
540 |
} |
} |
541 |
|
|
542 |
if ( %repochg ) { |
if ( %repochg ) { |
543 |
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
544 |
} |
} |
545 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
546 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
547 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
548 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
549 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
550 |
chomp $dir; |
if ( $dir ) { |
551 |
print "rebuild $repo/$arch\n"; |
chomp $dir; |
552 |
unless ( $opts{t} ) { |
} else { |
553 |
if ( $dir =~ m{test/|-testing/} ) { |
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
554 |
if ( -f "$dir/repodata/comps.xml" ) { |
} |
555 |
qx(createrepo --update --database --exclude *smeserver-release*.rpm --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
print "rebuild $repo/$arch\n"; |
556 |
} else { |
unless ( $opts{t} ) { |
557 |
qx(createrepo --update --database --exclude *smeserver-release*.rpm --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
558 |
} |
|
559 |
} else { |
my $exclude = ""; |
560 |
if ( -f "$dir/repodata/comps.xml" ) { |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
561 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
562 |
} else { |
|
563 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
my $groupfile = ""; |
564 |
} |
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
565 |
} |
|
566 |
qx(repoview $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
567 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(repoview $dir); |
568 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
|
569 |
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
570 |
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
571 |
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
572 |
} |
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
573 |
} |
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
574 |
|
} |
575 |
|
} |
576 |
} |
} |
577 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
578 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
foreach (@{$distrepo->{$ver}->{'builds'}}) |
579 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
{ |
580 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
581 |
|
} |
582 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{'community'}) if -d "$distrepo->{$ver}->{'community'}"; |
583 |
} |
} |
584 |
} |
} |
585 |
|
|
602 |
my $pkgs = shift; |
my $pkgs = shift; |
603 |
|
|
604 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
605 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
606 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
607 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
608 |
$dest = $hirepo; |
$dest = $hirepo; |
609 |
last; |
last; |
610 |
} else { |
} else { |
611 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
612 |
} |
} |
613 |
} |
} |
614 |
return $dest; |
return $dest; |
615 |
} |
} |
627 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
628 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
629 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
630 |
my $nosig = ! $@; |
|
631 |
|
my $nosig = 1; |
632 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
633 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
634 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
635 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
636 |
|
|
637 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
638 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
639 |
return unless $cmp; |
return unless $cmp; |
640 |
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}; |
641 |
} |
} |
642 |
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$}; |
643 |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
644 |
return if $repos->{$repo}->{base} && $nosig; |
return if $onlypkg->{$ver}->{$repo} && !( $onlypkg->{$ver}->{$repo}->{$src} || $onlypkg->{$ver}->{$repo}->{$pkg->name} ); |
645 |
|
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
646 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
647 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
648 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
651 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
652 |
|
|
653 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
654 |
name => $pkg->name, |
name => $pkg->name, |
655 |
repo => $repo, |
repo => $repo, |
656 |
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') ), |
657 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
658 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
659 |
arch => $arch, |
arch => $arch, |
660 |
ver => $version, |
ver => $version, |
661 |
rel => $release, |
rel => $release, |
662 |
rpm => $pkg, |
rpm => $pkg, |
663 |
nosig => $nosig, |
nosig => $nosig, |
664 |
}; |
}; |
665 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
666 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
667 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
668 |
} else { |
} else { |
669 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
670 |
} |
} |
671 |
$sources{$src}++; |
$sources{$src}++; |
672 |
|
|
673 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
674 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
675 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
676 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
677 |
} |
} |
678 |
} elsif ( ( $repos->{$repo}->{prio} >= $repos->{$cmp->{repo}}->{prio} || ! $repos->{$cmp->{repo}}->{base} ) && $pkg ge $cmp->{rpm} ) { |
} elsif ( ( $repos->{$repo}->{prio} >= $repos->{$cmp->{repo}}->{prio} || ! $repos->{$cmp->{repo}}->{base} ) && $pkg ge $cmp->{rpm} ) { |
679 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
680 |
} |
} |
681 |
} |
} |