From 93bcebcfff5e40dde630d80cdf3efd9b7a2f5c10 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 28 Aug 2019 16:56:16 +0200 Subject: abuild: Add -Z / --clean-somewhat option This option removes everything in the build tree but coreboot.rom, config.build, config.h and make.log - a useful subset of the tree for further testing. Change-Id: I27e559d8d7dc90d8fe5c4ed8e25249e202e5da36 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/35136 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- util/abuild/abuild | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/abuild/abuild b/util/abuild/abuild index ef4e46b8ed..4a62cfa045 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -398,6 +398,10 @@ function compile_target if [ "$clean_work" = "true" ]; then rm -rf "${build_dir}" fi + if [ "$clean_objs" = "true" ]; then + find ${build_dir} \! \( -name coreboot.rom -o -name config.h -o -name config.build -o -name make.log \) -type f -exec rm {} + + find ${build_dir} -type d -exec rmdir -p {} + 2>/dev/null + fi return $MAKE_FAILED } @@ -595,6 +599,7 @@ Options:\n" (defaults to $XMLFILE) [-y|--ccache] Use ccache [-z|--clean] Remove build results when finished + [-Z|--clean-somewhat] Remove build but keep coreboot.rom + config [-V|--version] Print version number and exit [-h|--help] Print this help and exit @@ -641,12 +646,12 @@ getoptbrand="$(getopt -V)" # shellcheck disable=SC2086 if [ "${getoptbrand:0:6}" == "getopt" ]; then # Detected GNU getopt that supports long options. - args=$(getopt -l version,verbose,quiet,help,all,target:,board-variant:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,any-toolchain,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root:,recursive,checksum:,timeless,exitcode,asserts -o Vvqhat:b:p:c:sJCl:rP:uyBLAzo:xX:K:d:R:Ie -- "$@") || exit 1 + args=$(getopt -l version,verbose,quiet,help,all,target:,board-variant:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,any-toolchain,clean,clean-somewhat,outdir:,chromeos,xmlfile:,kconfig:,dir:,root:,recursive,checksum:,timeless,exitcode,asserts -o Vvqhat:b:p:c:sJCl:rP:uyBLAzZo:xX:K:d:R:Ie -- "$@") || exit 1 eval set -- $args retval=$? else # Detected non-GNU getopt - args=$(getopt Vvqhat:b:p:c:sJCl:rP:uyBLAzo:xX:K:d:R:Ie "$@") + args=$(getopt Vvqhat:b:p:c:sJCl:rP:uyBLAZzo:xX:K:d:R:Ie "$@") set -- $args retval=$? fi @@ -658,6 +663,7 @@ fi chromeos=false clean_work=false +clean_objs=false verboseopt='V=0' customizing="" configoptions="" @@ -730,6 +736,10 @@ while true ; do customizing="${customizing}, clean" clean_work=true ;; + -Z|--clean-somewhat) shift + customizing="${customizing}, clean-somewhat" + clean_objs=true + ;; -o|--outdir) shift TARGET=$1; shift ;; -- cgit v1.2.3