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'; |
24 |
my $repotag = 'sme'; |
my $repotag = 'sme'; |
25 |
|
|
26 |
my @archs = ( 'i386', 'x86_64' ); |
my $distrepo = { '8' => { active => 1, |
27 |
|
centos => 5, |
28 |
my $distrepo = { '7' => { active => 1, |
archs => [ 'i386', 'x86_64' ], |
29 |
centos => 4, |
repo => '/build/smeserver/repo/8/', |
30 |
repo => '/releases/7/', |
builds => ['/build/builds/smeserver-8-core/'], |
31 |
os => 'RPMS/', |
community => '/build/builds/smeserver-8-contribs/', |
32 |
builds => '/builds/smeserver-7-core/', |
stage => '/build/smeserver/stage/8/', |
33 |
community => '/builds/smeserver-7-contribs/', |
sign => 1, |
34 |
stage => '/stage/7/', |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
35 |
}, |
checksum => 'sha', |
36 |
'8' => { active => 1, |
}, |
37 |
centos => 5, |
'9' => { active => 1, |
38 |
repo => '/releases/testing/8/', |
centos => 6, |
39 |
os => '', |
archs => [ 'i386', 'x86_64' ], |
40 |
builds => '/builds/smeserver-8-core/', |
repo => '/build/smeserver/repo/9/', |
41 |
community => '/builds/smeserver-8-contribs/', |
builds => ['/build/builds/smeserver-9-core/'], |
42 |
stage => '/stage/8/', |
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 |
my $repos = { "${repotag}os" => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
checksum => 'sha256', |
47 |
"${repotag}updates" => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
}, |
48 |
"${repotag}updates-testing" => { prio => 16, inc => 1, ver => 1, rel => 3 }, |
'10' => { active => 0, |
49 |
"${repotag}extras" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
centos => 7, |
50 |
"${repotag}addons" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
archs => [ 'x86_64' ], |
51 |
"${repotag}contribs" => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
repo => '/build/smeserver/repo/testing/10/', |
52 |
"${repotag}test" => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
builds => ['/build/builds/smeserver-10-core/'], |
53 |
"${repotag}dev" => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
community => '/build/builds/smeserver-10-contribs/', |
54 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
stage => '/build/smeserver/stage/10/', |
55 |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
sign => 1, |
56 |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
57 |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
checksum => 'sha256', |
58 |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
}, |
59 |
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
}; |
60 |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
|
61 |
}; |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
62 |
|
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
63 |
my $baserepo = { "~S${repotag}os/~A/$osdir/~O" => "${repotag}os", |
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
64 |
"~S${repotag}updates/~A/RPMS/" => "${repotag}updates", |
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
65 |
"~S${repotag}updates-testing/~A/RPMS/" => "${repotag}updates-testing", |
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
66 |
"~S${repotag}extras/~A/RPMS/" => "${repotag}extras", |
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
67 |
"~S${repotag}addons/~A/RPMS/" => "${repotag}addons", |
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
68 |
"~S${repotag}contribs/~A/RPMS/" => "${repotag}contribs", |
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
69 |
"~S${repotag}test/~A/RPMS/" => "${repotag}test", |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
70 |
"~S${repotag}dev/~A/RPMS/" => "${repotag}dev", |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
71 |
"/stage/~s/~A/$osdir/~O" => 'stage', |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
72 |
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
73 |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
74 |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
'community' => { prio => 2, inc => 0, ver => 0, rel => 0, orig => 1 }, |
75 |
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
76 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
}; |
77 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
|
78 |
'/mirrors/rpmforge/dag/redhat/el~C/en/~A/dag/RPMS/' => 'rpmforge', |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
79 |
'/mirrors/rpmforge/dag/source/' => 'rpmforge', |
"~S${repotag}updates/~A/" => "${repotag}updates", |
80 |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
81 |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
"~S${repotag}extras/~A/" => "${repotag}extras", |
82 |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
"~S${repotag}addons/~A/" => "${repotag}addons", |
83 |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
84 |
}; |
"~S${repotag}test/~A/" => "${repotag}test", |
85 |
|
"~S${repotag}dev/~A/" => "${repotag}dev", |
86 |
if ( $opts{q} ) { |
"/build/smeserver/stage/~s/~A/" => 'stage', |
87 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
88 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
'/mirrors/centos/~C/updates/~A/' => 'centos', |
89 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
'/mirrors/centos/~C/os/~A/' => 'centos', |
90 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
'/mirrors/centos/~C/extras/~A/' => 'centos', |
91 |
} |
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
92 |
|
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
93 |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
94 |
'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' ) }, |
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
95 |
'rpmforge' => { map { $_ => 1 } ( 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
96 |
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
97 |
}, |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
98 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
99 |
'epel' => { map { $_ => 1 } ( 'clamav', 'horde', 'libtalloc', 'libtdb', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'proftpd', 'smolt' ) }, |
'/mirrors/rpmforge/source/' => 'rpmforge', |
100 |
'rpmforge' => { map { $_ => 1 } ( 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
101 |
}, |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
102 |
}; |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
103 |
|
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
104 |
|
}; |
105 |
|
|
106 |
|
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
107 |
|
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
108 |
|
'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' ) }, |
109 |
|
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
110 |
|
}, |
111 |
|
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
112 |
|
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
113 |
|
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
114 |
|
}, |
115 |
|
'10' => { |
116 |
|
}, |
117 |
|
}; |
118 |
|
|
119 |
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; |
120 |
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; |
129 |
%sources = (); |
%sources = (); |
130 |
%base = (); |
%base = (); |
131 |
|
|
132 |
|
@{$distrepo->{$ver}->{all_archs}} = ('noarch', @{$distrepo->{$ver}->{'archs'}}); |
133 |
|
if ( grep $_ eq 'i386', @{$distrepo->{$ver}->{'archs'}} ) { |
134 |
|
push @{$distrepo->{$ver}->{all_archs}}, ('i586', 'i686'); |
135 |
|
} |
136 |
|
|
137 |
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 ) { |
138 |
my $bdir = $dir; |
my $bdir = $dir; |
139 |
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
140 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
$bdir =~ s/~s/$ver/; |
141 |
$bdir =~ s/~s/$ver/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
142 |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
for my $arch ( @{$distrepo->{$ver}->{'archs'}}, 'SRPMS/' ) { |
143 |
for my $arch ( @archs, 'SRPMS/' ) { |
my $adir = $bdir; |
144 |
my $adir = $bdir; |
if ( $arch eq 'SRPMS/' ) { |
145 |
if ( $arch eq 'SRPMS/' ) { |
$adir =~ s/~A.*//; |
146 |
$adir =~ s/~A.*/$arch/ if $arch eq 'SRPMS/'; |
if ( -d "${adir}SRPMS" ) { |
147 |
} else { |
$adir .= "SRPMS/"; |
148 |
$adir =~ s/~A/$arch/; |
} elsif ( -d "${adir}Source/SPackages" ) { |
149 |
} |
$adir .= "Source/SPackages/"; |
150 |
opendir DIR, $adir or next; |
} |
151 |
next unless -d $adir; |
} else { |
152 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
$adir =~ s/~A/$arch/; |
153 |
closedir DIR; |
if ( -d "${adir}RPMS" ) { |
154 |
last unless $dir =~ m{~A}; |
$adir .= "RPMS/"; |
155 |
} |
} elsif ( -d "${adir}Packages" ) { |
156 |
|
$adir .= "Packages/"; |
157 |
|
} elsif ( -d "${adir}CentOS" ) { |
158 |
|
$adir .= "CentOS/"; |
159 |
|
} elsif ( -d "${adir}$osdir" ) { |
160 |
|
$adir .= "$osdir/"; |
161 |
|
} |
162 |
|
} |
163 |
|
next unless -d $adir; |
164 |
|
opendir DIR, $adir or next; |
165 |
|
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
166 |
|
closedir DIR; |
167 |
|
last unless $dir =~ m{~A}; |
168 |
|
} |
169 |
} |
} |
170 |
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'}}; |
171 |
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'}; |
172 |
|
|
173 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
174 |
next unless $rpms->{$base}->{rpms}; |
next unless $rpms->{$base}->{rpms}; |
175 |
my %track = (); |
my %track = (); |
176 |
my %seen = (); |
my %seen = (); |
177 |
my %counts = (); |
my %counts = (); |
178 |
my $acnt = (); |
my $acnt = (); |
179 |
my $print = 0; |
my $print = 0; |
180 |
%latest = (); |
%latest = (); |
181 |
|
|
182 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
183 |
next if $pkg->{done}; |
next if $pkg->{done}; |
184 |
|
|
185 |
my $tmp = $pkg->{svr}; |
my $tmp = $pkg->{svr}; |
186 |
SRC: { |
# srpm transformations to match up binary and source rpms |
187 |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
SRC: { |
188 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# Try to find the name the binary wants (no changes) |
189 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
190 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
|
191 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .rf, with rf,rfb,rft,rfx endings) |
192 |
($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf[btx]?)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
193 |
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
194 |
($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; |
195 |
($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
196 |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
197 |
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
198 |
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
199 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
200 |
} |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
201 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
|
202 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
# atrpms (remove .at) |
203 |
$tmp->{svr} = $pkg->{svr}; |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
204 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
# atrpms (remove .el4.at) |
205 |
$tmp->{added}++; |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
206 |
} |
# atrpms (remove .el4) |
207 |
} |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
208 |
|
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
209 |
my %orig = (); |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
210 |
my %pkgs = (); |
|
211 |
my %reposrc = (); |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
212 |
my $srpm = undef; |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
213 |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
214 |
next unless $cmp->{svr} eq $pkg->{svr}; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
215 |
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
216 |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
217 |
if ( $cmp->{src} ) { |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
218 |
if ( ! $track{repo} ) { |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
219 |
$cmp->{delete}++; |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
220 |
$cmp->{done}++; |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
221 |
next; |
} |
222 |
} |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
223 |
} else { |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
224 |
$track{repo} = $cmp->{repo}; |
$tmp->{svr} = $pkg->{svr}; |
225 |
$track{svr} = $cmp->{svr}; |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
226 |
} |
$tmp->{added}++; |
227 |
} |
} |
228 |
if ( $cmp->{svr} eq $track{svr} ) { |
} |
229 |
if ( $seen{$cmp->{nvra}} ) { |
|
230 |
if ( $track{repo} ne $cmp->{repo} ) { |
my %orig = (); |
231 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
my %pkgs = (); |
232 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
my %reposrc = (); |
233 |
$seen{$cmp->{nvra}}->{latest}++; |
my $srpm = undef; |
234 |
} else { |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
235 |
$cmp->{delete}++; |
next unless $cmp->{svr} eq $pkg->{svr}; |
236 |
} |
|
237 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
238 |
$orig{$cmp->{nvra}}++; |
if ( $cmp->{src} ) { |
239 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
if ( ! $track{repo} ) { |
240 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
$cmp->{delete}++; |
241 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
$cmp->{done}++; |
242 |
} |
next; |
243 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} |
244 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
} else { |
245 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
$track{repo} = $cmp->{repo}; |
246 |
$cmp->{delete}++; |
$track{svr} = $cmp->{svr}; |
247 |
} |
} |
248 |
} |
} |
249 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
if ( $cmp->{svr} eq $track{svr} ) { |
250 |
$cmp->{delete}++; |
if ( $seen{$cmp->{nvra}} ) { |
251 |
} else { |
if ( $track{repo} ne $cmp->{repo} ) { |
252 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
if ($repos->{$cmp->{repo}}->{stage} ) { |
253 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
254 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$seen{$cmp->{nvra}}->{latest}++; |
255 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
delete $cmp->{delete} if $cmp->{delete}; |
256 |
if ( $cmp->{repo} ne $dest ) { |
} else { |
257 |
push @{$cmp->{repos}}, $dest; |
$cmp->{delete}++; |
258 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
} |
259 |
$orig{$cmp->{nvra}}++; |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
260 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$orig{$cmp->{nvra}}++; |
261 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
262 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
263 |
} |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
264 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} |
265 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
} elsif ( $cmp->{src} ) { |
266 |
} else { |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
267 |
$cmp->{delete}++; |
$cmp->{repo} = $cmp->{oldrepo}; |
268 |
} |
delete $cmp->{delete}; |
269 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
} |
270 |
$cmp->{repo} = $dest; |
if ( $reposrc{$cmp->{repo}} ) { |
271 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
272 |
$track{repo} = $dest; |
$srpm = $cmp if ! $srpm; |
273 |
$track{svr} = $cmp->{svr}; |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
274 |
} |
$cmp->{delete}++; |
275 |
} |
} |
276 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
277 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
$cmp->{delete}++; |
278 |
} |
} |
279 |
} |
} elsif ( $cmp->{src} ) { |
280 |
} else { |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
281 |
if ( $track{repo} eq $cmp->{repo} ) { |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
282 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
283 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
]; |
284 |
} elsif ( $cmp->{src} ) { |
|
285 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
286 |
} else { |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
287 |
$track{svr} = $cmp->{svr}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
288 |
} |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
289 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
290 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
291 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
292 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
} else { |
293 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
warn "How did I get here??"; |
294 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
} |
295 |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
} else { |
296 |
|
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
297 |
|
} |
298 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
299 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
300 |
|
} |
301 |
|
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
302 |
|
$cmp->{delete}++; |
303 |
|
} elsif ( $cmp->{src} || grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{all_archs}} ) { |
304 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
305 |
|
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
306 |
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
307 |
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
308 |
|
if ( $cmp->{repo} ne $dest ) { |
309 |
|
push @{$cmp->{repos}}, $dest; |
310 |
|
if ( $repos->{$cmp->{repo}}->{orig} ) { |
311 |
|
$orig{$cmp->{nvra}}++; |
312 |
|
unless ( $repos->{$cmp->{repo}}->{base} ) { |
313 |
|
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
314 |
|
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
315 |
|
} |
316 |
|
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
317 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
318 |
|
} else { |
319 |
|
$cmp->{delete}++; |
320 |
|
} |
321 |
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
322 |
|
$cmp->{repo} = $dest; |
323 |
|
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
324 |
|
$track{repo} = $dest; |
325 |
|
$track{svr} = $cmp->{svr}; |
326 |
|
} |
327 |
|
} |
328 |
|
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
329 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
330 |
|
} |
331 |
|
} |
332 |
|
} else { |
333 |
|
if ( $track{repo} eq $cmp->{repo} ) { |
334 |
|
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
335 |
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
336 |
|
} elsif ( $cmp->{src} ) { |
337 |
|
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
338 |
|
} else { |
339 |
|
$track{svr} = $cmp->{svr}; |
340 |
|
} |
341 |
|
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
342 |
|
if ( $repos->{$cmp->{repo}}->{orig} ) { |
343 |
|
$srpm = $cmp if ! $srpm && $cmp->{src}; |
344 |
|
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
345 |
|
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
346 |
|
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
347 |
|
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
348 |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
349 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
350 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
351 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
352 |
} |
} |
353 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
355 |
$cmp->{repo} = $dest; |
$cmp->{repo} = $dest; |
356 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
357 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
358 |
} |
} |
359 |
} |
} |
360 |
} else { |
} else { |
361 |
$cmp->{delete}++; |
$cmp->{delete}++; |
362 |
} |
} |
363 |
} |
} |
364 |
} |
} |
365 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
366 |
$pkgs{$cmp->{nvra}}++; |
$pkgs{$cmp->{nvra}}++; |
367 |
$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}}; |
368 |
$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}; |
369 |
unless ( $seen{$cmp->{nvra}} ) { |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
370 |
$seen{$cmp->{nvra}} = $cmp; |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
371 |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
} |
372 |
} |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
373 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp; |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
374 |
} |
} |
375 |
$cmp->{done}++; |
$cmp->{done}++; |
376 |
} |
} |
377 |
if ( $srpm ) { |
if ( $srpm ) { |
378 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
379 |
unless ( $reposrc{$r}->{srpm} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
380 |
unshift @{$srpm->{repos}}, $r; |
unshift @{$srpm->{repos}}, $r; |
381 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
382 |
$srpm->{repo} = $r; |
$srpm->{repo} = $r; |
383 |
$reposrc{$r}->{srpm} = $srpm; |
$reposrc{$r}->{srpm} = $srpm; |
384 |
} |
} |
385 |
} |
} |
386 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
387 |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
388 |
} |
} |
389 |
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; |
390 |
} |
} |
391 |
|
|
392 |
foreach my $r ( keys %$acnt ) { |
foreach my $r ( keys %$acnt ) { |
393 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
foreach my $p ( keys %{$acnt->{$r}} ) { |
394 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
395 |
if ( $a eq 'noarch' ) { |
if ( $a eq 'noarch' ) { |
396 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
397 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
398 |
$p2->{oldrepo} = $p2->{repo}; |
$p2->{oldrepo} = $p2->{repo}; |
399 |
push @{$p2->{repos}}, $p2->{repo}; |
push @{$p2->{repos}}, $p2->{repo}; |
400 |
} |
} |
401 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
402 |
print "\n * many packages ($r, $a, $p)\n"; |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
403 |
} |
} |
404 |
} |
} |
405 |
} |
} |
406 |
} |
} |
|
|
|
|
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
|
|
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
|
|
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
|
|
$pkg->{repo} = $stage; |
|
|
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; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if ( $pkg->{repos} ) { |
|
|
foreach my $repo ( @{$pkg->{repos}} ) { |
|
|
if ( $pkg->{delete} ) { |
|
|
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
|
|
$pkg->{delete} = 0; |
|
|
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
|
|
} elsif ( $pkg->{oldrepo} eq $repo ) { |
|
|
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
|
|
} else { |
|
|
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
|
|
} |
|
|
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
|
|
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
|
|
|
|
|
my @d = (); |
|
|
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
|
|
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
|
|
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
|
|
if ( $pkg->{src} ) { |
|
|
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
|
|
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
|
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
|
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
|
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
|
|
} else { |
|
|
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
|
|
} |
|
|
foreach my $dest ( @d ) { |
|
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
|
|
} |
|
|
|
|
|
} |
|
|
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
|
|
} elsif ( $pkg->{delete} ) { |
|
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
|
|
qx(rm -f $src) unless $opts{t}; |
|
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
|
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
|
|
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
|
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
407 |
|
|
408 |
if ( %repochg ) { |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
409 |
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
410 |
} |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
411 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
412 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
$pkg->{repo} = $stage; |
413 |
foreach my $arch ( @archs ) { |
push @{$pkg->{repos}}, $stage; |
414 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
} |
415 |
$dir = qx(readlink -f $dir); |
} |
416 |
chomp $dir; |
|
417 |
print "rebuild $repo/$arch\n"; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
418 |
unless ( $opts{t} ) { |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
419 |
if ( $dir =~ m{test} ) { |
$print++; |
420 |
if ( -f "$dir/repodata/comps.xml" ) { |
} |
421 |
qx(createrepo --update --database --exclude *smeserver-release*.rpm --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
|
422 |
|
my $src = $pkg->{rpm}->filename; |
423 |
|
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
424 |
|
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
425 |
|
unless ( $opts{t} ) { |
426 |
|
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
427 |
|
if ($?) { |
428 |
|
print " * failed to sign package\n"; |
429 |
|
next; |
430 |
|
} |
431 |
|
} |
432 |
|
} |
433 |
|
|
434 |
|
if ( $pkg->{repos} ) { |
435 |
|
foreach my $repo ( @{$pkg->{repos}} ) { |
436 |
|
if ( $pkg->{delete} ) { |
437 |
|
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
438 |
|
$pkg->{delete} = 0; |
439 |
|
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
440 |
|
} elsif ( $pkg->{oldrepo} eq $repo ) { |
441 |
|
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
442 |
} else { |
} else { |
443 |
qx(createrepo --update --database --exclude *smeserver-release*.rpm --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
444 |
} |
} |
445 |
} else { |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
446 |
if ( -f "$dir/repodata/comps.xml" ) { |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
447 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
|
448 |
|
my @d = (); |
449 |
|
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
450 |
|
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
451 |
|
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
452 |
|
if ( $pkg->{src} ) { |
453 |
|
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
454 |
|
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
455 |
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
456 |
|
} elsif ($ver>=10 && $pkg->{rpm}->arch =~ m{^(i[356]86)$} && $pkg->{arch} =~ m{^(x86_64)$} ) { |
457 |
|
#add copy of i686 packages in x86_64 folder for SME>=10 |
458 |
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
459 |
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
460 |
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
461 |
} else { |
} else { |
462 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
463 |
|
} |
464 |
|
foreach my $dest ( @d ) { |
465 |
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
466 |
} |
} |
467 |
|
|
468 |
|
} |
469 |
|
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
470 |
|
} elsif ( $pkg->{delete} ) { |
471 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
472 |
|
qx(rm -f $src) unless $opts{t}; |
473 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
474 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
475 |
|
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
476 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
477 |
|
} |
478 |
|
} |
479 |
|
} |
480 |
|
|
481 |
|
if ( $rpms->{$base}->{srpms} ) { |
482 |
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
483 |
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
484 |
|
$pkg->{delete}++; |
485 |
|
my $src = $pkg->{rpm}->filename; |
486 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
487 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
488 |
|
$print++; |
489 |
} |
} |
490 |
qx(repoview $dir); |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
491 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
qx(rm -f $src) unless $opts{t}; |
492 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
493 |
} |
} |
494 |
} |
} |
495 |
|
} |
496 |
|
|
497 |
|
if ( %repochg ) { |
498 |
|
print "\nrebuild repo ($disttag$ver)\n", "=" x length("rebuild repo ($disttag$ver)"), "\n"; |
499 |
|
} |
500 |
|
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
501 |
|
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
502 |
|
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
503 |
|
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
504 |
|
$dir = qx(readlink -f $dir); |
505 |
|
if ( $dir ) { |
506 |
|
chomp $dir; |
507 |
|
} else { |
508 |
|
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
509 |
|
} |
510 |
|
print "rebuild $repo/$arch\n"; |
511 |
|
unless ( $opts{t} ) { |
512 |
|
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
513 |
|
|
514 |
|
my $exclude = ""; |
515 |
|
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
516 |
|
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
517 |
|
|
518 |
|
my $groupfile = ""; |
519 |
|
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
520 |
|
|
521 |
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
522 |
|
qx(repoview $dir); |
523 |
|
|
524 |
|
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
525 |
|
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
526 |
|
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
527 |
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
528 |
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
529 |
|
} |
530 |
|
} |
531 |
} |
} |
532 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
533 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
foreach (@{$distrepo->{$ver}->{'builds'}}) |
534 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
{ |
535 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
536 |
|
} |
537 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{'community'}) if -d "$distrepo->{$ver}->{'community'}"; |
538 |
} |
} |
539 |
} |
} |
540 |
|
|
557 |
my $pkgs = shift; |
my $pkgs = shift; |
558 |
|
|
559 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
560 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
561 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
562 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
563 |
$dest = $hirepo; |
$dest = $hirepo; |
564 |
last; |
last; |
565 |
} else { |
} else { |
566 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
567 |
} |
} |
568 |
} |
} |
569 |
return $dest; |
return $dest; |
570 |
} |
} |
582 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
583 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
584 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
585 |
my $nosig = ! $@; |
|
586 |
|
my $nosig = 1; |
587 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
588 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
589 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
590 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
591 |
|
|
592 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
593 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
594 |
return unless $cmp; |
return unless $cmp; |
595 |
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}; |
596 |
} |
} |
597 |
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$}; |
598 |
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} ); |
599 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
600 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
601 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
602 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
605 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
606 |
|
|
607 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
608 |
name => $pkg->name, |
name => $pkg->name, |
609 |
repo => $repo, |
repo => $repo, |
610 |
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') ), |
611 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
612 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
613 |
arch => $arch, |
arch => $arch, |
614 |
ver => $version, |
ver => $version, |
615 |
rel => $release, |
rel => $release, |
616 |
rpm => $pkg, |
rpm => $pkg, |
617 |
nosig => $nosig, |
nosig => $nosig, |
618 |
}; |
}; |
619 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
620 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
621 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
622 |
} else { |
} else { |
623 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
624 |
} |
} |
625 |
$sources{$src}++; |
$sources{$src}++; |
626 |
|
|
627 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
628 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
629 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
630 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
631 |
} |
} |
632 |
} 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} ) { |
633 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
634 |
} |
} |
635 |
} |
} |