redhat: mockbuild updates for repoquery

for starters, mock should be careful not to use parent yum cache
when running repoquery, the host runs it, we want the guests's
yum cache. be careful to not attempt to use the parent's yum cache
(in the default config).

additionally, we need to not try to build 64 bit kernel modules in
32 bit chroots. expand the list of rpms while ejecting any which are
64 bit if we're 32.

additionally, blacklist kernels which are the wrong osver.

Change-Id: Id2a68cf66ddae57458c9f97314cd492e7b5132a8
Reviewed-on: http://gerrit.openafs.org/5322
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Derrick Brashear 2011-08-30 01:18:37 -04:00
parent 8d4f65c302
commit 24287ff015

View File

@ -10,6 +10,7 @@ use warnings;
use Getopt::Long;
use File::Path;
use IO::Dir;
use File::Temp qw/ tempfile tempdir /;
my $suser="nsu";
my $rootbase="/var/lib/mock/";
@ -22,16 +23,41 @@ my $ignorerelease = 1;
my @newrpms;
sub findKernels {
my ($root, $uname, @modules) = @_;
my ($root, $platform, $uname, @modules) = @_;
my ($fh, $tmpconf) = tempfile( "yum.confXXXX", DIR => "/tmp");
open(OLDCONF, "$root/etc/yum.conf");
while(<OLDCONF>) {
$_ =~ s#/var/cache/yum#/var/cache/mock/${platform}/yum_cache#;
print $fh $_;
}
close(OLDCONF);
my $archv = "";
open(PLATCONF, "/etc/mock/${platform}.cfg");
while (<PLATCONF>) {
if ($_ =~ "legal_host_arches") {
$_ =~ s/ //g;
$_ =~ /\(([\S]*)\)/;
$_ = $1;
if ($platform =~ "i386") {
$_ =~ s/\'x86_64\'//;
$_ =~ s/\,\,/\,/;
$_ =~ s/\,\$//;
}
if ($_ ne "") {
$archv="--archlist=$_";
}
}
}
close(PLATCONF);
my $modlist = join(" ", @modules);
my @kernels;
if ($uname) {
@kernels = `repoquery --whatprovides kernel-devel-uname-r --qf "%{name}.%{arch} %{version}-%{release}" -c $root/etc/yum.conf`;
@kernels = `repoquery $archv --whatprovides kernel-devel-uname-r --qf "%{name}.%{arch} %{version}-%{release}" -c $tmpconf`;
} else {
@kernels = `repoquery --whatprovides $modlist --qf "%{name}.%{arch} %{version}-%{release}" -c $root/etc/yum.conf`;
@kernels = `repoquery $archv --show-duplicates --whatprovides $modlist --qf "%{name}.%{arch} %{version}-%{release}" -c $tmpconf`;
}
unlink $tmpconf;
return @kernels;
}
@ -59,9 +85,9 @@ my %platconf = ( "centos-4-i386" => { osver => "el4",
results => "rhel5/x86_64" },
"centos-6-i386" => { osver => "el6",
kmod => '1',
basearch => 'i386',
basearch => 'i686',
updaterepo => 'update',
results => "rhel6/i386" },
results => "rhel6/i686" },
"centos-6-x86_64" => { osver => "el6",
kmod => '1',
basearch => 'x86_64',
@ -89,9 +115,9 @@ my %platconf = ( "centos-4-i386" => { osver => "el4",
results => "rhel5/x86_64" },
"epel-6-i386" => { osver => "el6",
kmod => '1',
basearch => 'i386',
basearch => 'i686',
updaterepo => 'update',
results => "rhel6/i386" },
results => "rhel6/i686" },
"epel-6-x86_64" => { osver => "el6",
kmod => '1',
basearch => 'x86_64',
@ -99,16 +125,16 @@ my %platconf = ( "centos-4-i386" => { osver => "el4",
results => "rhel6/x86_64" },
"fedora-14-i386" => { osver => "fc14",
kmod => "1",
basearch => "i386",
results => "fedora-14/i386" },
basearch => "i686",
results => "fedora-14/i686" },
"fedora-14-x86_64" => { osver => "fc14",
kmod => "1",
basearch => "x86_64",
results => "fedora-14/x86_64" },
"fedora-15-i386" => { osver => "fc15",
kmod => "1",
basearch => "i386",
results => "fedora-15/i386" },
basearch => "i686",
results => "fedora-15/i686" },
"fedora-15-x86_64" => { osver => "fc15",
kmod => "1",
basearch => "x86_64",
@ -204,12 +230,12 @@ foreach my $platform (@platforms) {
my @kernels;
if ($platform=~/fedora-development/) {
@kernels = findKernels($root, 0, "kernel-devel");
@kernels = findKernels($root, $platform, 0, "kernel-devel");
} elsif ($platform=~/centos-4/) {
@kernels = findKernels($root, 0, "kernel-devel", "kernel-smp-devel",
@kernels = findKernels($root, $platform, 0, "kernel-devel", "kernel-smp-devel",
"kernel-hugemem-devel", "kernel-xenU-devel");
} else {
@kernels = findKernels($root, 0, 'kernel-devel');
@kernels = findKernels($root, $platform, 0, 'kernel-devel');
}
foreach my $kernel (@kernels) {
@ -223,6 +249,7 @@ foreach my $platform (@platforms) {
next
if (exists($badkernels{$version}) && ($badkernels{$version}{$variant}));
next if ($variant =~/debug$/); # Fedora debug kernels are bad
next if ($kernel !~ /$osver/ ); # fc15 kernel in fc14 repo?
print "$arch : $variant : $version\n";
$modulelist{$arch} ={} if !$modulelist{$arch};