17 |
getopts( 'osqtr:', \%opts ); |
getopts( 'osqtr:', \%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 => 1, |
my $distrepo = { '7' => { active => 0, |
29 |
centos => 4, |
centos => 4, |
30 |
repo => '/releases/7/', |
repo => '/build/smeserver/repo/7/', |
31 |
os => 'RPMS/', |
builds => ['/build/builds/smeserver-7-core/'], |
32 |
builds => '/builds/smeserver-7-core/', |
community => '/build/builds/smeserver-7-contribs/', |
33 |
community => '/builds/smeserver-7-contribs/', |
stage => '/build/smeserver/stage/7/', |
|
stage => '/stage/7/', |
|
34 |
sign => 1, |
sign => 1, |
35 |
checksum => 'sha', |
checksum => 'sha', |
36 |
}, |
}, |
37 |
'8' => { active => 1, |
'8' => { active => 1, |
38 |
centos => 5, |
centos => 5, |
39 |
repo => '/releases/8/', |
repo => '/build/smeserver/repo/8/', |
40 |
os => '', |
builds => ['/build/builds/smeserver-8-core/'], |
41 |
builds => '/builds/smeserver-8-core/', |
community => '/build/builds/smeserver-8-contribs/', |
42 |
community => '/builds/smeserver-8-contribs/', |
stage => '/build/smeserver/stage/8/', |
|
stage => '/stage/8/', |
|
43 |
sign => 1, |
sign => 1, |
44 |
checksum => 'sha', |
checksum => 'sha', |
45 |
}, |
}, |
46 |
|
'9' => { active => 1, |
47 |
|
centos => 6, |
48 |
|
repo => '/build/smeserver/repo/testing/9/', |
49 |
|
builds => ['/build/builds/smeserver-9-core/'], |
50 |
|
community => '/build/builds/smeserver-9-contribs/', |
51 |
|
stage => '/build/smeserver/stage/9/', |
52 |
|
sign => 1, |
53 |
|
checksum => 'sha256', |
54 |
|
}, |
55 |
}; |
}; |
56 |
|
|
57 |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
my $repos = { "${repotag}os" => { prio => 19, inc => 1, ver => 1, rel => 1, os => 1 }, |
71 |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
'stage' => { prio => 1, inc => 0, ver => 0, rel => 0, stage => 1, os => 1 }, |
72 |
}; |
}; |
73 |
|
|
74 |
my $baserepo = { "~S${repotag}os/~A/$osdir/~O" => "${repotag}os", |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
75 |
"~S${repotag}updates/~A/RPMS/" => "${repotag}updates", |
"~S${repotag}updates/~A/" => "${repotag}updates", |
76 |
"~S${repotag}updates-testing/~A/RPMS/" => "${repotag}updates-testing", |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
77 |
"~S${repotag}extras/~A/RPMS/" => "${repotag}extras", |
"~S${repotag}extras/~A/" => "${repotag}extras", |
78 |
"~S${repotag}addons/~A/RPMS/" => "${repotag}addons", |
"~S${repotag}addons/~A/" => "${repotag}addons", |
79 |
"~S${repotag}contribs/~A/RPMS/" => "${repotag}contribs", |
"~S${repotag}contribs/~A/" => "${repotag}contribs", |
80 |
"~S${repotag}test/~A/RPMS/" => "${repotag}test", |
"~S${repotag}test/~A/" => "${repotag}test", |
81 |
"~S${repotag}dev/~A/RPMS/" => "${repotag}dev", |
"~S${repotag}dev/~A/" => "${repotag}dev", |
82 |
"/stage/~s/~A/$osdir/~O" => 'stage', |
"/build/smeserver/stage/~s/~A/" => 'stage', |
83 |
'/mirrors/centos/~C/fasttrack/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/fasttrack/~A/' => 'centos', |
84 |
'/mirrors/centos/~C/updates/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/updates/~A/' => 'centos', |
85 |
'/mirrors/centos/~C/os/~A/CentOS/~O' => 'centos', |
'/mirrors/centos/~C/os/~A/' => 'centos', |
86 |
'/mirrors/centos/~C/extras/~A/RPMS/' => 'centos', |
'/mirrors/centos/~C/extras/~A/' => 'centos', |
87 |
'/mirrors/centos-vault/~C/fasttrack/~A/RPMS/' => 'centos', |
'/mirrors/centos-vault/~C/fasttrack/~A/' => 'centos', |
88 |
'/mirrors/centos-vault/~C/updates/~A/RPMS/' => 'centos', |
'/mirrors/centos-vault/~C/updates/~A/' => 'centos', |
89 |
'/mirrors/centos-vault/~C/os/~A/CentOS/~O' => 'centos', |
'/mirrors/centos-vault/~C/os/~A/' => 'centos', |
90 |
'/mirrors/centos-vault/~C/extras/~A/RPMS/' => 'centos', |
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
91 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
92 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
93 |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/RPMS/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
94 |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/RPMS/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
95 |
'/mirrors/rpmforge/source/' => 'rpmforge', |
'/mirrors/rpmforge/source/' => 'rpmforge', |
96 |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
'/mirrors/atrpms/el~C-~A/atrpms/stable/' => 'atrpms', |
97 |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
'/mirrors/atrpms/el~C-~A/atrpms/testing/' => 'atrpms', |
100 |
}; |
}; |
101 |
|
|
102 |
if ( $opts{q} ) { |
if ( $opts{q} ) { |
103 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/RPMS/'} = 'centos'; |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/fasttrack/~A/'} = 'centos'; |
104 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/RPMS/'} = 'centos'; |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/updates/~A/'} = 'centos'; |
105 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/CentOS/~O'} = 'centos'; |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/os/~A/'} = 'centos'; |
106 |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/RPMS/'} = 'centos'; |
$baserepo->{'/mirrors/centos-qa/CentOS/~C/extras/~A/'} = 'centos'; |
107 |
} |
} |
108 |
|
|
109 |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
my $skippkg = { '7' => { 'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
116 |
'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' ) }, |
117 |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin' ) }, |
118 |
}, |
}, |
119 |
|
'9' => { 'atrpms' => { map { $_ => 1 } ( 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
120 |
|
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
121 |
|
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin' ) }, |
122 |
|
}, |
123 |
}; |
}; |
124 |
|
|
125 |
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; |
137 |
|
|
138 |
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 ) { |
139 |
my $bdir = $dir; |
my $bdir = $dir; |
|
$bdir =~ s/~O/$distrepo->{$ver}->{os}/; |
|
140 |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
$bdir =~ s/~S/$distrepo->{$ver}->{repo}/; |
141 |
$bdir =~ s/~s/$ver/; |
$bdir =~ s/~s/$ver/; |
142 |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
$bdir =~ s/~C/$distrepo->{$ver}->{centos}/; |
143 |
for my $arch ( @archs, 'SRPMS/' ) { |
for my $arch ( @archs, 'SRPMS/' ) { |
144 |
my $adir = $bdir; |
my $adir = $bdir; |
145 |
if ( $arch eq 'SRPMS/' ) { |
if ( $arch eq 'SRPMS/' ) { |
146 |
$adir =~ s/~A.*/$arch/; |
$adir =~ s/~A.*//; |
147 |
|
if ( -d "${adir}SRPMS" ) { |
148 |
|
$adir .= "SRPMS/"; |
149 |
|
} elsif ( -d "${adir}Source/SPackages" ) { |
150 |
|
$adir .= "Source/SPackages/"; |
151 |
|
} |
152 |
} else { |
} else { |
153 |
$adir =~ s/~A/$arch/; |
$adir =~ s/~A/$arch/; |
154 |
|
if ( -d "${adir}CentOS/RPMS" ) { |
155 |
|
$adir .= "CentOS/RPMS/"; |
156 |
|
} elsif ( -d "${adir}$osdir/RPMS" ) { |
157 |
|
$adir .= "$osdir/RPMS/"; |
158 |
|
} elsif ( -d "${adir}RPMS" ) { |
159 |
|
$adir .= "RPMS/"; |
160 |
|
} elsif ( -d "${adir}Packages" ) { |
161 |
|
$adir .= "Packages/"; |
162 |
|
} elsif ( -d "${adir}CentOS" ) { |
163 |
|
$adir .= "CentOS/"; |
164 |
|
} elsif ( -d "${adir}$osdir" ) { |
165 |
|
$adir .= "$osdir/"; |
166 |
|
} |
167 |
} |
} |
|
opendir DIR, $adir or next; |
|
168 |
next unless -d $adir; |
next unless -d $adir; |
169 |
|
opendir DIR, $adir or next; |
170 |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
process_rpm("$adir$_", $ver, $baserepo->{$dir}) foreach readdir DIR; |
171 |
closedir DIR; |
closedir DIR; |
172 |
last unless $dir =~ m{~A}; |
last unless $dir =~ m{~A}; |
173 |
} |
} |
174 |
} |
} |
175 |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'builds'} ); |
find( { wanted => sub { process_rpm($_, $ver, 'builds'); }, no_chdir => 1, follow_fast => 1 }, "$_" ) foreach @{$distrepo->{$ver}->{'builds'}}; |
176 |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
find( { wanted => sub { process_rpm($_, $ver, 'community'); }, no_chdir => 1, follow_fast => 1 }, $distrepo->{$ver}->{'community'} ) if $distrepo->{$ver}->{'community'}; |
177 |
|
|
178 |
foreach my $base ( sort keys %$rpms ) { |
foreach my $base ( sort keys %$rpms ) { |
452 |
my @d = (); |
my @d = (); |
453 |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
my $head = $distrepo->{$ver}->{repo} . $repo . '/'; |
454 |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
$head = $distrepo->{$ver}->{stage} if $repos->{$repo}->{stage}; |
455 |
my $tail = $repos->{$repo}->{os} ? "$osdir/" . $distrepo->{$ver}->{os} : 'RPMS/'; |
my $tail = $repos->{$repo}->{os} ? "$osdir/" : 'RPMS/'; |
456 |
if ( $pkg->{src} ) { |
if ( $pkg->{src} ) { |
457 |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
push @d, "${head}SRPMS/" . basename($pkg->{rpm}->filename); |
458 |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
} elsif ( $pkg->{rpm}->arch eq 'noarch' ) { |
503 |
foreach my $arch ( @archs ) { |
foreach my $arch ( @archs ) { |
504 |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
my $dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
505 |
$dir = qx(readlink -f $dir); |
$dir = qx(readlink -f $dir); |
506 |
chomp $dir; |
if ( $dir ) { |
507 |
|
chomp $dir; |
508 |
|
} else { |
509 |
|
$dir = $distrepo->{$ver}->{repo} . "$repo/$arch"; |
510 |
|
} |
511 |
print "rebuild $repo/$arch\n"; |
print "rebuild $repo/$arch\n"; |
512 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
513 |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
my $checksum = "--checksum $distrepo->{$ver}->{checksum}"; |
514 |
|
|
515 |
my $exclude = ""; |
my $exclude = ""; |
516 |
$exclude = "--exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
$exclude .= " --exclude ${osdir}/*" if -d "$dir/Packages"; |
517 |
|
$exclude .= " --exclude *smeserver-release*.rpm" if $dir =~ m{test/|-testing/}; |
518 |
|
|
519 |
my $groupfile = ""; |
my $groupfile = ""; |
520 |
$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"; |
521 |
|
|
522 |
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); |
523 |
qx(repoview $dir); |
qx(repoview $dir); |
531 |
} |
} |
532 |
} |
} |
533 |
unless ( $opts{t} ) { |
unless ( $opts{t} ) { |
534 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{builds}) if -d "$distrepo->{$ver}->{builds}"; |
foreach (@{$distrepo->{$ver}->{builds}}) |
535 |
|
{ |
536 |
|
finddepth(sub{rmdir}, "$_") if -d "$_"; |
537 |
|
} |
538 |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
finddepth(sub{rmdir}, $distrepo->{$ver}->{community}) if -d "$distrepo->{$ver}->{community}"; |
539 |
} |
} |
540 |
} |
} |
583 |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
eval { $pkg = RPM2->open_package($rpm, $rpm_flags); }; |
584 |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
if ($@) { print " * corrupt package ($rpm)\n"; return; } |
585 |
eval { my $sig = $pkg->siggpg }; |
eval { my $sig = $pkg->siggpg }; |
586 |
my $nosig = ! $@; |
|
587 |
|
my $nosig = 1; |
588 |
|
eval { my $sig = $pkg->dsaheader }; $nosig &= ! $@; |
589 |
|
eval { my $sig = $pkg->rsaheader }; $nosig &= ! $@; |
590 |
|
eval { my $sig = $pkg->siggpg }; $nosig &= ! $@; |
591 |
|
eval { my $sig = $pkg->sigpgp }; $nosig &= ! $@; |
592 |
|
|
593 |
my $cmp = $latest{$pkg->name}; |
my $cmp = $latest{$pkg->name}; |
594 |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
if ( $repos->{$repo}->{base} && ! $pkg->is_source_package ) { |
595 |
return unless $cmp; |
return unless $cmp; |
597 |
} |
} |
598 |
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$}; |
599 |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
return if $skippkg->{$ver}->{$repo} && ( $skippkg->{$ver}->{$repo}->{$src} || $skippkg->{$ver}->{$repo}->{$pkg->name} ); |
600 |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
601 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
602 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |
603 |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |
$arch = 'SRPMS' if $pkg->filename =~ m{[/-](SRPMS?|src|source)/}; |