16 |
my %opts; |
my %opts; |
17 |
getopts( 'ostr:', \%opts ); |
getopts( 'ostr:', \%opts ); |
18 |
$opts{r} ||= ''; |
$opts{r} ||= ''; |
19 |
|
#available options |
20 |
|
#-o = verify we have originals of the packages in repos (not really used anymore) |
21 |
|
#-s = verify every package has a source package (so we can rebuild if necessary) |
22 |
|
#-t = test run (don't do anything just print out what would be done) |
23 |
|
#-r {regex} = regex of packages to run the script against |
24 |
|
|
25 |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
my $rpm_flags = RPM2->vsf_nodsaheader | RPM2->vsf_norsaheader | RPM2->vsf_nodsa | RPM2->vsf_norsa; |
26 |
|
|
28 |
my $disttag = 'sme'; |
my $disttag = 'sme'; |
29 |
my $repotag = 'sme'; |
my $repotag = 'sme'; |
30 |
|
|
31 |
my $distrepo = { '8' => { active => 1, |
my $distrepo = { '8' => { active => 0, |
32 |
centos => 5, |
centos => 5, |
33 |
archs => [ 'i386', 'x86_64' ], |
archs => [ 'i386', 'x86_64' ], |
34 |
repo => '/build/smeserver/repo/8/', |
repo => '/build/smeserver/repo/8/', |
63 |
}, |
}, |
64 |
}; |
}; |
65 |
|
|
66 |
|
# list here repo and priority |
67 |
|
# prio: highest priority will hide lowest priority |
68 |
|
# inc: include for iso ? |
69 |
|
# ver: |
70 |
|
# rel: |
71 |
|
# orig: |
72 |
|
# base, os, stage: |
73 |
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 }, |
74 |
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
"${repotag}updates" => { prio => 18, inc => 1, ver => 1, rel => 1 }, |
75 |
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
"${repotag}updates-testing" => { prio => 17, inc => 1, ver => 1, rel => 3 }, |
78 |
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
"${repotag}contribs" => { prio => 14, inc => 0, ver => 1, rel => 1 }, |
79 |
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
"${repotag}test" => { prio => 13, inc => 0, ver => 2, rel => 3, devel => 2 }, |
80 |
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
"${repotag}dev" => { prio => 12, inc => 0, ver => 1, rel => 1, devel => 1 }, |
81 |
'centos' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'centos' => { prio => 11, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
82 |
'epel' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'remi' => { prio => 10, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
83 |
|
'remisafe' => { prio => 9, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
84 |
|
'epel' => { prio => 8, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
85 |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'rpmforge' => { prio => 7, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
86 |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
'atrpms' => { prio => 6, inc => 0, ver => 0, rel => 0, orig => 1, base => 1 }, |
87 |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
'builds' => { prio => 4, inc => 0, ver => 0, rel => 0, orig => 1 }, |
89 |
'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 }, |
90 |
}; |
}; |
91 |
|
|
92 |
|
# list here the path on our local mirror to each upstream and our mirrors |
93 |
|
# ~A will be expanded to architecture |
94 |
|
# ~C will be expanded to Centos main version number, i.e. 7 for SME 10. |
95 |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
my $baserepo = { "~S${repotag}os/~A/" => "${repotag}os", |
96 |
"~S${repotag}updates/~A/" => "${repotag}updates", |
"~S${repotag}updates/~A/" => "${repotag}updates", |
97 |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
"~S${repotag}updates-testing/~A/" => "${repotag}updates-testing", |
111 |
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
'/mirrors/centos-vault/~C/extras/~A/' => 'centos', |
112 |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/~C/~A/' => 'epel', |
113 |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
'/mirrors/fedora/epel/testing/~C/~A/' => 'epel', |
114 |
|
'/mirrors/remi/enterprise/~C/remi/~A/' => 'remi', |
115 |
|
'/mirrors/remi/SRPMS/' => 'remi', |
116 |
|
'/mirrors/remi/enterprise/~C/safe/~A/' => 'remisafe', |
117 |
|
# '/mirrors/remi/SRPMS/' => 'remisafe', |
118 |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/dag/' => 'rpmforge', |
119 |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
'/mirrors/rpmforge/redhat/el~C/en/~A/extras/' => 'rpmforge', |
120 |
'/mirrors/rpmforge/source/' => 'rpmforge', |
'/mirrors/rpmforge/source/' => 'rpmforge', |
124 |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
'/mirrors/atrpms/src/el~C-~A/atrpms/testing/' => 'atrpms', |
125 |
}; |
}; |
126 |
|
|
127 |
|
# add here packages to exclude |
128 |
|
# for each version, if a repo is listed and rpm are listed they will be ignored fromt his repo |
129 |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
my $skippkg = { '8' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'gnupg' ) }, |
130 |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
'centos' => { map { $_ => 1 } ( 'horde', 'imp-h3', 'ingo-h3', 'turba-h3' ) }, |
131 |
'epel' => { map { $_ => 1 } ( 'clamav', 'cppunit', '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', 'cppunit', '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' ) }, |
132 |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin', 'lzo', 'perl-Convert-TNEF', 'perl-Mail-SPF', 'proftpd', 'erlang', 'perl-DateTime-Format-Mail', 'perl-DateTime-Format-W3CDTF', 'perl-Email-Abstract', 'perl-Email-MIME-Attachment-Stripper', 'perl-Email-Reply', 'perl-Font-AFM', 'perl-IPC-Run', 'rkhunter') }, |
'rpmforge' => { map { $_ => 1 } ( 'dovecot', 'libtalloc', 'mod_auth_tkt', 'perl-Test-Inline', 'spamassassin', 'lzo', 'perl-Convert-TNEF', 'perl-Mail-SPF', 'proftpd', 'erlang', 'perl-DateTime-Format-Mail', 'perl-DateTime-Format-W3CDTF', 'perl-Email-Abstract', 'perl-Email-MIME-Attachment-Stripper', 'perl-Email-Reply', 'perl-Font-AFM', 'perl-IPC-Run', 'rkhunter') }, |
133 |
}, |
}, |
134 |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple' ) }, |
'9' => { 'atrpms' => { map { $_ => 1 } ( 'clamav', 'perl-Pod-Escapes', 'perl-Pod-Simple','libvorbis' , 'libogg' ) }, |
135 |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
'epel' => { map { $_ => 1 } ( 'oidentd', 'perl-Razor-Agent' ) }, |
136 |
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin', 'portreserve', 'perl-libwww-perl' , 'lzo', 'perl-BSD-Resource', 'perl-Convert-ASN1', 'perl-Devel-StackTrace', 'perl-Digest-SHA1', 'perl-MIME-tools', 'perl-MailTools', 'perl-PPI', 'perl-URI', 'perl-XML-NamespaceSupport', 'perl-XML-Parser', 'perl-XML-SAX-Writer', 'perl-YAML-Syck', 'proftpd', 'syslinux') }, |
'rpmforge' => { map { $_ => 1 } ( 'perl-CGI', 'perl-Compress-Raw-Zlib', 'perl-ExtUtils-ParseXS', 'perl-Pod-Escapes', 'perl-Pod-Simple', 'perl-Time-HiRes', 'perl-version', 'spamassassin', 'portreserve', 'perl-libwww-perl' , 'lzo', 'perl-BSD-Resource', 'perl-Convert-ASN1', 'perl-Devel-StackTrace', 'perl-Digest-SHA1', 'perl-MIME-tools', 'perl-MailTools', 'perl-PPI', 'perl-URI', 'perl-XML-NamespaceSupport', 'perl-XML-Parser', 'perl-XML-SAX-Writer', 'perl-YAML-Syck', 'proftpd', 'syslinux') }, |
137 |
}, |
}, |
138 |
'10' => { |
'10' => { |
139 |
|
'centos' => { map { $_ => 1 } ( 'samba' ) }, |
140 |
|
'epel' => { map { $_ => 1 } ( 'clamav') }, |
141 |
}, |
}, |
142 |
}; |
}; |
143 |
|
|
144 |
|
# add here include only conditions |
145 |
|
# for each version if a repo is listed here, only listed rpm will be considered |
146 |
|
my $onlypkg = { '8' => { |
147 |
|
'remi' => { }, |
148 |
|
'remisafe' => { }, |
149 |
|
}, |
150 |
|
'9' => { |
151 |
|
'remi' => { }, |
152 |
|
}, |
153 |
|
'10' => { |
154 |
|
'remi' => { map { $_ => 1 } ( 'php-pear' )}, |
155 |
|
}, |
156 |
|
}; |
157 |
|
|
158 |
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; |
159 |
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; |
160 |
$devel2 ||= $devel1; |
$devel2 ||= $devel1; |
643 |
} |
} |
644 |
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$}; |
645 |
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} ); |
646 |
|
return if $onlypkg->{$ver}->{$repo} && !( $onlypkg->{$ver}->{$repo}->{$src} || $onlypkg->{$ver}->{$repo}->{$pkg->name} ); |
647 |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
return if $repos->{$repo}->{base} && $nosig && $baserepo->{$ver}->{sign}; |
648 |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
if ( $nosig && ! -f "$HOME/.rpmpass" ) { print " * missing signature (" .$pkg->filename . ")\n"; return; } |
649 |
my $arch = 'unknown'; |
my $arch = 'unknown'; |