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