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 => 1 }, |
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', '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', '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 = (); |
130 |
%base = (); |
%base = (); |
131 |
|
|
132 |
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 ) { |
133 |
my $bdir = $dir; |
my $bdir = $dir; |
134 |
$bdir =~ s/~O/$distrepo->{$smever}->{os}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
135 |
$bdir =~ s/~S/$distrepo->{$smever}->{repo}/; |
$bdir =~ s/~s/$ver/; |
136 |
$bdir =~ s/~s/$smever/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
137 |
$bdir =~ s/~C/$distrepo->{$smever}->{centos}/; |
for my $arch ( @{$distrepo->{$ver}->{'archs'}}, 'SRPMS/' ) { |
138 |
$bdir =~ s/~F/$distrepo->{$smever}->{fedora}/; |
my $adir = $bdir; |
139 |
for my $arch ( @archs, 'SRPMS/' ) { |
if ( $arch eq 'SRPMS/' ) { |
140 |
my $adir = $bdir; |
$adir =~ s/~A.*//; |
141 |
if ( $arch eq 'SRPMS/' ) { |
if ( -d "${adir}SRPMS" ) { |
142 |
$adir =~ s/~A.*/$arch/ if $arch eq 'SRPMS/'; |
$adir .= "SRPMS/"; |
143 |
} else { |
} elsif ( -d "${adir}Source/SPackages" ) { |
144 |
$adir =~ s/~A/$arch/; |
$adir .= "Source/SPackages/"; |
145 |
} |
} |
146 |
opendir DIR, $adir or next; |
} else { |
147 |
next unless -d $adir; |
$adir =~ s/~A/$arch/; |
148 |
process_rpm("$adir$_", $smever, $baserepo->{$dir}) foreach readdir DIR; |
if ( -d "${adir}RPMS" ) { |
149 |
closedir DIR; |
$adir .= "RPMS/"; |
150 |
last unless $dir =~ m{~A}; |
} elsif ( -d "${adir}Packages" ) { |
151 |
} |
$adir .= "Packages/"; |
152 |
|
} elsif ( -d "${adir}CentOS" ) { |
153 |
|
$adir .= "CentOS/"; |
154 |
|
} elsif ( -d "${adir}$osdir" ) { |
155 |
|
$adir .= "$osdir/"; |
156 |
|
} |
157 |
|
} |
158 |
|
next unless -d $adir; |
159 |
|
opendir DIR, $adir or next; |
160 |
|
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
161 |
|
closedir DIR; |
162 |
|
last unless $dir =~ m{~A}; |
163 |
|
} |
164 |
} |
} |
165 |
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'}}; |
166 |
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'}; |
167 |
|
|
168 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
169 |
next unless $rpms->{$base}->{rpms}; |
next unless $rpms->{$base}->{rpms}; |
170 |
my %track = (); |
my %track = (); |
171 |
my %seen = (); |
my %seen = (); |
172 |
my %counts = (); |
my %counts = (); |
173 |
my $acnt = (); |
my $acnt = (); |
174 |
my $print = 0; |
my $print = 0; |
175 |
%latest = (); |
%latest = (); |
176 |
|
|
177 |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{rpms}} ) { |
178 |
next if $pkg->{done}; |
next if $pkg->{done}; |
179 |
|
|
180 |
my $tmp = $pkg->{svr}; |
my $tmp = $pkg->{svr}; |
181 |
SRC: { |
# srpm transformations to match up binary and source rpms |
182 |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
SRC: { |
183 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# Try to find the name the binary wants (no changes) |
184 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
$rpms->{$base}->{vers}->{$tmp} && last SRC; |
185 |
($tmp = $pkg->{svr}) =~ s{\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
|
186 |
($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) |
187 |
($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; |
188 |
($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) |
189 |
($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; |
190 |
($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) |
191 |
($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; |
192 |
($tmp = $pkg->{svr}) =~ s{\.el\d\.sme$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
# rpmforge (.el4.rf to .el5) TODO: remove when no longer needed |
193 |
} |
($tmp = $pkg->{svr}) =~ s{\.el\d\.rf$}{.el5} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
194 |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
# rpmforge (.2.el4.rf to .rf, minor modification not pushed to source?) TODO: remove when no longer needed |
195 |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
($tmp = $pkg->{svr}) =~ s{\.2\.el\d(\.rf)$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
196 |
$tmp->{svr} = $pkg->{svr}; |
|
197 |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
# atrpms (remove .at) |
198 |
$tmp->{added}++; |
($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
199 |
} |
# atrpms (remove .el4.at) |
200 |
} |
($tmp = $pkg->{svr}) =~ s{\.el\d\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
201 |
|
# atrpms (remove .el4) |
202 |
my %orig = (); |
($tmp = $pkg->{svr}) =~ s{\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
203 |
my %pkgs = (); |
# atrpms (remove .0.el5, minor modification not pushed to source?) TODO: remove when no longer needed |
204 |
my %reposrc = (); |
($tmp = $pkg->{svr}) =~ s{\.0\.el\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
205 |
my $srpm = undef; |
|
206 |
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 |
207 |
next unless $cmp->{svr} eq $pkg->{svr}; |
#($tmp = $pkg->{svr}) =~ s{(\.el\d)\.rf$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
208 |
|
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+(\.rf)$}{$1$2} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
209 |
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; |
210 |
if ( $cmp->{src} ) { |
#($tmp = $pkg->{svr}) =~ s{(\d+)\.\d+\.el\d\.rf$}{$1.dag} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
211 |
if ( ! $track{repo} ) { |
#($tmp = $pkg->{svr}) =~ s{\.el\d_}{_} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
212 |
$cmp->{delete}++; |
#($tmp = $pkg->{svr}) =~ s{(-\d+)\.\d+\.el\d$}{$1} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
213 |
$cmp->{done}++; |
#($tmp = $pkg->{svr}) =~ s{\.centos\d$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
214 |
next; |
#($tmp = $pkg->{svr}) =~ s{\.at$}{} && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
215 |
} |
#($tmp = $pkg->{svr}) =~ s{\.el\d\.$disttag$}{ && $rpms->{$base}->{vers}->{$tmp} && last SRC; |
216 |
} else { |
} |
217 |
$track{repo} = $cmp->{repo}; |
if ( $rpms->{$base}->{vers}->{$tmp} ) { |
218 |
$track{svr} = $cmp->{svr}; |
foreach $tmp ( @{$rpms->{$base}->{vers}->{$tmp}} ) { |
219 |
} |
$tmp->{svr} = $pkg->{svr}; |
220 |
} |
push @{$rpms->{$base}->{rpms}}, $tmp unless $tmp->{added}; |
221 |
if ( $cmp->{svr} eq $track{svr} ) { |
$tmp->{added}++; |
222 |
if ( $seen{$cmp->{nvra}} ) { |
} |
223 |
if ( $track{repo} ne $cmp->{repo} ) { |
} |
224 |
if ($repos->{$cmp->{repo}}->{stage} ) { |
|
225 |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
my %orig = (); |
226 |
$seen{$cmp->{nvra}}->{latest}++; |
my %pkgs = (); |
227 |
} else { |
my %reposrc = (); |
228 |
$cmp->{delete}++; |
my $srpm = undef; |
229 |
} |
foreach my $cmp ( sort { $a->{src} <=> $b->{src} || $repos->{$b->{repo}}->{prio} <=> $repos->{$a->{repo}}->{prio} } @{$rpms->{$base}->{rpms}} ) { |
230 |
} elsif ( $repos->{$cmp->{repo}}->{orig}) { |
next unless $cmp->{svr} eq $pkg->{svr}; |
231 |
$orig{$cmp->{nvra}}++; |
|
232 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
if ( ! $track{repo} || $repos->{$cmp->{repo}}->{prio} > $repos->{$track{repo}}->{prio} ) { |
233 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
if ( $cmp->{src} ) { |
234 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
if ( ! $track{repo} ) { |
235 |
} |
$cmp->{delete}++; |
236 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
$cmp->{done}++; |
237 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
next; |
238 |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
} |
239 |
$cmp->{delete}++; |
} else { |
240 |
} |
$track{repo} = $cmp->{repo}; |
241 |
} |
$track{svr} = $cmp->{svr}; |
242 |
} elsif ($repos->{$cmp->{repo}}->{stage} ) { |
} |
243 |
$cmp->{delete}++; |
} |
244 |
} else { |
if ( $cmp->{svr} eq $track{svr} ) { |
245 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
if ( $seen{$cmp->{nvra}} ) { |
246 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
if ( $track{repo} ne $cmp->{repo} ) { |
247 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
if ($repos->{$cmp->{repo}}->{stage} ) { |
248 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
if ( $seen{$cmp->{nvra}}->{latest} ) { |
249 |
if ( $cmp->{repo} ne $dest ) { |
$seen{$cmp->{nvra}}->{latest}++; |
250 |
push @{$cmp->{repos}}, $dest; |
delete $cmp->{delete} if $cmp->{delete}; |
251 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
} else { |
252 |
$orig{$cmp->{nvra}}++; |
$cmp->{delete}++; |
253 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
} |
254 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
255 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
$orig{$cmp->{nvra}}++; |
256 |
} |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
257 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
258 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
259 |
} else { |
} |
260 |
$cmp->{delete}++; |
} elsif ( $cmp->{src} ) { |
261 |
} |
if ( $cmp->{delete} && $cmp->{oldrepo} && $reposrc{$cmp->{oldrepo}}) { |
262 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
$cmp->{repo} = $cmp->{oldrepo}; |
263 |
$cmp->{repo} = $dest; |
delete $cmp->{delete}; |
264 |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
} |
265 |
$track{repo} = $dest; |
if ( $reposrc{$cmp->{repo}} ) { |
266 |
$track{svr} = $cmp->{svr}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
267 |
} |
$srpm = $cmp if ! $srpm; |
268 |
} |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} && ! $cmp->{done} ) { |
269 |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
$cmp->{delete}++; |
270 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
} |
271 |
} |
} elsif ( $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo} ) { |
272 |
} |
$cmp->{delete}++; |
273 |
} else { |
} |
274 |
if ( $track{repo} eq $cmp->{repo} ) { |
} elsif ( $cmp->{src} ) { |
275 |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
if ( $reposrc{$cmp->{repo}} && $reposrc{$cmp->{repo}}->{srpm} && $reposrc{$cmp->{repo}}->{srpm}->{oldrepo} ne $cmp->{repo} ) { |
276 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src} = [ |
277 |
} elsif ( $cmp->{src} ) { |
grep { $_ ne $reposrc{$cmp->{repo}}->{srpm} } @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{src}} |
278 |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
]; |
279 |
} else { |
|
280 |
$track{svr} = $cmp->{svr}; |
if ( @{$reposrc{$cmp->{repo}}->{srpm}->{repos}} == 1 ) { |
281 |
} |
$reposrc{$cmp->{repo}}->{srpm}->{repo} = $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
282 |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{oldrepo}; |
283 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
delete $reposrc{$cmp->{repo}}->{srpm}->{delete}; |
284 |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
delete $reposrc{$cmp->{repo}}->{srpm}->{repos}; |
285 |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
delete $reposrc{$cmp->{repo}}->{srpm}->{done}; |
286 |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}} eq $reposrc{$cmp->{repo}}->{srpm}; |
287 |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
} else { |
288 |
if ( $cmp->{src} && ! $reposrc{$dest} ) { |
warn "How did I get here??"; |
289 |
$cmp->{delete}++; |
} |
290 |
} elsif ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
} else { |
291 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
292 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} |
293 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
294 |
} |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
295 |
push @{$cmp->{repos}}, $dest; |
} |
296 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
297 |
$cmp->{repo} = $dest; |
$cmp->{delete}++; |
298 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
} elsif ( $cmp->{src} || ( $cmp->{rpm}->arch =~ m{^(i[356]86)$} && grep $_ eq 'i386', @{$distrepo->{$ver}->{'archs'}} ) || |
299 |
$orig{$cmp->{nvra}}++; |
grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{'archs'}} ) { |
300 |
} else { |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
301 |
$cmp->{delete}++; |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
302 |
} |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
303 |
} else { |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
304 |
$cmp->{delete}++; |
if ( $cmp->{repo} ne $dest ) { |
305 |
} |
push @{$cmp->{repos}}, $dest; |
306 |
} |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
307 |
} |
$orig{$cmp->{nvra}}++; |
308 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
309 |
$pkgs{$cmp->{nvra}}++; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
310 |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
311 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
} |
312 |
unless ( $seen{$cmp->{nvra}} ) { |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
313 |
$seen{$cmp->{nvra}} = $cmp; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
314 |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
} else { |
315 |
} |
$cmp->{delete}++; |
316 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp; |
} |
317 |
} |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
318 |
$cmp->{done}++; |
$cmp->{repo} = $dest; |
319 |
} |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
320 |
if ( $srpm ) { |
$track{repo} = $dest; |
321 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
$track{svr} = $cmp->{svr}; |
322 |
unless ( $reposrc{$r}->{srpm} ) { |
} |
323 |
unshift @{$srpm->{repos}}, $r; |
} |
324 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
325 |
$srpm->{repo} = $r; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
326 |
$reposrc{$r}->{srpm} = $srpm; |
} |
327 |
} |
} |
328 |
} |
} else { |
329 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
if ( $track{repo} eq $cmp->{repo} ) { |
330 |
print "\n * missing source (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
331 |
} |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
332 |
print "\n * missing originals (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
} elsif ( $cmp->{src} ) { |
333 |
} |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
334 |
|
} else { |
335 |
foreach my $r ( keys %$acnt ) { |
$track{svr} = $cmp->{svr}; |
336 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
} |
337 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
338 |
if ( $a eq 'noarch' ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
339 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
340 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
341 |
$p2->{oldrepo} = $p2->{repo}; |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
342 |
push @{$p2->{repos}}, $p2->{repo}; |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
343 |
} |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
344 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
345 |
print "\n * many packages ($r, $a, $p)\n"; |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
346 |
} |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
347 |
} |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
348 |
} |
} |
349 |
} |
push @{$cmp->{repos}}, $dest; |
350 |
|
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
351 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
$cmp->{repo} = $dest; |
352 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
353 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
$orig{$cmp->{nvra}}++; |
354 |
$pkg->{repo} = $stage; |
} |
355 |
push @{$pkg->{repos}}, $stage; |
} |
356 |
} |
} else { |
357 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
$cmp->{delete}++; |
358 |
print "\n$base (sme$smever)\n", "=" x length("$base (sme$smever)"), "\n"; |
} |
359 |
$print++; |
} |
360 |
} |
} |
361 |
|
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
362 |
my $src = $pkg->{rpm}->filename; |
$pkgs{$cmp->{nvra}}++; |
363 |
if ( $pkg->{nosig} ) { |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
364 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
365 |
unless ( $opts{t} ) { |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
366 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
367 |
if ($?) { |
} |
368 |
print " * failed to sign package\n"; |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
369 |
next; |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
370 |
} |
} |
371 |
} |
$cmp->{done}++; |
372 |
} |
} |
373 |
|
if ( $srpm ) { |
374 |
if ( $pkg->{repos} ) { |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
375 |
foreach my $repo ( @{$pkg->{repos}} ) { |
unless ( $reposrc{$r}->{srpm} ) { |
376 |
if ( $pkg->{delete} ) { |
unshift @{$srpm->{repos}}, $r; |
377 |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
378 |
$pkg->{delete} = 0; |
$srpm->{repo} = $r; |
379 |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
$reposrc{$r}->{srpm} = $srpm; |
380 |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
} |
381 |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
} |
382 |
} else { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
383 |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
384 |
} |
} |
385 |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
386 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
} |
387 |
|
|
388 |
my @d = (); |
foreach my $r ( keys %$acnt ) { |
389 |
my $head = $distrepo->{$smever}->{repo} . $repo . '/'; |
foreach my $p ( keys %{$acnt->{$r}} ) { |
390 |
$head = $distrepo->{$smever}->{stage} if $repos->{$repo}->{stage}; |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
391 |
my $tail = $repos->{$repo}->{os} ? 'SME/' . $distrepo->{$smever}->{os} : 'RPMS/'; |
if ( $a eq 'noarch' ) { |
392 |
if ( $pkg->{src} ) { |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
393 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
394 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
$p2->{oldrepo} = $p2->{repo}; |
395 |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
push @{$p2->{repos}}, $p2->{repo}; |
396 |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
} |
397 |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
398 |
} else { |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
399 |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
} |
400 |
} |
} |
401 |
foreach my $dest ( @d ) { |
} |
402 |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
} |
403 |
} |
|
404 |
|
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
405 |
} |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
406 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
unless ( grep { $_->{nvra} eq $pkg->{nvra} && $_->{repo} eq $stage } @{$rpms->{$base}->{rpms}} ) { |
407 |
} elsif ( $pkg->{delete} ) { |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
408 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
$pkg->{repo} = $stage; |
409 |
qx(rm -f $src) unless $opts{t}; |
push @{$pkg->{repos}}, $stage; |
410 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
} |
411 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
} |
412 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
|
413 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
414 |
} |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
415 |
} |
$print++; |
416 |
} |
} |
417 |
|
|
418 |
|
my $src = $pkg->{rpm}->filename; |
419 |
|
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
420 |
|
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
421 |
|
unless ( $opts{t} ) { |
422 |
|
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
423 |
|
if ($?) { |
424 |
|
print " * failed to sign package\n"; |
425 |
|
next; |
426 |
|
} |
427 |
|
} |
428 |
|
} |
429 |
|
|
430 |
|
if ( $pkg->{repos} ) { |
431 |
|
foreach my $repo ( @{$pkg->{repos}} ) { |
432 |
|
if ( $pkg->{delete} ) { |
433 |
|
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
434 |
|
$pkg->{delete} = 0; |
435 |
|
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
436 |
|
} elsif ( $pkg->{oldrepo} eq $repo ) { |
437 |
|
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
438 |
|
} else { |
439 |
|
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
440 |
|
} |
441 |
|
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
442 |
|
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
443 |
|
|
444 |
|
my @d = (); |
445 |
|
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
446 |
|
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
447 |
|
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
448 |
|
if ( $pkg->{src} ) { |
449 |
|
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
450 |
|
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
451 |
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
452 |
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
453 |
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
454 |
|
} else { |
455 |
|
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
456 |
|
} |
457 |
|
foreach my $dest ( @d ) { |
458 |
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
459 |
|
} |
460 |
|
|
461 |
|
} |
462 |
|
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
463 |
|
} elsif ( $pkg->{delete} ) { |
464 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
465 |
|
qx(rm -f $src) unless $opts{t}; |
466 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
467 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
468 |
|
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
469 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
470 |
|
} |
471 |
|
} |
472 |
|
} |
473 |
|
|
474 |
|
if ( $rpms->{$base}->{srpms} ) { |
475 |
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
476 |
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
477 |
|
$pkg->{delete}++; |
478 |
|
my $src = $pkg->{rpm}->filename; |
479 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
480 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
481 |
|
$print++; |
482 |
|
} |
483 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
484 |
|
qx(rm -f $src) unless $opts{t}; |
485 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
486 |
|
} |
487 |
|
} |
488 |
} |
} |
489 |
|
|
490 |
if ( %repochg ) { |
if ( %repochg ) { |
491 |
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"; |
492 |
} |
} |
493 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
494 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
495 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
496 |
my $dir = $distrepo->{$smever}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
497 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
498 |
chomp $dir; |
if ( $dir ) { |
499 |
print "rebuild $repo/$arch\n"; |
chomp $dir; |
500 |
unless ( $opts{t} ) { |
} else { |
501 |
if ( -f "$dir/repodata/comps.xml" ) { |
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
502 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm --groupfile repodata/comps.xml $dir); |
} |
503 |
} else { |
print "rebuild $repo/$arch\n"; |
504 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $dir); |
unless ( $opts{t} ) { |
505 |
} |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
506 |
qx(repoview $dir); |
|
507 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
my $exclude = ""; |
508 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
509 |
} |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
510 |
} |
|
511 |
|
my $groupfile = ""; |
512 |
|
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
513 |
|
|
514 |
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
515 |
|
qx(repoview $dir); |
516 |
|
|
517 |
|
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
518 |
|
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
519 |
|
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
520 |
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
521 |
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
522 |
|
} |
523 |
|
} |
524 |
} |
} |
525 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
526 |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs'); |
foreach (@{$distrepo->{$ver}->{builds}}) |
527 |
|
{ |
528 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
529 |
|
} |
530 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
531 |
} |
} |
532 |
} |
} |
533 |
|
|
550 |
my $pkgs = shift; |
my $pkgs = shift; |
551 |
|
|
552 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
553 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
554 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
555 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
556 |
$dest = $hirepo; |
$dest = $hirepo; |
557 |
last; |
last; |
558 |
} else { |
} else { |
559 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
560 |
} |
} |
561 |
} |
} |
562 |
return $dest; |
return $dest; |
563 |
} |
} |
564 |
|
|
565 |
sub process_rpm { |
sub process_rpm { |
566 |
my $rpm = shift; |
my $rpm = shift; |
567 |
my $smever = shift; |
my $ver = shift; |
568 |
my $repo = shift; |
my $repo = shift; |
569 |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
570 |
my $base = $1; |
my $base = $1; |
575 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
576 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
577 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
578 |
my $nosig = ! $@; |
|
579 |
|
my $nosig = 1; |
580 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
581 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
582 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
583 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
584 |
|
|
585 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
586 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
587 |
return unless $cmp; |
return unless $cmp; |
588 |
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}; |
589 |
} |
} |
590 |
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$}; |
591 |
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} ); |
592 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
593 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
594 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
595 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
598 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
599 |
|
|
600 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
601 |
name => $pkg->name, |
name => $pkg->name, |
602 |
repo => $repo, |
repo => $repo, |
603 |
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') ), |
604 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
605 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
606 |
arch => $arch, |
arch => $arch, |
607 |
ver => $version, |
ver => $version, |
608 |
rel => $release, |
rel => $release, |
609 |
rpm => $pkg, |
rpm => $pkg, |
610 |
nosig => $nosig, |
nosig => $nosig, |
611 |
}; |
}; |
612 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
613 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
614 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
615 |
} else { |
} else { |
616 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
617 |
} |
} |
618 |
$sources{$src}++; |
$sources{$src}++; |
619 |
|
|
620 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
621 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
622 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
623 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
624 |
} |
} |
625 |
} 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} ) { |
626 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
627 |
} |
} |
628 |
} |
} |