From 5881cc4268fa25d675058c108891051badc5074f Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Thu, 4 Jul 2013 05:54:04 +0000 Subject: [PATCH] Fixed a potential problem with kitcomponent.prerequisite that in some cases prerequisite is not removed from KIT_RMPKGS.otherpkg.pkglist during addkitcomp. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16879 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kit.pm | 49 +++++++++++------------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 215511d5d..5305bce03 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -728,6 +728,15 @@ sub assign_to_osimage my @lines = (); my @kitpkgdeps = split ',', $kitcomptable->{kitpkgdeps}; + + # Remove prerequisite from KIT_RMPKGS.otherpkg.pkglist + if ( $kitcomptable and $kitcomptable->{prerequisite} ) { + my @kitpreps = split /,/, $kitcomptable->{prerequisite}; + foreach my $kitprep ( @kitpreps ) { + push @kitpkgdeps, $kitprep; + } + } + push @kitpkgdeps, $basename; my @l = (); @@ -2739,30 +2748,18 @@ sub rmkitcomp @kitpkgdeps = split ',', $kitcomps{$kitcomponent}{kitpkgdeps}; } + # Add prerequisite to KIT_RMPKGS.otherpkg.pkglist + if ( $kitcomps{$kitcomponent}{prerequisite} ) { + my @kitpreps = split /,/, $kitcomps{$kitcomponent}{prerequisite}; + foreach my $kitprep ( @kitpreps ) { + push @kitpkgdeps, $kitprep; + } + } + push @kitpkgdeps, $basename; my $update = 0; - #check if prerequisite rpm is already added to RMPKGS.otherpkgs.pkglist. - my $matched = 0; - foreach my $line ( @lines ) { - chomp $line; - if ( $line =~ /^-prep_$basename$/ ) { - $matched = 1; - last; - } - } - unless ( $matched ) { - # add the prerequisite rpm to #NEW_INSTALL_LIST# session - # so they can be removed in a seperate command - if ( $kitcomps{$kitcomponent}{prerequisite} ) { - push @l, "#NEW_INSTALL_LIST#\n"; - push @l, "-prep_$basename\n"; - } - $update = 1; - } - - my $added_mark = 0; foreach my $kitpkgdep ( @kitpkgdeps ) { next if ( $kitpkgdep =~ /^$/ ); my $matched = 0; @@ -2775,17 +2772,7 @@ sub rmkitcomp } unless ( $matched ) { - # add the prerequisite rpm to #NEW_INSTALL_LIST# session - # so they can be removed in a seperate command - if ( $kitcomps{$kitcomponent}{prerequisite} ) { - if (!$added_mark) { - push @l, "#NEW_INSTALL_LIST#\n"; - $added_mark = 1; - } - push @l, "-$kitpkgdep\n"; - } else { - unshift @l, "-$kitpkgdep\n"; - } + unshift @l, "-$kitpkgdep\n"; $update = 1; }