From 0a7963cc657c631e2e905074e2a71718cb1bdd62 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 21 Jan 2014 03:48:06 -0500 Subject: [PATCH] fix 3879,complete kit size is too big,just keep build_input in complete kit with buildkit.conf,other_files,plugins and scripts, remove other useless dir --- xCAT-buildkit/bin/buildkit | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 3a2cdc8cd..d55a8a669 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -952,6 +952,7 @@ sub kit_buildtar my $dir = dirname($::deploy_dir); my $bidir = "$dir/build_input"; + #It is for partial kit. if ($::HAVE_EXTERNAL_PKG or $::HAVE_NON_NATIVE_PKGS) { if ( -d "$bidir") { if ( system("cd $::deploy_dir; cd ..; cp -r build_input $kitname" ) ) { @@ -960,10 +961,48 @@ sub kit_buildtar } } } else { - my $mykitdir=$::deploy_dir."/"."build_input"; - if ( -d $mykitdir ) { - system("cd $mykitdir; cd ..; rm -r build_input" ); + #If it is complete kit and there is build_input directory in deploy_dir + #If there is tmp rpmbuild source_packages + #delete them from complete kit build_input + if ( -d "$bidir") { + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/tmp" )){ + print "Error:Could not delete build_input/tmp \n"; + } + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/rpmbuild" )){ + print "Error:Could not delete build_input/tmp \n"; + } + if (system("cd $::deploy_dir; cd ..; rm -fr build_input/source_packages" )){ + print "Error:Could not delete build_input/source_packages \n"; + } + if (system("cd $::deploy_dir; cd ..; cp -fr build_input $kitname")){ + print "Error: Could not copy building tarfile $tarfile \n"; + return 1; + } + } else{ + #If kit build dir is new created + #partial kit is never created before + #make sure there is build_input dir in complete kit dir + if (system("cd $::deploy_dir; mkdir -p build_input" )){ + print "Error creating kit build directory contents \n"; + return 1; } + if (system("cd $::deploy_dir; cp -fp $::workdir/buildkit.conf build_input" )){ + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/other_files build_input" )){ + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/plugins build_input" )){ + print "Error creating kit build directory contents \n"; + return 1; + } + if (system("cd $::deploy_dir; cp -frp $::workdir/scripts build_input" )){ + print "Error creating kit build directory contents \n"; + return 1; + } + } } print "Creating tar file $tarfile.\n";