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/branches/2.8@16880 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-07-04 05:56:49 +00:00
parent 19241bce05
commit 987d47a43d

View File

@ -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;
}