14 |
$| = 1; |
$| = 1; |
15 |
|
|
16 |
my %opts; |
my %opts; |
17 |
getopts( 'osqtr:', \%opts ); |
getopts( 'ostr:', \%opts ); |
18 |
$opts{r} ||= ''; |
$opts{r} ||= ''; |
19 |
|
|
20 |
my $rpm_flags = RPM2->vsf_nosha1header | RPM2->vsf_nomd5header | RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader; |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
$rpm_flags |= RPM2->vsf_nosha1 | RPM2->vsf_nomd5 | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
21 |
|
|
22 |
my $osdir = 'SME'; |
my $osdir = 'SME'; |
23 |
my $disttag = 'sme'; |
my $disttag = 'sme'; |
25 |
|
|
26 |
my @archs = ( 'i386', 'x86_64' ); |
my @archs = ( 'i386', 'x86_64' ); |
27 |
|
|
28 |
my $distrepo = { '7' => { active => 1, |
my $distrepo = { '8' => { active => 1, |
|
centos => 4, |
|
|
repo => '/releases/7/', |
|
|
os => 'RPMS/', |
|
|
builds => '/builds/smeserver-7-core/', |
|
|
community => '/builds/smeserver-7-contribs/', |
|
|
stage => '/stage/7/', |
|
|
}, |
|
|
'8' => { active => 1, |
|
29 |
centos => 5, |
centos => 5, |
30 |
repo => '/releases/testing/8/', |
repo => '/build/smeserver/repo/8/', |
31 |
os => '', |
builds => ['/build/builds/smeserver-8-core/'], |
32 |
builds => '/builds/smeserver-8-core/', |
community => '/build/builds/smeserver-8-contribs/', |
33 |
community => '/builds/smeserver-8-contribs/', |
stage => '/build/smeserver/stage/8/', |
34 |
stage => '/stage/8/', |
sign => 1, |
35 |
|
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
36 |
|
checksum => 'sha', |
37 |
|
}, |
38 |
|
'9' => { active => 1, |
39 |
|
centos => 6, |
40 |
|
repo => '/build/smeserver/repo/9/', |
41 |
|
builds => ['/build/builds/smeserver-9-core/'], |
42 |
|
community => '/build/builds/smeserver-9-contribs/', |
43 |
|
stage => '/build/smeserver/stage/9/', |
44 |
|
sign => 1, |
45 |
|
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
46 |
|
checksum => 'sha256', |
47 |
}, |
}, |
48 |
}; |
}; |
49 |
|
|
50 |
my $repos = { "${repotag}os" => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
51 |
"${repotag}updates" => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
52 |
"${repotag}updates-testing" => { prio => 16, inc => 1, ver => 1, rel => 3 }, |
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
53 |
"${repotag}extras" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
54 |
"${repotag}addons" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
55 |
"${repotag}contribs" => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
56 |
"${repotag}test" => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
57 |
"${repotag}dev" => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
58 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
59 |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
60 |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
64 |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
65 |
}; |
}; |
66 |
|
|
67 |
my $baserepo = { "~S${repotag}os/~A/$osdir/~O" => "${repotag}os", |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
68 |
"~S${repotag}updates/~A/RPMS/" => "${repotag}updates", |
"~S${repotag}updates/~A/" => "${repotag}updates", |
69 |
"~S${repotag}updates-testing/~A/RPMS/" => "${repotag}updates-testing", |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
70 |
"~S${repotag}extras/~A/RPMS/" => "${repotag}extras", |
"~S${repotag}extras/~A/" => "${repotag}extras", |
71 |
"~S${repotag}addons/~A/RPMS/" => "${repotag}addons", |
"~S${repotag}addons/~A/" => "${repotag}addons", |
72 |
"~S${repotag}contribs/~A/RPMS/" => "${repotag}contribs", |
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
73 |
"~S${repotag}test/~A/RPMS/" => "${repotag}test", |
"~S${repotag}test/~A/" => "${repotag}test", |
74 |
"~S${repotag}dev/~A/RPMS/" => "${repotag}dev", |
"~S${repotag}dev/~A/" => "${repotag}dev", |
75 |
"/stage/~s/~A/$osdir/~O" => 'stage', |
"/build/smeserver/stage/~s/~A/" => 'stage', |
76 |
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
77 |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/updates/~A/' => 'centos', |
78 |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
'/mirrors/centos/~C/os/~A/' => 'centos', |
79 |
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/extras/~A/' => 'centos', |
80 |
|
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
81 |
|
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
82 |
|
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
83 |
|
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
84 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
85 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
86 |
'/mirrors/rpmforge/dag/redhat/el~C/en/~A/dag/RPMS/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
87 |
'/mirrors/rpmforge/dag/source/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
88 |
|
'/mirrors/rpmforge/source/' => 'rpmforge', |
89 |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
90 |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
91 |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
92 |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
93 |
}; |
}; |
94 |
|
|
95 |
if ( $opts{q} ) { |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
96 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
97 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
'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' ) }, |
98 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
|
$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' ) }, |
|
|
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
|
|
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
|
99 |
}, |
}, |
100 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
101 |
'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' ) }, |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
102 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
103 |
}, |
}, |
104 |
}; |
}; |
105 |
|
|
118 |
|
|
119 |
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 ) { |
120 |
my $bdir = $dir; |
my $bdir = $dir; |
|
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
|
121 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
122 |
$bdir =~ s/~s/$ver/; |
$bdir =~ s/~s/$ver/; |
123 |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
124 |
for my $arch ( @archs, 'SRPMS/' ) { |
for my $arch ( @archs, 'SRPMS/' ) { |
125 |
my $adir = $bdir; |
my $adir = $bdir; |
126 |
if ( $arch eq 'SRPMS/' ) { |
if ( $arch eq 'SRPMS/' ) { |
127 |
$adir =~ s/~A.*/$arch/ if $arch eq 'SRPMS/'; |
$adir =~ s/~A.*//; |
128 |
|
if ( -d "${adir}SRPMS" ) { |
129 |
|
$adir .= "SRPMS/"; |
130 |
|
} elsif ( -d "${adir}Source/SPackages" ) { |
131 |
|
$adir .= "Source/SPackages/"; |
132 |
|
} |
133 |
} else { |
} else { |
134 |
$adir =~ s/~A/$arch/; |
$adir =~ s/~A/$arch/; |
135 |
|
if ( -d "${adir}RPMS" ) { |
136 |
|
$adir .= "RPMS/"; |
137 |
|
} elsif ( -d "${adir}Packages" ) { |
138 |
|
$adir .= "Packages/"; |
139 |
|
} elsif ( -d "${adir}CentOS" ) { |
140 |
|
$adir .= "CentOS/"; |
141 |
|
} elsif ( -d "${adir}$osdir" ) { |
142 |
|
$adir .= "$osdir/"; |
143 |
|
} |
144 |
} |
} |
|
opendir DIR, $adir or next; |
|
145 |
next unless -d $adir; |
next unless -d $adir; |
146 |
|
opendir DIR, $adir or next; |
147 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
148 |
closedir DIR; |
closedir DIR; |
149 |
last unless $dir =~ m{~A}; |
last unless $dir =~ m{~A}; |
150 |
} |
} |
151 |
} |
} |
152 |
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'}}; |
153 |
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'}; |
154 |
|
|
155 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
165 |
next if $pkg->{done}; |
next if $pkg->{done}; |
166 |
|
|
167 |
my $tmp = $pkg->{svr}; |
my $tmp = $pkg->{svr}; |
168 |
|
# srpm transformations to match up binary and source rpms |
169 |
SRC: { |
SRC: { |
170 |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
# Try to find the name the binary wants (no changes) |
171 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
172 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
|
173 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
174 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf[btx]?)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
175 |
($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
176 |
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
177 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
178 |
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
179 |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
180 |
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
181 |
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
182 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
183 |
|
|
184 |
|
# atrpms (remove .at) |
185 |
|
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
186 |
|
# atrpms (remove .el4.at) |
187 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
188 |
|
# atrpms (remove .el4) |
189 |
|
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
190 |
|
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
191 |
|
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
192 |
|
|
193 |
|
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
194 |
|
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
195 |
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
196 |
|
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
197 |
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
198 |
|
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
199 |
|
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
200 |
|
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
201 |
|
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
202 |
|
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
203 |
} |
} |
204 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
205 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
234 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
if ($repos->{$cmp->{repo}}->{stage} ) { |
235 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
236 |
$seen{$cmp->{nvra}}->{latest}++; |
$seen{$cmp->{nvra}}->{latest}++; |
237 |
|
delete $cmp->{delete} if $cmp->{delete}; |
238 |
} else { |
} else { |
239 |
$cmp->{delete}++; |
$cmp->{delete}++; |
240 |
} |
} |
241 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
242 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
243 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
244 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
245 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
246 |
} |
} |
247 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} elsif ( $cmp->{src} ) { |
248 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
249 |
|
$cmp->{repo} = $cmp->{oldrepo}; |
250 |
|
delete $cmp->{delete}; |
251 |
|
} |
252 |
|
if ( $reposrc{$cmp->{repo}} ) { |
253 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
254 |
|
$srpm = $cmp if ! $srpm; |
255 |
|
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
256 |
|
$cmp->{delete}++; |
257 |
|
} |
258 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
259 |
$cmp->{delete}++; |
$cmp->{delete}++; |
260 |
} |
} |
261 |
|
} elsif ( $cmp->{src} ) { |
262 |
|
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
263 |
|
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
264 |
|
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
265 |
|
]; |
266 |
|
|
267 |
|
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
268 |
|
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
269 |
|
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
270 |
|
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
271 |
|
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
272 |
|
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
273 |
|
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
274 |
|
} else { |
275 |
|
warn "How did I get here??"; |
276 |
|
} |
277 |
|
} else { |
278 |
|
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
279 |
|
} |
280 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
281 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
282 |
} |
} |
283 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
284 |
$cmp->{delete}++; |
$cmp->{delete}++; |
285 |
} else { |
} else { |
286 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
292 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
293 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
294 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
295 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
296 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
297 |
} |
} |
298 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
326 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
327 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
328 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
329 |
if ( $cmp->{src} && ! $reposrc{$dest} ) { |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
330 |
$cmp->{delete}++; |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
331 |
} elsif ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
332 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
333 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
334 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
} |
335 |
|
push @{$cmp->{repos}}, $dest; |
336 |
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
337 |
|
$cmp->{repo} = $dest; |
338 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
339 |
|
$orig{$cmp->{nvra}}++; |
340 |
} |
} |
|
push @{$cmp->{repos}}, $dest; |
|
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
|
|
$cmp->{repo} = $dest; |
|
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
|
|
$orig{$cmp->{nvra}}++; |
|
|
} else { |
|
|
$cmp->{delete}++; |
|
341 |
} |
} |
342 |
} else { |
} else { |
343 |
$cmp->{delete}++; |
$cmp->{delete}++; |
348 |
$pkgs{$cmp->{nvra}}++; |
$pkgs{$cmp->{nvra}}++; |
349 |
$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}}; |
350 |
$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}; |
351 |
unless ( $seen{$cmp->{nvra}} ) { |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
352 |
$seen{$cmp->{nvra}} = $cmp; |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
|
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
|
353 |
} |
} |
354 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp; |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
355 |
|
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
356 |
} |
} |
357 |
$cmp->{done}++; |
$cmp->{done}++; |
358 |
} |
} |
389 |
|
|
390 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
391 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
392 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
393 |
$pkg->{repo} = $stage; |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
394 |
push @{$pkg->{repos}}, $stage; |
$pkg->{repo} = $stage; |
395 |
} |
push @{$pkg->{repos}}, $stage; |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
|
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
|
|
$print++; |
|
|
} |
|
|
|
|
|
my $src = $pkg->{rpm}->filename; |
|
|
if ( $pkg->{nosig} ) { |
|
|
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
|
|
unless ( $opts{t} ) { |
|
|
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
|
|
if ($?) { |
|
|
print " * failed to sign package\n"; |
|
|
next; |
|
|
} |
|
396 |
} |
} |
397 |
} |
} |
398 |
|
|
399 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
400 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
401 |
|
$print++; |
402 |
|
} |
403 |
|
|
404 |
|
my $src = $pkg->{rpm}->filename; |
405 |
|
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
406 |
|
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
407 |
|
unless ( $opts{t} ) { |
408 |
|
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
409 |
|
if ($?) { |
410 |
|
print " * failed to sign package\n"; |
411 |
|
next; |
412 |
|
} |
413 |
|
} |
414 |
|
} |
415 |
|
|
416 |
if ( $pkg->{repos} ) { |
if ( $pkg->{repos} ) { |
417 |
foreach my $repo ( @{$pkg->{repos}} ) { |
foreach my $repo ( @{$pkg->{repos}} ) { |
418 |
if ( $pkg->{delete} ) { |
if ( $pkg->{delete} ) { |
430 |
my @d = (); |
my @d = (); |
431 |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
432 |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
433 |
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
434 |
if ( $pkg->{src} ) { |
if ( $pkg->{src} ) { |
435 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
436 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
451 |
qx(rm -f $src) unless $opts{t}; |
qx(rm -f $src) unless $opts{t}; |
452 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
453 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
454 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
455 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
456 |
} |
} |
457 |
} |
} |
458 |
} |
} |
459 |
|
|
460 |
|
if ( $rpms->{$base}->{srpms} ) { |
461 |
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
462 |
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
463 |
|
$pkg->{delete}++; |
464 |
|
my $src = $pkg->{rpm}->filename; |
465 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
466 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
467 |
|
$print++; |
468 |
|
} |
469 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
470 |
|
qx(rm -f $src) unless $opts{t}; |
471 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
472 |
|
} |
473 |
|
} |
474 |
} |
} |
475 |
|
|
476 |
if ( %repochg ) { |
if ( %repochg ) { |
481 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
482 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
483 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
484 |
chomp $dir; |
if ( $dir ) { |
485 |
|
chomp $dir; |
486 |
|
} else { |
487 |
|
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
488 |
|
} |
489 |
print "rebuild $repo/$arch\n"; |
print "rebuild $repo/$arch\n"; |
490 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
491 |
if ( -f "$dir/repodata/comps.xml" ) { |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
492 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
|
493 |
} else { |
my $exclude = ""; |
494 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
495 |
} |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
496 |
|
|
497 |
|
my $groupfile = ""; |
498 |
|
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
499 |
|
|
500 |
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
501 |
qx(repoview $dir); |
qx(repoview $dir); |
502 |
|
|
503 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
504 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
505 |
|
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
506 |
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
507 |
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
508 |
} |
} |
509 |
} |
} |
510 |
} |
} |
511 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
512 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
foreach (@{$distrepo->{$ver}->{builds}}) |
513 |
|
{ |
514 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
515 |
|
} |
516 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
517 |
} |
} |
518 |
} |
} |
561 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
562 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
563 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
564 |
my $nosig = ! $@; |
|
565 |
|
my $nosig = 1; |
566 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
567 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
568 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
569 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
570 |
|
|
571 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
572 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
573 |
return unless $cmp; |
return unless $cmp; |
575 |
} |
} |
576 |
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$}; |
577 |
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} ); |
578 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
579 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
580 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
581 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |