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', 'vim' ) }, |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
97 |
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'perl-Razor-Agent', 'perl-Text-Iconv', 'proftpd' ) }, |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
98 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
99 |
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
'/mirrors/rpmforge/source/' => 'rpmforge', |
100 |
}, |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
101 |
'8' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
102 |
'fedora' => { map { $_ => 1 } ( 'kernel-xen' ) }, |
'/mirrors/atrpms/src/el~C-~A/atrpms/stable/' => 'atrpms', |
103 |
'epel' => { map { $_ => 1 } ( 'clamav', 'perl-Razor-Agent', 'proftpd', 'smolt' ) }, |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
104 |
'fedora-extras' => { map { $_ => 1 } ( 'dstat', 'gocr', 'horde', 'oidentd', 'perl-Test-Inline', 'perl-Razor-Agent', 'smolt' ) }, |
}; |
105 |
'rpmforge' => { map { $_ => 1 } ( 'perl-Test-Inline' ) }, |
|
106 |
}, |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
107 |
}; |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
108 |
|
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'html2ps', 'horde', 'libtalloc', 'libtdb', 'oidentd', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-Razor-Agent', 'smolt' ) }, |
109 |
|
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
110 |
|
}, |
111 |
|
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
112 |
|
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
113 |
|
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
114 |
|
}, |
115 |
|
'10' => { |
116 |
|
}, |
117 |
|
}; |
118 |
|
|
119 |
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
my ($stage) = sort { $repos->{$a}->{stage} <=> $repos->{$b}->{stage} } grep { $repos->{$_}->{stage} } keys %$repos; |
120 |
my ($devel1, $devel2) = sort { $repos->{$a}->{devel} <=> $repos->{$b}->{devel} } grep { $repos->{$_}->{devel} } keys %$repos; |
my ($devel1, $devel2) = sort { $repos->{$a}->{devel} <=> $repos->{$b}->{devel} } grep { $repos->{$_}->{devel} } keys %$repos; |
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 -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 -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 |
push @{$cmp->{repos}}, $dest; |
$seen{$cmp->{nvra}} = $cmp if $seen{$cmp->{nvra}}->{repo} ne $cmp->{repo}; |
297 |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
} |
298 |
$cmp->{repo} = $dest; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
299 |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $reposrc{$cmp->{repo}}; |
300 |
|
} |
301 |
$orig{$cmp->{nvra}}++; |
} elsif ( $repos->{$cmp->{repo}}->{stage} ) { |
302 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
$cmp->{delete}++; |
303 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
} elsif ( $cmp->{src} || grep $_ eq $cmp->{rpm}->arch, @{$distrepo->{$ver}->{all_archs}} ) { |
304 |
qx(touch $tag/PUSHED) if -d $tag && ! -f "$tag/PUSHED"; |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
305 |
} |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
306 |
} else { |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
307 |
$cmp->{delete}++; |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
308 |
} |
if ( $cmp->{repo} ne $dest ) { |
309 |
} else { |
push @{$cmp->{repos}}, $dest; |
310 |
$cmp->{delete}++; |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
311 |
} |
$orig{$cmp->{nvra}}++; |
312 |
} |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
313 |
} |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
314 |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
315 |
$pkgs{$cmp->{nvra}}++; |
} |
316 |
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
317 |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
318 |
unless ( $seen{$cmp->{nvra}} ) { |
} else { |
319 |
$seen{$cmp->{nvra}} = $cmp; |
$cmp->{delete}++; |
320 |
$cmp->{latest}++ if $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc}; |
} |
321 |
} |
$cmp->{oldrepo} = $cmp->{repo} unless $cmp->{oldrepo}; |
322 |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp; |
$cmp->{repo} = $dest; |
323 |
} |
if ( ! $cmp->{src} && $repos->{$dest}->{prio} > $repos->{$track{repo}}->{prio} ) { |
324 |
$cmp->{done}++; |
$track{repo} = $dest; |
325 |
} |
$track{svr} = $cmp->{svr}; |
326 |
if ( $srpm ) { |
} |
327 |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
} |
328 |
unless ( $reposrc{$r}->{srpm} ) { |
if ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
329 |
unshift @{$srpm->{repos}}, $r; |
$reposrc{$cmp->{repo}}->{srpm} = $cmp; |
330 |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
} |
331 |
$srpm->{repo} = $r; |
} |
332 |
$reposrc{$r}->{srpm} = $srpm; |
} else { |
333 |
} |
if ( $track{repo} eq $cmp->{repo} ) { |
334 |
} |
if ( verrel($cmp, $cmp->{repo}, \%counts) ) { |
335 |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
336 |
print "\n * missing source (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
} elsif ( $cmp->{src} ) { |
337 |
} |
$cmp->{delete}++ unless $repos->{$cmp->{repo}}->{base}; |
338 |
print "\n * missing originals (sme$smever, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
} else { |
339 |
} |
$track{svr} = $cmp->{svr}; |
340 |
|
} |
341 |
foreach my $r ( keys %$acnt ) { |
} elsif ( ! $repos->{$cmp->{repo}}->{base} ) { |
342 |
foreach my $p ( keys %{$acnt->{$r}} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
343 |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
$srpm = $cmp if ! $srpm && $cmp->{src}; |
344 |
if ( $a eq 'noarch' ) { |
my $dest = $repos->{$track{repo}}->{prio} > $repos->{$devel2}->{prio} ? $track{repo} : $devel2; |
345 |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
$dest = pkgdest($cmp, $devel1, $dest, $rpms->{$base}->{rpms}); |
346 |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @archs ) { |
$dest = $devel1 if verrel($cmp, $dest, \%counts); |
347 |
$p2->{oldrepo} = $p2->{repo}; |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
348 |
push @{$p2->{repos}}, $p2->{repo}; |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
349 |
} |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
350 |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
351 |
print "\n * many packages ($r, $a, $p)\n"; |
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 |
|
$reposrc{$cmp->{repo}}->{srpm} = $cmp if $cmp->{src}; |
357 |
foreach my $pkg ( sort { $a->{nvra} cmp $b->{nvra} } @{$rpms->{$base}->{rpms}} ) { |
$orig{$cmp->{nvra}}++; |
358 |
if ( $pkg->{latest} && $pkg->{latest} == 1 ) { |
} |
359 |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
} |
360 |
$pkg->{repo} = $stage; |
} else { |
361 |
push @{$pkg->{repos}}, $stage; |
$cmp->{delete}++; |
362 |
} |
} |
363 |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || $pkg->{nosig} ) ) { |
} |
364 |
print "\n$base (sme$smever)\n", "=" x length("$base (sme$smever)"), "\n"; |
} |
365 |
$print++; |
unless ( $repos->{$cmp->{repo}}->{orig} || ( $cmp->{delete} && ! $cmp->{repos} ) ) { |
366 |
} |
$pkgs{$cmp->{nvra}}++; |
367 |
|
$latest{$cmp->{base}} = $cmp->{svr} if $repos->{$cmp->{repo}}->{inc} && ! $latest{$cmp->{base}}; |
368 |
my $src = $pkg->{rpm}->filename; |
$reposrc{$cmp->{repo}} = $cmp unless $reposrc{$cmp->{repo}} || $cmp->{src} || $repos->{$cmp->{repo}}->{stage}; |
369 |
if ( $pkg->{nosig} ) { |
if ( $latest{$cmp->{base}} && $cmp->{svr} eq $latest{$cmp->{base}} && $repos->{$cmp->{repo}}->{inc} ) { |
370 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
$cmp->{latest}++ if ! $seen{$cmp->{nvra}} || $cmp->{src}; |
371 |
unless ( $opts{t} ) { |
} |
372 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
$seen{$cmp->{nvra}} = $cmp unless $seen{$cmp->{nvra}}; |
373 |
if ($?) { |
push @{$acnt->{$cmp->{repo}}->{$cmp->{rpm}->as_nvre}->{$cmp->{src} ? 'src' : $cmp->{rpm}->arch}}, $cmp unless $cmp->{done}; |
374 |
print " * failed to sign package\n"; |
} |
375 |
next; |
$cmp->{done}++; |
376 |
} |
} |
377 |
} |
if ( $srpm ) { |
378 |
} |
foreach my $r ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %reposrc ) { |
379 |
|
unless ( $reposrc{$r}->{srpm} ) { |
380 |
if ( $pkg->{repos} ) { |
unshift @{$srpm->{repos}}, $r; |
381 |
foreach my $repo ( @{$pkg->{repos}} ) { |
$srpm->{oldrepo} = $srpm->{repo} unless $srpm->{oldrepo}; |
382 |
if ( $pkg->{delete} ) { |
$srpm->{repo} = $r; |
383 |
print "move from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
$reposrc{$r}->{srpm} = $srpm; |
384 |
$pkg->{delete} = 0; |
} |
385 |
$repochg{$pkg->{oldrepo}}++ unless $repos->{$pkg->{oldrepo}}->{base} || $repos->{$pkg->{oldrepo}}->{stage}; |
} |
386 |
} elsif ( $pkg->{oldrepo} eq $repo ) { |
} elsif ( scalar keys %pkgs && $opts{s} ) { |
387 |
print "distribute noarch in $repo (", basename($pkg->{rpm}->filename), ")\n"; |
print "\n * missing source ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n"; |
388 |
} else { |
} |
389 |
print "copy from ", $pkg->{oldrepo}, " to $repo (", basename($pkg->{rpm}->filename), ")\n"; |
print "\n * missing originals ($disttag$ver, ", $pkg->{repo}, ", ", $pkg->{svr}, ")\n" if $opts{o} && scalar keys %orig != scalar keys %pkgs; |
390 |
} |
} |
391 |
$repochg{$repo}++ unless $repos->{$repo}->{base} || $repos->{$repo}->{stage}; |
|
392 |
$pkg->{oldrepo} = $repo unless $pkg->{oldrepo} eq ${$pkg->{repos}}[0]; |
foreach my $r ( keys %$acnt ) { |
393 |
|
foreach my $p ( keys %{$acnt->{$r}} ) { |
394 |
my @d = (); |
foreach my $a ( keys %{$acnt->{$r}->{$p}} ) { |
395 |
my $head = $distrepo->{$smever}->{repo} . $repo . '/'; |
if ( $a eq 'noarch' ) { |
396 |
$head = $distrepo->{$smever}->{stage} if $repos->{$repo}->{stage}; |
my $p2 = ${$acnt->{$r}->{$p}->{$a}}[0]; |
397 |
my $tail = $repos->{$repo}->{os} ? 'SME/' . $distrepo->{$smever}->{os} : 'RPMS/'; |
if ( ! $p2->{repos} && scalar @{$acnt->{$r}->{$p}->{$a}} != scalar @{$distrepo->{$ver}->{'archs'}} ) { |
398 |
if ( $pkg->{src} ) { |
$p2->{oldrepo} = $p2->{repo}; |
399 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
push @{$p2->{repos}}, $p2->{repo}; |
400 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
} |
401 |
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @archs; |
} elsif ( scalar @{$acnt->{$r}->{$p}->{$a}} != 1 ) { |
402 |
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
print "\n * many packages ($r, $a, $p)\n" unless $p =~ m{^syslinux-nonlinux-[0-9]}; |
403 |
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
} |
404 |
} else { |
} |
405 |
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
} |
406 |
} |
} |
407 |
foreach my $dest ( @d ) { |
|
408 |
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
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 |
} |
$pkg->{oldrepo} = $pkg->{repo} unless $pkg->{oldrepo}; |
412 |
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
$pkg->{repo} = $stage; |
413 |
} elsif ( $pkg->{delete} ) { |
push @{$pkg->{repos}}, $stage; |
414 |
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
} |
415 |
qx(rm -f $src) unless $opts{t}; |
} |
416 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
|
417 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
418 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$smever}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
419 |
qx(rm -f $tag/PUSHED) if -d $tag && -f "$tag/PUSHED"; |
$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 ($ver>=10 && $pkg->{rpm}->arch =~ m{^(i[356]86)$} && $pkg->{arch} =~ m{^(x86_64)$} ) { |
457 |
|
#add copy of i686 packages in x86_64 folder for SME>=10 |
458 |
|
push @d, map { "${head}$_/$tail" . basename($pkg->{rpm}->filename) } @{$distrepo->{$ver}->{'archs'}}; |
459 |
|
} elsif ( $pkg->{rpm}->arch =~ m{^(i[356]86)$} ) { |
460 |
|
push @d, "${head}i386/$tail" . basename($pkg->{rpm}->filename); |
461 |
|
} else { |
462 |
|
push @d, $head . $pkg->{rpm}->arch . "/$tail" . basename($pkg->{rpm}->filename); |
463 |
|
} |
464 |
|
foreach my $dest ( @d ) { |
465 |
|
qx(cp --preserve=timestamps $src $dest) unless $opts{t} || -f "$dest"; |
466 |
|
} |
467 |
|
|
468 |
|
} |
469 |
|
qx(rm -f $src) if exists $pkg->{delete} && ! $opts{t}; |
470 |
|
} elsif ( $pkg->{delete} ) { |
471 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
472 |
|
qx(rm -f $src) unless $opts{t}; |
473 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
474 |
|
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
475 |
|
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
476 |
|
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
477 |
|
} |
478 |
|
} |
479 |
|
} |
480 |
|
|
481 |
|
if ( $rpms->{$base}->{srpms} ) { |
482 |
|
foreach my $pkg ( sort { $b->{rpm} cmp $a->{rpm} } @{$rpms->{$base}->{srpms}} ) { |
483 |
|
next if $pkg->{done} || $repos->{$pkg->{repo}}->{orig} || $repos->{$pkg->{repo}}->{base}; |
484 |
|
$pkg->{delete}++; |
485 |
|
my $src = $pkg->{rpm}->filename; |
486 |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
487 |
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
488 |
|
$print++; |
489 |
|
} |
490 |
|
print "delete from ", $pkg->{repo}, " (", $pkg->{arch}, ", ", basename($pkg->{rpm}->filename), ")\n"; |
491 |
|
qx(rm -f $src) unless $opts{t}; |
492 |
|
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
493 |
|
} |
494 |
|
} |
495 |
} |
} |
496 |
|
|
497 |
if ( %repochg ) { |
if ( %repochg ) { |
498 |
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"; |
499 |
} |
} |
500 |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
foreach my $repo ( sort { $repos->{$b}->{prio} <=> $repos->{$a}->{prio} } keys %repochg ) { |
501 |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
next if $repos->{$repo}->{orig} || $repos->{$repo}->{stage}; |
502 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @{$distrepo->{$ver}->{'archs'}} ) { |
503 |
my $dir = $distrepo->{$smever}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
504 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
505 |
chomp $dir; |
if ( $dir ) { |
506 |
print "rebuild $repo/$arch\n"; |
chomp $dir; |
507 |
unless ( $opts{t} ) { |
} else { |
508 |
if ( -f "$dir/repodata/comps.xml" ) { |
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
509 |
qx(createrepo -g repodata/comps.xml $dir); |
} |
510 |
} else { |
print "rebuild $repo/$arch\n"; |
511 |
qx(createrepo $dir); |
unless ( $opts{t} ) { |
512 |
} |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
513 |
qx(repoview $dir); |
|
514 |
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
my $exclude = ""; |
515 |
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
516 |
} |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
517 |
} |
|
518 |
|
my $groupfile = ""; |
519 |
|
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
520 |
|
|
521 |
|
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
522 |
|
qx(repoview $dir); |
523 |
|
|
524 |
|
qx(rm -rf $dir/.olddata) if -d "$dir/.olddata"; |
525 |
|
qx(rm -rf $dir/.repodata) if -d "$dir/.repodata"; |
526 |
|
qx(rm -rf $dir/repodata/index.html) if -f "$dir/repodata/index.html"; |
527 |
|
qx(rm -rf $dir/repodata/update-info) if -d "$dir/repodata/update-info"; |
528 |
|
qx(rm -rf $dir/repodata/repoview) if -d "$dir/repodata/repoview"; |
529 |
|
} |
530 |
|
} |
531 |
} |
} |
532 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
533 |
finddepth(sub{rmdir}, $distrepo->{$smever}->{$_}) foreach ('builds','contribs'); |
foreach (@{$distrepo->{$ver}->{'builds'}}) |
534 |
|
{ |
535 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
536 |
|
} |
537 |
|
finddepth(sub{rmdir}, $distrepo->{$ver}->{'community'}) if -d "$distrepo->{$ver}->{'community'}"; |
538 |
} |
} |
539 |
} |
} |
540 |
|
|
557 |
my $pkgs = shift; |
my $pkgs = shift; |
558 |
|
|
559 |
foreach my $cmp ( @$pkgs ) { |
foreach my $cmp ( @$pkgs ) { |
560 |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
next if $cmp->{src} || $repos->{$cmp->{repo}}->{prio} <= $repos->{$dest}->{prio}; |
561 |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
next if $pkg->{name} ne ( $pkg->{src} ? $cmp->{base} : $cmp->{name} ); |
562 |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
if ( $repos->{$cmp->{repo}}->{prio} > $repos->{$hirepo}->{prio} ) { |
563 |
$dest = $hirepo; |
$dest = $hirepo; |
564 |
last; |
last; |
565 |
} else { |
} else { |
566 |
$dest = $cmp->{repo}; |
$dest = $cmp->{repo}; |
567 |
} |
} |
568 |
} |
} |
569 |
return $dest; |
return $dest; |
570 |
} |
} |
571 |
|
|
572 |
sub process_rpm { |
sub process_rpm { |
573 |
my $rpm = shift; |
my $rpm = shift; |
574 |
my $smever = shift; |
my $ver = shift; |
575 |
my $repo = shift; |
my $repo = shift; |
576 |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
return unless $rpm =~ m{/([^/]*)-[^-]+-[^-]+\.\w+\.rpm$}; |
577 |
my $base = $1; |
my $base = $1; |
582 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
583 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
584 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
585 |
my $nosig = ! $@; |
|
586 |
|
my $nosig = 1; |
587 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
588 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
589 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
590 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
591 |
|
|
592 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
593 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
594 |
return unless $cmp; |
return unless $cmp; |
595 |
return if $repos->{$cmp->{repo}}->{base} && $repos->{$cmp->{repo}}->{prio} > $repos->{$repo}->{prio} && $pkg ge $cmp->{rpm}; |
return if $repos->{$cmp->{repo}}->{base} && $repos->{$cmp->{repo}}->{prio} > $repos->{$repo}->{prio} && $pkg ge $cmp->{rpm}; |
596 |
} |
} |
597 |
my ($src, $version, $release) = ($pkg->is_source_package ? $pkg->filename : $pkg->sourcerpm) =~ m{(?:^|/)([^/]*)-([^-]+)-([^-]+)\.\w+\.rpm$}; |
my ($src, $version, $release) = ($pkg->is_source_package ? $pkg->filename : $pkg->sourcerpm) =~ m{(?:^|/)([^/]*)-([^-]+)-([^-]+)\.\w+\.rpm$}; |
598 |
return if $skippkg->{$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} ); |
599 |
return if $repos->{$repo}->{base} && $nosig; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
600 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
601 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
602 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
605 |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
$arch = 'noarch' if $pkg->filename =~ m{[/-]noarch/}; |
606 |
|
|
607 |
my $rpmhash = { base => $src, |
my $rpmhash = { base => $src, |
608 |
name => $pkg->name, |
name => $pkg->name, |
609 |
repo => $repo, |
repo => $repo, |
610 |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
nvra => $pkg->name.'-'.$pkg->version.'-'.$pkg->release.'.'.( $pkg->is_source_package ? 'src' : $pkg->tag('ARCH') ), |
611 |
svr => $src.'-'.$version.'-'.$release, |
svr => $src.'-'.$version.'-'.$release, |
612 |
src => $pkg->is_source_package, |
src => $pkg->is_source_package, |
613 |
arch => $arch, |
arch => $arch, |
614 |
ver => $version, |
ver => $version, |
615 |
rel => $release, |
rel => $release, |
616 |
rpm => $pkg, |
rpm => $pkg, |
617 |
nosig => $nosig, |
nosig => $nosig, |
618 |
}; |
}; |
619 |
if ( $pkg->is_source_package ) { |
if ( $pkg->is_source_package ) { |
620 |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
push @{$rpms->{$src}->{srpms}}, $rpmhash; |
621 |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
push @{$rpms->{$src}->{vers}->{$rpmhash->{svr}}}, $rpmhash; |
622 |
} else { |
} else { |
623 |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
push @{$rpms->{$src}->{rpms}}, $rpmhash; |
624 |
} |
} |
625 |
$sources{$src}++; |
$sources{$src}++; |
626 |
|
|
627 |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
return if $pkg->is_source_package || $repos->{$repo}->{stage}; |
628 |
if ( ! $repos->{$repo}->{base} ) { |
if ( ! $repos->{$repo}->{base} ) { |
629 |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
if ( ! $cmp || $pkg gt $cmp->{rpm} ) { |
630 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
631 |
} |
} |
632 |
} elsif ( ( $repos->{$repo}->{prio} >= $repos->{$cmp->{repo}}->{prio} || ! $repos->{$cmp->{repo}}->{base} ) && $pkg ge $cmp->{rpm} ) { |
} elsif ( ( $repos->{$repo}->{prio} >= $repos->{$cmp->{repo}}->{prio} || ! $repos->{$cmp->{repo}}->{base} ) && $pkg ge $cmp->{rpm} ) { |
633 |
$latest{$pkg->name} = $rpmhash; |
$latest{$pkg->name} = $rpmhash; |
634 |
} |
} |
635 |
} |
} |