From: BaiYuan <xca...@so...> - 2014-10-29 09:20:35
|
The branch, master has been updated via dff4cad29f8d3465638a52083b5001ec3074beff (commit) from 1c379b15900dbb37e9c149a616a99c39d3c83251 (commit) ----------------------------------------------------------------------- commit dff4cad29f8d3465638a52083b5001ec3074beff Author: baiyuan <by...@cn...> Date: Wed Oct 29 05:14:53 2014 -0400 fix defect 3847 buildkit addpkgs -k -r left useless kit component rpm in complete kit repos dir ----------------------------------------------------------------------- diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index c9c4b6d..08d3e51 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -3892,6 +3892,47 @@ sub NEW_kit_addpkgs } } + + #When using -k -r, there are useless repodir + #delete useless repo dir + my $kitrepodirby=$::base_repodir; + my $cmdby = "/bin/ls $kitrepodirby 2>/dev/null"; + my $outputby = `$cmdby`; + my @allrepolist = split(/\n/, $outputby); + my @dellist; + + foreach my $reponame (@allrepolist) + { + my $match=0; + foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) + { + my $repodirname = "$kr->{kitreponame}"; + + if ( ${repodirname} eq ${reponame} ) + { + ${match}++; + } + } + if ( ${match} == 0 ) + { + push(@dellist,$reponame); + } + } + + foreach my $del (@dellist) + { + my $delrepodir=$::base_repodir."/".$del ; + if ( -d $delrepodir ) + { + my $delcmd="rm -Rf $delrepodir"; + if ( system($delcmd) ) + { + print "Failed to delete useless repo directory \n"; + } + } + } + + # Build the full kit tar file my $buildtar_rc = &kit_buildtar; |