From b0bc63b519d05cdf4b3aedaa683de09f410e9785 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 21 May 2014 22:47:05 +0200 Subject: [PATCH] abuild: allow deleting the work directories immediately This is useful on pure build nodes that don't care for object files, just for a build log and success flag. Change-Id: Ida65d4e41652af0f1b7255309aec2eeb6ef5c9ef Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/5804 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- util/abuild/abuild | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/util/abuild/abuild b/util/abuild/abuild index 85b6406ef8..6c8c304984 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -254,18 +254,20 @@ function compile_target junit "" printf "ok\n" > compile.status printf "ok. (took ${duration}s)\n" - cd $CURR - return 0 else + ret=1 junit "" junitfile make.log junit "" printf "FAILED after ${duration}s!\nLog excerpt:\n" tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log - cd $CURR failed=1 - return 1 fi + cd $CURR + if [ $clean_work = "true" ]; then + rm -rf $TARGET/${VENDOR}_${MAINBOARD} + fi + return $ret } function build_target @@ -395,6 +397,7 @@ function myhelp printf " [-u|--update] update existing image\n" printf " [-P|--prefix ] file name prefix in CBFS\n" printf " [-B|--blobs] Allow using binary files\n" + printf " [-z|--clean] Remove build results when finished\n" printf " [-L|--clang] Use clang\n" printf " [--scan-build] use clang's static analyzer\n" printf " [cbroot] absolute path to coreboot sources\n" @@ -437,7 +440,7 @@ cmdline="$* -c 1" getoptbrand="`getopt -V`" if [ "${getoptbrand:0:6}" == "getopt" ]; then # Detected GNU getopt that supports long options. - args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang -o Vvhat:p:Tc:sJCl:rP:uyBL -- "$@"` || exit 1 + args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean -o Vvhat:p:Tc:sJCl:rP:uyBLz -- "$@"` || exit 1 eval set -- $args else # Detected non-GNU getopt @@ -450,6 +453,7 @@ if [ $? != 0 ]; then exit 1 fi +clean_work=false customizing="" configoptions="" while true ; do @@ -501,6 +505,10 @@ while true ; do customizing="${customizing}, clang" configoptions="${configoptions}CONFIG_COMPILER_LLVM_CLANG=y\n" ;; + -z|--clean) shift + customizing="${customizing}, clean" + clean_work=true + ;; --) shift; break;; -*) printf "Invalid option\n\n"; myhelp; exit 1;; *) break;;