From f570a29c5cec080269c1f2ee5ed467bf46e2adfe Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Fri, 28 Jun 2013 06:30:24 +0000 Subject: [PATCH] Fixing bug 3653: with more than 9 new_install_list sessions in otherpkgs.pkglist, perl 'sort' take the integers as string, and so does not sort the order correctly git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16818 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/rh/genimage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 47b8cc962..b67cdd98c 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -259,7 +259,7 @@ unless ($onlyinitrd) { my %pkg_hash=imgutils::get_package_names($pkglist); my $index=1; my $pass; - foreach $pass (sort (keys(%pkg_hash))) { + foreach $pass (sort {$a <=> $b} (keys(%pkg_hash))) { my $pkgnames = ""; foreach (keys(%{$pkg_hash{$pass}})) { if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} @@ -326,7 +326,7 @@ unless ($onlyinitrd) { if (keys(%extra_hash) > 0) { open($yumconfig,">>","/tmp/genimage.$$.yum.conf"); my $index=1; - foreach $pass (sort (keys(%extra_hash))) { + foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { 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"; @@ -346,7 +346,7 @@ unless ($onlyinitrd) { # $yumcmd .= "--enablerepo=otherpkgs$_ "; # } - foreach $pass (sort (keys(%extra_hash))) { + foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { $yumcmd = $yumcmd_base; foreach my $repo_index ( keys %{$repohash{$pass}} ) { $yumcmd .= "--enablerepo=otherpkgs$repo_index ";