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 |
stage => '/stage/7/', |
community => '/build/builds/smeserver-8-contribs/', |
32 |
}, |
stage => '/build/smeserver/stage/8/', |
33 |
'8' => { active => 1, |
sign => 1, |
34 |
centos => 5, |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
35 |
fedora => 6, |
checksum => 'sha', |
36 |
repo => '/releases/testing/8/', |
}, |
37 |
os => '', |
'9' => { active => 1, |
38 |
builds => '/builds/smeserver-8-core/', |
centos => 6, |
39 |
contribs => '/builds/smeserver-8-contribs/', |
archs => [ 'i386', 'x86_64' ], |
40 |
stage => '/stage/8/', |
repo => '/build/smeserver/repo/9/', |
41 |
}, |
builds => ['/build/builds/smeserver-9-core/'], |
42 |
}; |
community => '/build/builds/smeserver-9-contribs/', |
43 |
|
stage => '/build/smeserver/stage/9/', |
44 |
my $repos = { 'smeos' => { prio => 18, inc => 1, ver => 1, rel => 1, os => 1 }, |
sign => 1, |
45 |
'smeupdates' => { prio => 17, inc => 1, ver => 1, rel => 1 }, |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
46 |
'smeupdates-testing' => { prio => 16, inc => 1, ver => 1, rel => 3 }, |
checksum => 'sha256', |
47 |
'smeextras' => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
}, |
48 |
'smeaddons' => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
'10' => { active => 0, |
49 |
'smecontribs' => { prio => 13, inc => 0, ver => 1, rel => 1 }, |
centos => 7, |
50 |
'smetest' => { prio => 12, inc => 0, ver => 2, rel => 3, devel => 2 }, |
archs => [ 'x86_64' ], |
51 |
'smedev' => { prio => 11, inc => 0, ver => 1, rel => 1, devel => 1 }, |
repo => '/build/smeserver/repo/testing/10/', |
52 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
builds => ['/build/builds/smeserver-10-core/'], |
53 |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
community => '/build/builds/smeserver-10-contribs/', |
54 |
'fedora-extras' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
stage => '/build/smeserver/stage/10/', |
55 |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
sign => 1, |
56 |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
57 |
'fedora' => { prio => 5, 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 |
'contribs' => { 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 = { '~Ssmeos/~A/SME/~O' => 'smeos', |
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
64 |
'~Ssmeupdates/~A/RPMS/' => 'smeupdates', |
"${repotag}extras" => { prio => 16, inc => 0, ver => 1, rel => 1 }, |
65 |
'~Ssmeupdates-testing/~A/RPMS/' => 'smeupdates-testing', |
"${repotag}addons" => { prio => 15, inc => 0, ver => 1, rel => 1 }, |
66 |
'~Ssmeextras/~A/RPMS/' => 'smeextras', |
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
67 |
'~Ssmeaddons/~A/RPMS/' => 'smeaddons', |
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
68 |
'~Ssmecontribs/~A/RPMS/' => 'smecontribs', |
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
69 |
'~Ssmetest/~A/RPMS/' => 'smetest', |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
70 |
'~Ssmedev/~A/RPMS/' => 'smedev', |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
71 |
'/stage/~s/~A/SME/~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/fedora/extras/~F/~A/' => 'fedora-extras', |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
79 |
'/mirrors/rpmforge/dag/redhat/el~C/en/~A/dag/RPMS/' => 'rpmforge', |
"~S${repotag}updates/~A/" => "${repotag}updates", |
80 |
'/mirrors/rpmforge/dag/source/' => 'rpmforge', |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
81 |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
"~S${repotag}extras/~A/" => "${repotag}extras", |
82 |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
"~S${repotag}addons/~A/" => "${repotag}addons", |
83 |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
84 |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
"~S${repotag}test/~A/" => "${repotag}test", |
85 |
'/mirrors/fedora/core/~F/~A/os/Fedora/RPMS/' => 'fedora', |
"~S${repotag}dev/~A/" => "${repotag}dev", |
86 |
'/mirrors/fedora/core/updates/~F/~A/' => 'fedora', |
"/build/smeserver/stage/~s/~A/" => 'stage', |
87 |
}; |
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
88 |
|
'/mirrors/centos/~C/updates/~A/' => 'centos', |
89 |
if ( $opts{q} ) { |
'/mirrors/centos/~C/os/~A/' => 'centos', |
90 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
'/mirrors/centos/~C/extras/~A/' => 'centos', |
91 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
92 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
93 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
94 |
} |
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
95 |
|
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
96 |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
97 |
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'ocsinventory', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'perl-Text-Iconv', 'proftpd' ) }, |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
98 |
'fedora-extras' => { map { $_ => 1 } ( 'ddclient', 'hddtemp', 'pam_abl', 'perl-Error', 'perl-HTML-Format', 'perl-MIME-Types', 'perl-Net-IP', 'perl-Archive-Zip', 'perl-Class-Singleton', 'perl-Razor-Agent', 'perl-Test-Inline', 'perl-Text-Autoformat', 'perl-Text-Iconv', 'perl-Text-Reform', 'perl-XML-RSS' ) }, |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
99 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'/mirrors/rpmforge/source/' => 'rpmforge', |
100 |
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
101 |
}, |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
102 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
103 |
'fedora' => { map { $_ => 1 } ( 'kernel', 'kernel-xen' ) }, |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
104 |
'epel' => { map { $_ => 1 } ( 'clamav', 'horde', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'proftpd', 'smolt' ) }, |
}; |
105 |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
|
106 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
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; |
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 |
|
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($_, $smever, 'builds'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$smever}->{'builds'} ); |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, "$_" ) foreach @{$distrepo->{$ver}->{'builds'}}; |
171 |
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'}; |
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{(\d+)\.\d+\.el\d(\.rf)$}{$1$2} && $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$}{.dag} && $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.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rfx to .rf, rfb,rft,rfx switched to rf) |
194 |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
195 |
($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .rfx, rf,rfb,rft,rfx switched to rfx) |
196 |
($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)[btx]?$}{$1x} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
197 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.sme$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
198 |
} |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
199 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
200 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
201 |
$tmp->{svr} = $pkg->{svr}; |
|
202 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
# atrpms (remove .at) |
203 |
$tmp->{added}++; |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
204 |
} |
# atrpms (remove .el4.at) |
205 |
} |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
206 |
|
# atrpms (remove .el4) |
207 |
my %orig = (); |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
208 |
my %pkgs = (); |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
209 |
my %reposrc = (); |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
210 |
my $srpm = undef; |
|
211 |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
# Transformations that we hopefully won't have to use anymore TODO: remove if no issues |
212 |
next unless $cmp->{svr} eq $pkg->{svr}; |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
213 |
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
214 |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
215 |
if ( $cmp->{src} ) { |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
216 |
if ( ! $track{repo} ) { |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
217 |
$cmp->{delete}++; |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
218 |
$cmp->{done}++; |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
219 |
next; |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
220 |
} |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
221 |
} else { |
} |
222 |
$track{repo} = $cmp->{repo}; |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
223 |
$track{svr} = $cmp->{svr}; |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
224 |
} |
$tmp->{svr} = $pkg->{svr}; |
225 |
} |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
226 |
if ( $cmp->{svr} eq $track{svr} ) { |
$tmp->{added}++; |
227 |
if ( $seen{$cmp->{nvra}} ) { |
} |
228 |
if ( $track{repo} ne $cmp->{repo} ) { |
} |
229 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
|
230 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
my %orig = (); |
231 |
$seen{$cmp->{nvra}}->{latest}++; |
my %pkgs = (); |
232 |
} else { |
my %reposrc = (); |
233 |
$cmp->{delete}++; |
my $srpm = undef; |
234 |
} |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
235 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
next unless $cmp->{svr} eq $pkg->{svr}; |
236 |
$orig{$cmp->{nvra}}++; |
|
237 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
238 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
if ( $cmp->{src} ) { |
239 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
if ( ! $track{repo} ) { |
240 |
} |
$cmp->{delete}++; |
241 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
$cmp->{done}++; |
242 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
next; |
243 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} |
244 |
$cmp->{delete}++; |
} else { |
245 |
} |
$track{repo} = $cmp->{repo}; |
246 |
} |
$track{svr} = $cmp->{svr}; |
247 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} |
248 |
$cmp->{delete}++; |
} |
249 |
} else { |
if ( $cmp->{svr} eq $track{svr} ) { |
250 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
if ( $seen{$cmp->{nvra}} ) { |
251 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
if ( $track{repo} ne $cmp->{repo} ) { |
252 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
if ($repos->{$cmp->{repo}}->{stage} ) { |
253 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
254 |
if ( $cmp->{repo} ne $dest ) { |
$seen{$cmp->{nvra}}->{latest}++; |
255 |
push @{$cmp->{repos}}, $dest; |
delete $cmp->{delete} if $cmp->{delete}; |
256 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
} else { |
257 |
$orig{$cmp->{nvra}}++; |
$cmp->{delete}++; |
258 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
} |
259 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
260 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
$orig{$cmp->{nvra}}++; |
261 |
} |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
262 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
263 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
264 |
} else { |
} |
265 |
$cmp->{delete}++; |
} elsif ( $cmp->{src} ) { |
266 |
} |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
267 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{repo} = $cmp->{oldrepo}; |
268 |
$cmp->{repo} = $dest; |
delete $cmp->{delete}; |
269 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
} |
270 |
$track{repo} = $dest; |
if ( $reposrc{$cmp->{repo}} ) { |
271 |
$track{svr} = $cmp->{svr}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
272 |
} |
$srpm = $cmp if ! $srpm; |
273 |
} |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
274 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
$cmp->{delete}++; |
275 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
} |
276 |
} |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
277 |
} |
$cmp->{delete}++; |
278 |
} else { |
} |
279 |
if ( $track{repo} eq $cmp->{repo} ) { |
} elsif ( $cmp->{src} ) { |
280 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
281 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
282 |
} elsif ( $cmp->{src} ) { |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
283 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
]; |
284 |
} else { |
|
285 |
$track{svr} = $cmp->{svr}; |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
286 |
} |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
287 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
288 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
289 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
290 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
291 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
292 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
} else { |
293 |
if ( $cmp->{src} && ! $reposrc{$dest} ) { |
warn "How did I get here??"; |
294 |
$cmp->{delete}++; |
} |
295 |
} elsif ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
} else { |
296 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
297 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} |
298 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
299 |
} |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
300 |
push @{$cmp->{repos}}, $dest; |
} |
301 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
302 |
$cmp->{repo} = $dest; |
$cmp->{delete}++; |
303 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
} elsif ( $cmp->{src} || grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{all_archs}} ) { |
304 |
$orig{$cmp->{nvra}}++; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
305 |
} else { |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
306 |
$cmp->{delete}++; |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
307 |
} |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
308 |
} else { |
if ( $cmp->{repo} ne $dest ) { |
309 |
$cmp->{delete}++; |
push @{$cmp->{repos}}, $dest; |
310 |
} |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
311 |
} |
$orig{$cmp->{nvra}}++; |
312 |
} |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
313 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
314 |
$pkgs{$cmp->{nvra}}++; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
315 |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
} |
316 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
317 |
unless ( $seen{$cmp->{nvra}} ) { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
318 |
$seen{$cmp->{nvra}} = $cmp; |
} else { |
319 |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
$cmp->{delete}++; |
320 |
} |
} |
321 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp; |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
322 |
} |
$cmp->{repo} = $dest; |
323 |
$cmp->{done}++; |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
324 |
} |
$track{repo} = $dest; |
325 |
if ( $srpm ) { |
$track{svr} = $cmp->{svr}; |
326 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
} |
327 |
unless ( $reposrc{$r}->{srpm} ) { |
} |
328 |
unshift @{$srpm->{repos}}, $r; |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
329 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
330 |
$srpm->{repo} = $r; |
} |
331 |
$reposrc{$r}->{srpm} = $srpm; |
} |
332 |
} |
} else { |
333 |
} |
if ( $track{repo} eq $cmp->{repo} ) { |
334 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
335 |
print "\n * missing source (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
336 |
} |
} elsif ( $cmp->{src} ) { |
337 |
print "\n * missing originals (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
338 |
} |
} else { |
339 |
|
$track{svr} = $cmp->{svr}; |
340 |
foreach my $r ( keys %$acnt ) { |
} |
341 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
342 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
343 |
if ( $a eq 'noarch' ) { |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
344 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
345 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
346 |
$p2->{oldrepo} = $p2->{repo}; |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
347 |
push @{$p2->{repos}}, $p2->{repo}; |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
348 |
} |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
349 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
350 |
print "\n * many packages ($r, $a, $p)\n"; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
351 |
} |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
352 |
} |
} |
353 |
} |
push @{$cmp->{repos}}, $dest; |
354 |
} |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
355 |
|
$cmp->{repo} = $dest; |
356 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
357 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
$orig{$cmp->{nvra}}++; |
358 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
} |
359 |
$pkg->{repo} = $stage; |
} |
360 |
push @{$pkg->{repos}}, $stage; |
} else { |
361 |
} |
$cmp->{delete}++; |
362 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
} |
363 |
print "\n$base (sme$smever)\n", "=" x length("$base (sme$smever)"), "\n"; |
} |
364 |
$print++; |
} |
365 |
} |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
366 |
|
$pkgs{$cmp->{nvra}}++; |
367 |
my $src = $pkg->{rpm}->filename; |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
368 |
if ( $pkg->{nosig} ) { |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
369 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
370 |
unless ( $opts{t} ) { |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
371 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
} |
372 |
if ($?) { |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
373 |
print " * failed to sign package\n"; |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
374 |
next; |
} |
375 |
} |
$cmp->{done}++; |
376 |
} |
} |
377 |
} |
if ( $srpm ) { |
378 |
|
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
379 |
if ( $pkg->{repos} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
380 |
foreach my $repo ( @{$pkg->{repos}} ) { |
unshift @{$srpm->{repos}}, $r; |
381 |
if ( $pkg->{delete} ) { |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
382 |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
$srpm->{repo} = $r; |
383 |
$pkg->{delete} = 0; |
$reposrc{$r}->{srpm} = $srpm; |
384 |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
} |
385 |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
} |
386 |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
387 |
} else { |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
388 |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} |
389 |
} |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
390 |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
} |
391 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
|
392 |
|
foreach my $r ( keys %$acnt ) { |
393 |
my @d = (); |
foreach my $p ( keys %{$acnt->{$r}} ) { |
394 |
my $head = $distrepo->{$smever}->{repo} . $repo . '/'; |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
395 |
$head = $distrepo->{$smever}->{stage} if $repos->{$repo}->{stage}; |
if ( $a eq 'noarch' ) { |
396 |
my $tail = $repos->{$repo}->{os} ? 'SME/' . $distrepo->{$smever}->{os} : 'RPMS/'; |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
397 |
if ( $pkg->{src} ) { |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
398 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
$p2->{oldrepo} = $p2->{repo}; |
399 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
push @{$p2->{repos}}, $p2->{repo}; |
400 |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
} |
401 |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
402 |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
403 |
} else { |
} |
404 |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
} |
405 |
} |
} |
406 |
foreach my $dest ( @d ) { |
} |
407 |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
|
408 |
} |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
409 |
|
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
410 |
} |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
411 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
412 |
} elsif ( $pkg->{delete} ) { |
$pkg->{repo} = $stage; |
413 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
push @{$pkg->{repos}}, $stage; |
414 |
qx(rm -f $src) unless $opts{t}; |
} |
415 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
} |
416 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
|
417 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
418 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
419 |
} |
$print++; |
420 |
} |
} |
421 |
} |
|
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 { |
443 |
|
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
444 |
|
} |
445 |
|
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
446 |
|
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
447 |
|
|
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 ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
457 |
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
458 |
|
} else { |
459 |
|
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
460 |
|
} |
461 |
|
foreach my $dest ( @d ) { |
462 |
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
463 |
|
} |
464 |
|
|
465 |
|
} |
466 |
|
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
467 |
|
} elsif ( $pkg->{delete} ) { |
468 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
469 |
|
qx(rm -f $src) unless $opts{t}; |
470 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
471 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
472 |
|
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
473 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
474 |
|
} |
475 |
|
} |
476 |
|
} |
477 |
|
|
478 |
|
if ( $rpms->{$base}->{srpms} ) { |
479 |
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
480 |
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
481 |
|
$pkg->{delete}++; |
482 |
|
my $src = $pkg->{rpm}->filename; |
483 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
484 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
485 |
|
$print++; |
486 |
|
} |
487 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
488 |
|
qx(rm -f $src) unless $opts{t}; |
489 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
490 |
|
} |
491 |
|
} |
492 |
} |
} |
493 |
|
|
494 |
if ( %repochg ) { |
if ( %repochg ) { |
495 |
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"; |
496 |
} |
} |
497 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
498 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
499 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
500 |
my $dir = $distrepo->{$smever}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
501 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
502 |
chomp $dir; |
if ( $dir ) { |
503 |
print "rebuild $repo/$arch\n"; |
chomp $dir; |
504 |
unless ( $opts{t} ) { |
} else { |
505 |
if ( -f "$dir/repodata/comps.xml" ) { |
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
506 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
} |
507 |
} else { |
print "rebuild $repo/$arch\n"; |
508 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
unless ( $opts{t} ) { |
509 |
} |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
510 |
qx(repoview $dir); |
|
511 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
my $exclude = ""; |
512 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
513 |
} |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
514 |
} |
|
515 |
|
my $groupfile = ""; |
516 |
|
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
517 |
|
|
518 |
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
519 |
|
qx(repoview $dir); |
520 |
|
|
521 |
|
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
522 |
|
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
523 |
|
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
524 |
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
525 |
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
526 |
|
} |
527 |
|
} |
528 |
} |
} |
529 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
530 |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs'); |
foreach (@{$distrepo->{$ver}->{'builds'}}) |
531 |
|
{ |
532 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
533 |
|
} |
534 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{'community'}) if -d "$distrepo->{$ver}->{'community'}"; |
535 |
} |
} |
536 |
} |
} |
537 |
|
|
554 |
my $pkgs = shift; |
my $pkgs = shift; |
555 |
|
|
556 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
557 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
558 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
559 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
560 |
$dest = $hirepo; |
$dest = $hirepo; |
561 |
last; |
last; |
562 |
} else { |
} else { |
563 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
564 |
} |
} |
565 |
} |
} |
566 |
return $dest; |
return $dest; |
567 |
} |
} |
568 |
|
|
569 |
sub process_rpm { |
sub process_rpm { |
570 |
my $rpm = shift; |
my $rpm = shift; |
571 |
my $smever = shift; |
my $ver = shift; |
572 |
my $repo = shift; |
my $repo = shift; |
573 |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
574 |
my $base = $1; |
my $base = $1; |
579 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
580 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
581 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
582 |
my $nosig = ! $@; |
|
583 |
|
my $nosig = 1; |
584 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
585 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
586 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
587 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
588 |
|
|
589 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
590 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
591 |
return unless $cmp; |
return unless $cmp; |
592 |
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}; |
593 |
} |
} |
594 |
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$}; |
595 |
return if $skippkg->{$smever}->{$repo} && ( $skippkg->{$smever}->{$repo}->{$src} || $skippkg->{$smever}->{$repo}->{$pkg->name} ); |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
596 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
597 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
598 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
599 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
602 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
603 |
|
|
604 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
605 |
name => $pkg->name, |
name => $pkg->name, |
606 |
repo => $repo, |
repo => $repo, |
607 |
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') ), |
608 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
609 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
610 |
arch => $arch, |
arch => $arch, |
611 |
ver => $version, |
ver => $version, |
612 |
rel => $release, |
rel => $release, |
613 |
rpm => $pkg, |
rpm => $pkg, |
614 |
nosig => $nosig, |
nosig => $nosig, |
615 |
}; |
}; |
616 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
617 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
618 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
619 |
} else { |
} else { |
620 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
621 |
} |
} |
622 |
$sources{$src}++; |
$sources{$src}++; |
623 |
|
|
624 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
625 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
626 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
627 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
628 |
} |
} |
629 |
} 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} ) { |
630 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
631 |
} |
} |
632 |
} |
} |