From 8851d3a7d361197bf62b10ddd279a90889371a8e Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 3 Apr 2020 11:35:30 +0900 Subject: [PATCH] testbuild.sh: Make the use of "git clean" optional Also, update the list of command line options in the help text. --- tools/README.txt | 20 ++++++++++++++------ tools/testbuild.sh | 18 ++++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tools/README.txt b/tools/README.txt index 3433783143..d2b3e3b45a 100644 --- a/tools/README.txt +++ b/tools/README.txt @@ -994,18 +994,26 @@ testbuild.sh $ ./testbuild.sh -h - USAGE: ./testbuild.sh [-l|m|c|u|g|n] [-d] [-x] [-j ] [-a ] [-t ] + USAGE: ./testbuild.sh [-l|m|c|u|g|n] [-d] [-x] [-j ] [-a ] [-t ] [-p] [-G] ./testbuild.sh -h Where: -l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c), - Ubuntu under Windows 10 (u), or Windows native (n). Default Linux - -a provides the relative path to the apps/ directory. Default ../apps - -t provides the absolute path to top nuttx/ directory. Default $PWD/../nuttx - -p only print the list of configs without running any builds - -j passed on to make. Default: No -j make option + Ubuntu under Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Linux -d enables script debug output -x exit on build failures + -j passed on to make. Default: No -j make option. + -a provides the relative path to the apps/ directory. Default ../apps + -t provides the absolute path to top nuttx/ directory. + Default $WD/../nuttx, where $WD is the parent directory of + the directory where this script is. + -p only print the list of configs without running any builds + -G Use "git clean -xfdq" instead of "make distclean" to clean the tree. + This option may speed up the builds. However, note that: + * This assumes that your trees are git based. + * This assumes that only nuttx and apps repos need to be cleaned. + * If the tree has files not managed by git, they will be removed + as well. -h will show this help test and terminate selects the list of configurations to test. No default diff --git a/tools/testbuild.sh b/tools/testbuild.sh index 8025f1d7e7..fd901b65b4 100755 --- a/tools/testbuild.sh +++ b/tools/testbuild.sh @@ -44,10 +44,11 @@ unset testfile unset HOPTION unset JOPTION PRINTLISTONLY=0 +GITCLEAN=0 function showusage { echo "" - echo "USAGE: $progname [-l|m|c|u|g|n] [-si|-sl>] [-d] [-x] [-j ] [-a ] [-t ] " + echo "USAGE: $progname [-l|m|c|u|g|n] [-d] [-x] [-j ] [-a ] [-t ] [-p] [-G] " echo " $progname -h" echo "" echo "Where:" @@ -59,6 +60,12 @@ function showusage { echo " -a provides the relative path to the apps/ directory. Default ../apps" echo " -t provides the absolute path to top nuttx/ directory. Default $PWD/../nuttx" echo " -p only print the list of configs without running any builds" + echo " -G Use \"git clean -xfdq\" instead of \"make distclean\" to clean the tree." + echo " This option may speed up the builds. However, note that:" + echo " * This assumes that your trees are git based." + echo " * This assumes that only nuttx and apps repos need to be cleaned." + echo " * If the tree has files not managed by git, they will be removed" + echo " as well." echo " -h will show this help test and terminate" echo " selects the list of configurations to test. No default" echo "" @@ -97,6 +104,9 @@ while [ ! -z "$1" ]; do -p ) PRINTLISTONLY=1 ;; + -G ) + GITCLEAN=1 + ;; -h ) showusage ;; @@ -159,7 +169,11 @@ function distclean_with_git { function distclean { if [ -f .config ]; then echo " Cleaning..." - distclean_with_git || makefunc ${JOPTION} ${MAKE_FLAGS} distclean 1>/dev/null + if [ ${GITCLEAN} -eq 1 ]; then + distclean_with_git + else + makefunc ${JOPTION} ${MAKE_FLAGS} distclean 1>/dev/null + fi fi }