Fixing two problems: 1. previously all the repos are enabled for all the yum commands. now we only enable the required repos for each yum command. 2. run yum clean in the diskless image to cleanup the repo meta data. this is required if there are multiple versions for one package name to be installed

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15749 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-03-31 22:45:18 +00:00
parent 2091c7a1c7
commit 0bc40f667a

View File

@ -322,6 +322,7 @@ unless ($onlyinitrd) {
}
my %extrapkgnames;
my %repohash;
if (keys(%extra_hash) > 0) {
open($yumconfig,">>","/tmp/genimage.$$.yum.conf");
my $index=1;
@ -329,6 +330,7 @@ unless ($onlyinitrd) {
foreach (keys(%{$extra_hash{$pass}})) {
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;}
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=file://$srcdir_otherpkgs/$_\ngpgpcheck=0\n\n";
$repohash{$pass}{$index} = 1;
$index++;
my $pa=$extra_hash{$pass}{$_};
$extrapkgnames{$pass} .= " " . join(' ', @$pa);
@ -336,15 +338,22 @@ unless ($onlyinitrd) {
}
close($yumconfig);
$index--;
$yumcmd = "yum $non_interactive -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir/ --disablerepo=* ";
my $yumcmd_base = "yum $non_interactive -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir/ --disablerepo=* ";
foreach (0..$repnum) {
$yumcmd .= "--enablerepo=$osver-$arch-$_ ";
$yumcmd_base .= "--enablerepo=$osver-$arch-$_ ";
}
for (1..$index) {
$yumcmd .= "--enablerepo=otherpkgs$_ ";
}
# for (1..$index) {
# $yumcmd .= "--enablerepo=otherpkgs$_ ";
# }
foreach $pass (sort (keys(%extra_hash))) {
$yumcmd = $yumcmd_base;
foreach my $repo_index ( keys %{$repohash{$pass}} ) {
$yumcmd .= "--enablerepo=otherpkgs$repo_index ";
}
system("$yumcmd clean all");
my $envlist;
if(exists($extra_hash{$pass}{ENVLIST})){
$envlist = join(' ', @{$extra_hash{$pass}{ENVLIST}});