14 |
$| = 1; |
$| = 1; |
15 |
|
|
16 |
my %opts; |
my %opts; |
17 |
getopts( 'osqtr:', \%opts ); |
getopts( 'ostr:', \%opts ); |
18 |
$opts{r} ||= ''; |
$opts{r} ||= ''; |
19 |
|
|
20 |
my $rpm_flags = RPM2->vsf_nosha1header | RPM2->vsf_nomd5header | RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader; |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
$rpm_flags |= RPM2->vsf_nosha1 | RPM2->vsf_nomd5 | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
|
21 |
|
|
22 |
my $osdir = 'SME'; |
my $osdir = 'SME'; |
23 |
my $disttag = 'sme'; |
my $disttag = 'sme'; |
25 |
|
|
26 |
my @archs = ( 'i386', 'x86_64' ); |
my @archs = ( 'i386', 'x86_64' ); |
27 |
|
|
28 |
my $distrepo = { '7' => { active => 0, |
my $distrepo = { '8' => { active => 1, |
|
centos => 4, |
|
|
repo => '/build/smeserver/repo/7/', |
|
|
builds => ['/build/builds/smeserver-7-core/'], |
|
|
community => '/build/builds/smeserver-7-contribs/', |
|
|
stage => '/build/smeserver/stage/7/', |
|
|
sign => 1, |
|
|
checksum => 'sha', |
|
|
}, |
|
|
'8' => { active => 1, |
|
29 |
centos => 5, |
centos => 5, |
30 |
repo => '/build/smeserver/repo/8/', |
repo => '/build/smeserver/repo/8/', |
31 |
builds => ['/build/builds/smeserver-8-core/'], |
builds => ['/build/builds/smeserver-8-core/'], |
32 |
community => '/build/builds/smeserver-8-contribs/', |
community => '/build/builds/smeserver-8-contribs/', |
33 |
stage => '/build/smeserver/stage/8/', |
stage => '/build/smeserver/stage/8/', |
34 |
sign => 1, |
sign => 1, |
35 |
|
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
36 |
checksum => 'sha', |
checksum => 'sha', |
37 |
}, |
}, |
38 |
'9' => { active => 1, |
'9' => { active => 1, |
41 |
builds => ['/build/builds/smeserver-9-core/'], |
builds => ['/build/builds/smeserver-9-core/'], |
42 |
community => '/build/builds/smeserver-9-contribs/', |
community => '/build/builds/smeserver-9-contribs/', |
43 |
stage => '/build/smeserver/stage/9/', |
stage => '/build/smeserver/stage/9/', |
44 |
sign => 0, |
sign => 1, |
45 |
|
keyname => 'SME Server 7 signing key <bugteam@contribs.org>', |
46 |
checksum => 'sha256', |
checksum => 'sha256', |
47 |
}, |
}, |
48 |
}; |
}; |
92 |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
93 |
}; |
}; |
94 |
|
|
95 |
if ( $opts{q} ) { |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/'} = 'centos'; |
|
|
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/'} = 'centos'; |
|
|
} |
|
|
|
|
|
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
|
|
'epel' => { map { $_ => 1 } ( 'clamav', 'fping', 'ocsinventory', 'perl-Compress-Bzip2', 'perl-Compress-Raw-Zlib', 'perl-Compress-Raw-Bzip2', 'perl-Crypt-OpenSSL-Bignum', 'perl-Crypt-OpenSSL-Random', 'perl-Crypt-OpenSSL-RSA', 'perl-DateTime', 'perl-Razor-Agent', 'perl-Text-Iconv' ) }, |
|
|
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'mod_auth_tkt', 'perl-Test-Inline', 'perl-libwww-perl', 'spamassassin' ) }, |
|
|
'atrpms' => { map { $_ => 1 } ( 'check4updates', 'dovecot', 'trac', 'yum' ) }, |
|
|
}, |
|
|
'8' => { 'atrpms' => { map { $_ => 1 } ( 'gnupg' ) }, |
|
96 |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
97 |
'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' ) }, |
'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' ) }, |
98 |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
99 |
}, |
}, |
100 |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
101 |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
102 |
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
103 |
}, |
}, |
132 |
} |
} |
133 |
} else { |
} else { |
134 |
$adir =~ s/~A/$arch/; |
$adir =~ s/~A/$arch/; |
135 |
if ( -d "${adir}CentOS/RPMS" ) { |
if ( -d "${adir}RPMS" ) { |
|
$adir .= "CentOS/RPMS/"; |
|
|
} elsif ( -d "${adir}$osdir/RPMS" ) { |
|
|
$adir .= "$osdir/RPMS/"; |
|
|
} elsif ( -d "${adir}RPMS" ) { |
|
136 |
$adir .= "RPMS/"; |
$adir .= "RPMS/"; |
137 |
} elsif ( -d "${adir}Packages" ) { |
} elsif ( -d "${adir}Packages" ) { |
138 |
$adir .= "Packages/"; |
$adir .= "Packages/"; |
241 |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
} elsif ( $repos->{$cmp->{repo}}->{orig} ) { |
242 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
243 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
244 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
245 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
246 |
} |
} |
247 |
} elsif ( $cmp->{src} ) { |
} elsif ( $cmp->{src} ) { |
292 |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
if ( $repos->{$cmp->{repo}}->{orig} ) { |
293 |
$orig{$cmp->{nvra}}++; |
$orig{$cmp->{nvra}}++; |
294 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
295 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
296 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
297 |
} |
} |
298 |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
} elsif ( $cmp->{src} && $reposrc{$cmp->{repo}} ) { |
329 |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
unless ( $cmp->{src} && ! $reposrc{$dest} ) { |
330 |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
if ( $repos->{$dest}->{prio} >= $repos->{$track{repo}}->{prio} && ! verrel($cmp, $dest, \%counts) ) { |
331 |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
unless ( $repos->{$cmp->{repo}}->{base} ) { |
332 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$cmp->{repo}}, $cmp->{name}, $cmp->{ver}, $cmp->{rel}; |
my $tag = dirname(dirname($cmp->{rpm}->{filename})); |
333 |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
qx(touch $tag/PUSHED) if ! $opts{t} && -d $tag && ! -f "$tag/PUSHED"; |
334 |
} |
} |
335 |
push @{$cmp->{repos}}, $dest; |
push @{$cmp->{repos}}, $dest; |
395 |
push @{$pkg->{repos}}, $stage; |
push @{$pkg->{repos}}, $stage; |
396 |
} |
} |
397 |
} |
} |
|
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
|
|
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
|
|
$print++; |
|
|
} |
|
398 |
|
|
399 |
my $src = $pkg->{rpm}->filename; |
if ( ! $print && ($pkg->{delete} || $pkg->{repos} || ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) ) ) { |
400 |
if ( $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
print "\n$base ($disttag$ver)\n", "=" x length("$base ($disttag$ver)"), "\n"; |
401 |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
$print++; |
402 |
unless ( $opts{t} ) { |
} |
403 |
qx(cat $HOME/.rpmpass | setsid rpm --addsign $src >& /dev/null); |
|
404 |
if ($?) { |
my $src = $pkg->{rpm}->filename; |
405 |
print " * failed to sign package\n"; |
if ( ! $repos->{$pkg->{repo}}->{base} && $pkg->{nosig} && $distrepo->{$ver}->{sign} ) { |
406 |
next; |
print "sign package (", basename($pkg->{rpm}->filename), ")\n"; |
407 |
} |
unless ( $opts{t} ) { |
408 |
} |
qx(cat $HOME/.rpmpass | setsid rpm -D '_gpg_name $distrepo->{$ver}->{keyname}' --addsign $src >& /dev/null); |
409 |
} |
if ($?) { |
410 |
|
print " * failed to sign package\n"; |
411 |
|
next; |
412 |
|
} |
413 |
|
} |
414 |
|
} |
415 |
|
|
416 |
if ( $pkg->{repos} ) { |
if ( $pkg->{repos} ) { |
417 |
foreach my $repo ( @{$pkg->{repos}} ) { |
foreach my $repo ( @{$pkg->{repos}} ) { |
451 |
qx(rm -f $src) unless $opts{t}; |
qx(rm -f $src) unless $opts{t}; |
452 |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
$repochg{$pkg->{repo}}++ unless $repos->{$pkg->{repo}}->{base} || $repos->{$pkg->{repo}}->{stage}; |
453 |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
if ( $repos->{$pkg->{repo}}->{orig} && ! $repos->{$pkg->{repo}}->{base} ) { |
454 |
my $tag = sprintf '%s%s/%s-%s', $distrepo->{$ver}->{$pkg->{repo}}, $pkg->{name}, $pkg->{ver}, $pkg->{rel}; |
my $tag = dirname(dirname($pkg->{rpm}->{filename})); |
455 |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
qx(rm -f $tag/PUSHED) if ! $opts{t} && -d $tag && -f "$tag/PUSHED"; |
456 |
} |
} |
457 |
} |
} |
492 |
|
|
493 |
my $exclude = ""; |
my $exclude = ""; |
494 |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
495 |
$exclude = "--exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
496 |
|
|
497 |
my $groupfile = ""; |
my $groupfile = ""; |
498 |
$groupfile = "--groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
$groupfile = "--simple-md-filenames --groupfile repodata/comps.xml" if -f "$dir/repodata/comps.xml"; |
499 |
|
|
500 |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
qx(createrepo --update --database --exclude *.src.rpm --exclude *-debuginfo-*.rpm $checksum $exclude $groupfile $dir); |
501 |
qx(repoview $dir); |
qx(repoview $dir); |
561 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
562 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
563 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
564 |
my $nosig = ! $@; |
|
565 |
|
my $nosig = 1; |
566 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
567 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
568 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
569 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
570 |
|
|
571 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
572 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
573 |
return unless $cmp; |
return unless $cmp; |