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