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 => 0, |
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 |
sign => 1, |
checksum => 'sha', |
41 |
checksum => 'sha', |
}, |
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 => 11, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
82 |
|
'remi' => { prio => 10, 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','libvorbis' , 'libogg' ) }, |
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 |
|
'centos' => { map { $_ => 1 } ( 'samba' ) }, |
140 |
|
'epel' => { map { $_ => 1 } ( 'clamav') }, |
141 |
|
}, |
142 |
|
}; |
143 |
|
|
144 |
|
# add here include only conditions |
145 |
|
# for each version if a repo is listed here, only listed rpm will be considered |
146 |
|
my $onlypkg = { '8' => { |
147 |
|
'remi' => { }, |
148 |
|
'remisafe' => { }, |
149 |
}, |
}, |
150 |
'8' => { active => 1, |
'9' => { |
151 |
centos => 5, |
'remi' => { }, |
|
repo => '/releases/testing/8/', |
|
|
os => '', |
|
|
builds => '/builds/smeserver-8-core/', |
|
|
community => '/builds/smeserver-8-contribs/', |
|
|
stage => '/stage/8/', |
|
|
sign => 1, |
|
|
checksum => 'sha', |
|
152 |
}, |
}, |
153 |
}; |
'10' => { |
154 |
|
'remi' => { map { $_ => 1 } ( 'php-pear' )}, |
155 |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
}, |
156 |
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
}; |
|
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
|
|
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
|
|
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
|
|
"${repotag}dev" => { prio => 12, 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/centos-vault/~C/fasttrack/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos-vault/~C/updates/~A/RPMS/' => 'centos', |
|
|
'/mirrors/centos-vault/~C/os/~A/CentOS/~O' => 'centos', |
|
|
'/mirrors/centos-vault/~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 } ( 'dovecot', 'mod_auth_tkt', 'perl-Test-Inline', 'perl-libwww-perl', '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', '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' ) }, |
|
|
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
|
|
}, |
|
|
}; |
|
157 |
|
|
158 |
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; |
159 |
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; |
168 |
%sources = (); |
%sources = (); |
169 |
%base = (); |
%base = (); |
170 |
|
|
171 |
|
@{$distrepo->{$ver}->{all_archs}} = ('noarch', @{$distrepo->{$ver}->{'archs'}}); |
172 |
|
if ( grep $_ eq 'i386', @{$distrepo->{$ver}->{'archs'}} ) { |
173 |
|
push @{$distrepo->{$ver}->{all_archs}}, ('i586', 'i686'); |
174 |
|
} |
175 |
|
|
176 |
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 ) { |
177 |
my $bdir = $dir; |
my $bdir = $dir; |
178 |
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
179 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
$bdir =~ s/~s/$ver/; |
180 |
$bdir =~ s/~s/$ver/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
181 |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
for my $arch ( @{$distrepo->{$ver}->{'archs'}}, 'SRPMS/' ) { |
182 |
for my $arch ( @archs, 'SRPMS/' ) { |
my $adir = $bdir; |
183 |
my $adir = $bdir; |
if ( $arch eq 'SRPMS/' ) { |
184 |
if ( $arch eq 'SRPMS/' ) { |
$adir =~ s/~A.*//; |
185 |
$adir =~ s/~A.*/$arch/; |
if ( -d "${adir}SRPMS" ) { |
186 |
} else { |
$adir .= "SRPMS/"; |
187 |
$adir =~ s/~A/$arch/; |
} elsif ( -d "${adir}Source/SPackages" ) { |
188 |
} |
$adir .= "Source/SPackages/"; |
189 |
opendir DIR, $adir or next; |
} |
190 |
next unless -d $adir; |
} else { |
191 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
$adir =~ s/~A/$arch/; |
192 |
closedir DIR; |
if ( -d "${adir}RPMS" ) { |
193 |
last unless $dir =~ m{~A}; |
$adir .= "RPMS/"; |
194 |
} |
} elsif ( -d "${adir}Packages" ) { |
195 |
|
$adir .= "Packages/"; |
196 |
|
} elsif ( -d "${adir}CentOS" ) { |
197 |
|
$adir .= "CentOS/"; |
198 |
|
} elsif ( -d "${adir}$osdir" ) { |
199 |
|
$adir .= "$osdir/"; |
200 |
|
} |
201 |
|
} |
202 |
|
next unless -d $adir; |
203 |
|
opendir DIR, $adir or next; |
204 |
|
my @txt = grep { /\.rpm$/ && -f "$adir/$_" } readdir DIR; |
205 |
|
closedir DIR; |
206 |
|
if (scalar(@txt)) { |
207 |
|
opendir DIR, $adir or next; |
208 |
|
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
209 |
|
closedir DIR; |
210 |
|
} elsif ($baserepo->{$dir} eq 'epel') { |
211 |
|
# EPEL 7 uses a structure with subfolders of first letter of package |
212 |
|
find( { wanted => sub { process_rpm($_, $ver, $baserepo->{$dir}) if ($_ =~ m/\.rpm$/);}, no_chdir => 1, follow_fast => 1 }, $adir ); |
213 |
|
} |
214 |
|
last unless $dir =~ m{~A}; |
215 |
|
} |
216 |
} |
} |
217 |
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'}}; |
218 |
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'}; |
219 |
|
|
220 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
221 |
next unless $rpms->{$base}->{rpms}; |
next unless $rpms->{$base}->{rpms}; |
222 |
my %track = (); |
my %track = (); |
223 |
my %seen = (); |
my %seen = (); |
224 |
my %counts = (); |
my %counts = (); |
225 |
my $acnt = (); |
my $acnt = (); |
226 |
my $print = 0; |
my $print = 0; |
227 |
%latest = (); |
%latest = (); |
228 |
|
|
229 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
230 |
next if $pkg->{done}; |
next if $pkg->{done}; |
231 |
|
|
232 |
my $tmp = $pkg->{svr}; |
my $tmp = $pkg->{svr}; |
233 |
# srpm transformations to match up binary and source rpms |
# srpm transformations to match up binary and source rpms |
234 |
SRC: { |
SRC: { |
235 |
# Try to find the name the binary wants (no changes) |
# Try to find the name the binary wants (no changes) |
236 |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
237 |
|
|
238 |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
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.rfx to .rf, rfb,rft,rfx switched to rf) |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
241 |
($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; |
242 |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
243 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
244 |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
245 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
246 |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
247 |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
248 |
|
|
249 |
# atrpms (remove .at) |
# atrpms (remove .at) |
250 |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
251 |
# atrpms (remove .el4.at) |
# atrpms (remove .el4.at) |
252 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
253 |
# atrpms (remove .el4) |
# atrpms (remove .el4) |
254 |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
255 |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
256 |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
257 |
|
|
258 |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
259 |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
260 |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
261 |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
262 |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
263 |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
264 |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
265 |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
266 |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
267 |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
268 |
} |
} |
269 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
270 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
271 |
$tmp->{svr} = $pkg->{svr}; |
$tmp->{svr} = $pkg->{svr}; |
272 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
273 |
$tmp->{added}++; |
$tmp->{added}++; |
274 |
} |
} |
275 |
} |
} |
276 |
|
|
277 |
my %orig = (); |
my %orig = (); |
278 |
my %pkgs = (); |
my %pkgs = (); |
279 |
my %reposrc = (); |
my %reposrc = (); |
280 |
my $srpm = undef; |
my $srpm = undef; |
281 |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
282 |
next unless $cmp->{svr} eq $pkg->{svr}; |
next unless $cmp->{svr} eq $pkg->{svr}; |
283 |
|
|
284 |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
285 |
if ( $cmp->{src} ) { |
if ( $cmp->{src} ) { |
286 |
if ( ! $track{repo} ) { |
if ( ! $track{repo} ) { |
287 |
$cmp->{delete}++; |
$cmp->{delete}++; |
288 |
$cmp->{done}++; |
$cmp->{done}++; |
289 |
next; |
next; |
290 |
} |
} |
291 |
} else { |
} else { |
292 |
$track{repo} = $cmp->{repo}; |
$track{repo} = $cmp->{repo}; |
293 |
$track{svr} = $cmp->{svr}; |
$track{svr} = $cmp->{svr}; |
294 |
} |
} |
295 |
} |
} |
296 |
if ( $cmp->{svr} eq $track{svr} ) { |
if ( $cmp->{svr} eq $track{svr} ) { |
297 |
if ( $seen{$cmp->{nvra}} ) { |
if ( $seen{$cmp->{nvra}} ) { |
298 |
if ( $track{repo} ne $cmp->{repo} ) { |
if ( $track{repo} ne $cmp->{repo} ) { |
299 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
if ($repos->{$cmp->{repo}}->{stage} ) { |
300 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
301 |
$seen{$cmp->{nvra}}->{latest}++; |
$seen{$cmp->{nvra}}->{latest}++; |
302 |
delete $cmp->{delete} if $cmp->{delete}; |
delete $cmp->{delete} if $cmp->{delete}; |
303 |
} else { |
} else { |
304 |
$cmp->{delete}++; |
$cmp->{delete}++; |
305 |
} |
} |
306 |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
307 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
308 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
309 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
310 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
311 |
} |
} |
312 |
} elsif ( $cmp->{src} ) { |
} elsif ( $cmp->{src} ) { |
313 |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
314 |
$cmp->{repo} = $cmp->{oldrepo}; |
$cmp->{repo} = $cmp->{oldrepo}; |
315 |
delete $cmp->{delete}; |
delete $cmp->{delete}; |
316 |
} |
} |
317 |
if ( $reposrc{$cmp->{repo}} ) { |
if ( $reposrc{$cmp->{repo}} ) { |
318 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
319 |
$srpm = $cmp if ! $srpm; |
$srpm = $cmp if ! $srpm; |
320 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
321 |
$cmp->{delete}++; |
$cmp->{delete}++; |
322 |
} |
} |
323 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
324 |
$cmp->{delete}++; |
$cmp->{delete}++; |
325 |
} |
} |
326 |
} elsif ( $cmp->{src} ) { |
} elsif ( $cmp->{src} ) { |
327 |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
328 |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
329 |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
330 |
]; |
]; |
331 |
|
|
332 |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
333 |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
334 |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
335 |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
336 |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
337 |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
338 |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
339 |
} else { |
} else { |
340 |
warn "How did I get here??"; |
warn "How did I get here??"; |
341 |
} |
} |
342 |
} else { |
} else { |
343 |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
344 |
} |
} |
345 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
346 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
347 |
} |
} |
348 |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
349 |
$cmp->{delete}++; |
$cmp->{delete}++; |
350 |
} else { |
} elsif ( $cmp->{src} || grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{all_archs}} ) { |
351 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
352 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
353 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
354 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
355 |
if ( $cmp->{repo} ne $dest ) { |
if ( $cmp->{repo} ne $dest ) { |
356 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
357 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
358 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
359 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
360 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
361 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
362 |
} |
} |
363 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
364 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
365 |
} else { |
} else { |
366 |
$cmp->{delete}++; |
$cmp->{delete}++; |
367 |
} |
} |
368 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
369 |
$cmp->{repo} = $dest; |
$cmp->{repo} = $dest; |
370 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
371 |
$track{repo} = $dest; |
$track{repo} = $dest; |
372 |
$track{svr} = $cmp->{svr}; |
$track{svr} = $cmp->{svr}; |
373 |
} |
} |
374 |
} |
} |
375 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
376 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
377 |
} |
} |
378 |
} |
} |
379 |
} else { |
} else { |
380 |
if ( $track{repo} eq $cmp->{repo} ) { |
if ( $track{repo} eq $cmp->{repo} ) { |
381 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
382 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
383 |
} elsif ( $cmp->{src} ) { |
} elsif ( $cmp->{src} ) { |
384 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
385 |
} else { |
} else { |
386 |
$track{svr} = $cmp->{svr}; |
$track{svr} = $cmp->{svr}; |
387 |
} |
} |
388 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
389 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
390 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
391 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
392 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
393 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
394 |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
395 |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
396 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
397 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
398 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
399 |
} |
} |
400 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
401 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
402 |
$cmp->{repo} = $dest; |
$cmp->{repo} = $dest; |
403 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
404 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
405 |
} |
} |
406 |
} |
} |
407 |
} else { |
} else { |
408 |
$cmp->{delete}++; |
$cmp->{delete}++; |
409 |
} |
} |
410 |
} |
} |
411 |
} |
} |
412 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
413 |
$pkgs{$cmp->{nvra}}++; |
$pkgs{$cmp->{nvra}}++; |
414 |
$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}}; |
415 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
416 |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
417 |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
418 |
} |
} |
419 |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
420 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
421 |
} |
} |
422 |
$cmp->{done}++; |
$cmp->{done}++; |
423 |
} |
} |
424 |
if ( $srpm ) { |
if ( $srpm ) { |
425 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
426 |
unless ( $reposrc{$r}->{srpm} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
427 |
unshift @{$srpm->{repos}}, $r; |
unshift @{$srpm->{repos}}, $r; |
428 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
429 |
$srpm->{repo} = $r; |
$srpm->{repo} = $r; |
430 |
$reposrc{$r}->{srpm} = $srpm; |
$reposrc{$r}->{srpm} = $srpm; |
431 |
} |
} |
432 |
} |
} |
433 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
434 |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
435 |
} |
} |
436 |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $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; |
437 |
} |
} |
438 |
|
|
439 |
foreach my $r ( keys %$acnt ) { |
foreach my $r ( keys %$acnt ) { |
440 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
foreach my $p ( keys %{$acnt->{$r}} ) { |
441 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
442 |
if ( $a eq 'noarch' ) { |
if ( $a eq 'noarch' ) { |
443 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
444 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
445 |
$p2->{oldrepo} = $p2->{repo}; |
$p2->{oldrepo} = $p2->{repo}; |
446 |
push @{$p2->{repos}}, $p2->{repo}; |
push @{$p2->{repos}}, $p2->{repo}; |
447 |
} |
} |
448 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
449 |
print "\n * many packages ($r, $a, $p)\n"; |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
450 |
} |
} |
451 |
} |
} |
452 |
} |
} |
453 |
} |
} |
454 |
|
|
455 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
456 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
457 |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
458 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
459 |
$pkg->{repo} = $stage; |
$pkg->{repo} = $stage; |
460 |
push @{$pkg->{repos}}, $stage; |
push @{$pkg->{repos}}, $stage; |
461 |
} |
} |
462 |
} |
} |
463 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
|
464 |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
465 |
$print++; |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
466 |
} |
$print++; |
467 |
|
} |
468 |
my $src = $pkg->{rpm}->filename; |
|
469 |
if ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
my $src = $pkg->{rpm}->filename; |
470 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
471 |
unless ( $opts{t} ) { |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
472 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
unless ( $opts{t} ) { |
473 |
if ($?) { |
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
474 |
print " * failed to sign package\n"; |
if ($?) { |
475 |
next; |
print " * failed to sign package\n"; |
476 |
} |
next; |
477 |
} |
} |
478 |
} |
} |
479 |
|
} |
480 |
if ( $pkg->{repos} ) { |
|
481 |
foreach my $repo ( @{$pkg->{repos}} ) { |
if ( $pkg->{repos} ) { |
482 |
if ( $pkg->{delete} ) { |
foreach my $repo ( @{$pkg->{repos}} ) { |
483 |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
if ( $pkg->{delete} ) { |
484 |
$pkg->{delete} = 0; |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
485 |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
$pkg->{delete} = 0; |
486 |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
487 |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
488 |
} else { |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
489 |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} else { |
490 |
} |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
491 |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
} |
492 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
493 |
|
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
494 |
my @d = (); |
|
495 |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
my @d = (); |
496 |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
497 |
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
498 |
if ( $pkg->{src} ) { |
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
499 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
if ( $pkg->{src} ) { |
500 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
501 |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
502 |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
503 |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
} elsif ($ver>=10 && $pkg->{rpm}->arch =~ m{^(i[356]86)$} && $pkg->{arch} =~ m{^(x86_64)$} ) { |
504 |
} else { |
#add copy of i686 packages in x86_64 folder for SME>=10 |
505 |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
506 |
} |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
507 |
foreach my $dest ( @d ) { |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
508 |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
} else { |
509 |
} |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
510 |
|
} |
511 |
} |
foreach my $dest ( @d ) { |
512 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
513 |
} elsif ( $pkg->{delete} ) { |
} |
514 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
|
515 |
qx(rm -f $src) unless $opts{t}; |
} |
516 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
517 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
} elsif ( $pkg->{delete} ) { |
518 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
519 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
qx(rm -f $src) unless $opts{t}; |
520 |
} |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
521 |
} |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
522 |
} |
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
523 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
524 |
if ( $rpms->{$base}->{srpms} ) { |
} |
525 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
} |
526 |
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
} |
527 |
$pkg->{delete}++; |
|
528 |
my $src = $pkg->{rpm}->filename; |
if ( $rpms->{$base}->{srpms} ) { |
529 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
530 |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
531 |
$print++; |
$pkg->{delete}++; |
532 |
} |
my $src = $pkg->{rpm}->filename; |
533 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
534 |
qx(rm -f $src) unless $opts{t}; |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
535 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$print++; |
536 |
} |
} |
537 |
} |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
538 |
|
qx(rm -f $src) unless $opts{t}; |
539 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
540 |
|
} |
541 |
|
} |
542 |
} |
} |
543 |
|
|
544 |
if ( %repochg ) { |
if ( %repochg ) { |
545 |
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"; |
546 |
} |
} |
547 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
548 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
549 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
550 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
551 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
552 |
chomp $dir; |
if ( $dir ) { |
553 |
print "rebuild $repo/$arch\n"; |
chomp $dir; |
554 |
unless ( $opts{t} ) { |
} else { |
555 |
|
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
556 |
|
} |
557 |
|
print "rebuild $repo/$arch\n"; |
558 |
|
unless ( $opts{t} ) { |
559 |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
560 |
|
|
561 |
my $exclude = ""; |
my $exclude = ""; |
562 |
$exclude = "--exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
563 |
|
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
564 |
|
|
565 |
my $groupfile = ""; |
my $groupfile = ""; |
566 |
$groupfile = "--groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
567 |
|
|
568 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
569 |
qx(repoview $dir); |
qx(repoview $dir); |
570 |
|
|
571 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
572 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
573 |
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
574 |
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
575 |
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
576 |
} |
} |
577 |
} |
} |
578 |
} |
} |
579 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
580 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
foreach (@{$distrepo->{$ver}->{'builds'}}) |
581 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
{ |
582 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
583 |
|
} |
584 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{'community'}) if -d "$distrepo->{$ver}->{'community'}"; |
585 |
} |
} |
586 |
} |
} |
587 |
|
|
604 |
my $pkgs = shift; |
my $pkgs = shift; |
605 |
|
|
606 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
607 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
608 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
609 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
610 |
$dest = $hirepo; |
$dest = $hirepo; |
611 |
last; |
last; |
612 |
} else { |
} else { |
613 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
614 |
} |
} |
615 |
} |
} |
616 |
return $dest; |
return $dest; |
617 |
} |
} |
629 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
630 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
631 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
632 |
my $nosig = ! $@; |
|
633 |
|
my $nosig = 1; |
634 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
635 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
636 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
637 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
638 |
|
|
639 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
640 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
641 |
return unless $cmp; |
return unless $cmp; |
642 |
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}; |
643 |
} |
} |
644 |
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$}; |
645 |
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} ); |
646 |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
return if $onlypkg->{$ver}->{$repo} && !( $onlypkg->{$ver}->{$repo}->{$src} || $onlypkg->{$ver}->{$repo}->{$pkg->name} ); |
647 |
|
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
648 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
649 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
650 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
653 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
654 |
|
|
655 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
656 |
name => $pkg->name, |
name => $pkg->name, |
657 |
repo => $repo, |
repo => $repo, |
658 |
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') ), |
659 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
660 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
661 |
arch => $arch, |
arch => $arch, |
662 |
ver => $version, |
ver => $version, |
663 |
rel => $release, |
rel => $release, |
664 |
rpm => $pkg, |
rpm => $pkg, |
665 |
nosig => $nosig, |
nosig => $nosig, |
666 |
}; |
}; |
667 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
668 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
669 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
670 |
} else { |
} else { |
671 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
672 |
} |
} |
673 |
$sources{$src}++; |
$sources{$src}++; |
674 |
|
|
675 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
676 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
677 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
678 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
679 |
} |
} |
680 |
} 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} ) { |
681 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
682 |
} |
} |
683 |
} |
} |