From 9e26b11fe23f383b95b4a0f161c64b3506561ade Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Sun, 31 Mar 2013 22:44:19 +0000 Subject: [PATCH] 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/trunk@15748 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 829b81def..75275469b 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -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}});