From 1ccf2a151e58c8abca97b00c4a277895968842e6 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 20 Jul 2021 09:59:36 +0900 Subject: [PATCH] DEB build scripts: dropped 'internal pbuilder' option and some code improvements. Signed-off-by: Michele Calgaro --- debian/_buildscripts/local/README.txt | 1 - debian/_buildscripts/local/build_module.sh | 71 +++++++++++-------- .../local/internals/_pbuilder.sh | 10 +-- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/debian/_buildscripts/local/README.txt b/debian/_buildscripts/local/README.txt index fe08e1fc1..18d9f3493 100644 --- a/debian/_buildscripts/local/README.txt +++ b/debian/_buildscripts/local/README.txt @@ -188,7 +188,6 @@ When building sets of modules or the whole TDE, a global build summary is automa -po (Prepare Only): only prepare the source folder but do not build the module. Useful to prepare the source code before doing local changes/development. The module can then be built from the modified local folder -d (Debug) : enable debug symbols if possible (debian/rules file must contain "RelWithDebInfo" for this to work) - -ip (Internal Pbuilder): build using internal pbuilder mode (experimental) -
_.sh A number of scripts used to build sets of modules. Each script builds an individual set. diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh index 280d5fb22..a102c59de 100755 --- a/debian/_buildscripts/local/build_module.sh +++ b/debian/_buildscripts/local/build_module.sh @@ -28,12 +28,12 @@ function do_exit() { cd "$SCRIPT_DIR" if [ $1 -eq 0 ]; then - echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_GIVEN\"${CGreen} succeeded ####${CNone}" + echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_NAME\"${CGreen} succeeded ####${CNone}" if [ "$bool_LOG_RESULT" = "y" ]; then echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" fi else - echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_GIVEN\"${CRed} failed ($1) ####${CNone}" + echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_NAME\"${CRed} failed ($1) ####${CNone}" if [ "$bool_LOG_RESULT" = "y" ]; then echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" fi @@ -120,7 +120,7 @@ function search_module() #---------------------------- # Check command line arguments and set options #---------------------------- -MOD_GIVEN="" # the name of the specified module +MOD_NAME="" # the name of the specified module bool_BUILD_FROM_GIT="n" bool_EXTRADEP_MOD="n" bool_SHOW_BUILD_LOGS="n" @@ -129,31 +129,47 @@ bool_LOG_RESULT="n" bool_SHELL_HOOK="n" bool_PREPARE_ONLY="n" bool_DEBUG_MODE="n" -bool_INTERNAL_PBUILDER="n" -for arg in $@; do - if [ "$arg" = "-g" ]; then # select code to build from Git repo (-g) or from local build copy - bool_BUILD_FROM_GIT="y" - elif [ "$arg" = "-l" ]; then # build module Locally instead of in a clean chroot environment - bool_BUILD_LOCALLY="y" - elif [ "$arg" = "-sl" ]; then # output the building logs to terminal (ShowLog) - bool_SHOW_BUILD_LOGS="y" - elif [ "$arg" = "-lr" ]; then # Log build Result to file - bool_LOG_RESULT="y" - elif [ "$arg" = "-sh" ]; then # install Shell Hook for failing builds (only valid if NOT building locally) - bool_SHELL_HOOK="y" - elif [ "$arg" = "-po" ]; then # Prepare build folder Only but do not build - bool_PREPARE_ONLY="y" - elif [ "$arg" = "-d" ]; then # build with Debug symbols (used in hook scripts) - bool_DEBUG_MODE="y" - elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental) - bool_INTERNAL_PBUILDER="y" - elif [ "$MOD_GIVEN" = "" ]; then # module to be built - MOD_GIVEN="$arg" - fi +bool_INVALID_PARAMETERS="n" +while [ $# -gt 0 ]; do + case "$1" in + -d) # build with Debug symbols (used in hook scripts) + bool_DEBUG_MODE="y" + ;; + -g) # select code to build from Git repo (-g) or from local build copy + bool_BUILD_FROM_GIT="y" + ;; + -l) # build module Locally instead of in a clean chroot environment + bool_BUILD_LOCALLY="y" + ;; + -lr) # Log build Result to file + bool_LOG_RESULT="y" + ;; + -po) # Prepare build folder Only but do not build + bool_PREPARE_ONLY="y" + ;; + -sh) # install Shell Hook for failing builds (only valid if NOT building locally) + bool_SHELL_HOOK="y" + ;; + -sl) # output the building logs to terminal (ShowLog) + bool_SHOW_BUILD_LOGS="y" + ;; + *) # module to be built + if [ -z "$MOD_NAME" ]; then + MOD_NAME="$1" + else + bool_INVALID_PARAMETERS="y" + fi + esac + + shift done -MOD_NAME=$MOD_GIVEN # the actal module to be built +if [ "$bool_INVALID_PARAMETERS" != "n" ]; then + echo "Invalid arguments." + MOD_NAME="N/A" + do_exit 1 +fi -echo -e "${CLightCyan}#### Processing module \"$MOD_GIVEN\" ####${CNone}" +echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}" if [ "$MOD_NAME" = "" ]; then echo "Please specify the module to build" @@ -161,13 +177,10 @@ if [ "$MOD_NAME" = "" ]; then fi # Shell hook is only valid if not building locally -# Internal pbuilder option has no meaning if we are building locally if [ "bool_BUILD_LOCALLY" = "y" ]; then bool_SHELL_HOOK="n" - bool_INTERNAL_PBUILDER="n" fi export bool_SHELL_HOOK -export bool_INTERNAL_PBUILDER # Local option variables # - sign packages diff --git a/debian/_buildscripts/local/internals/_pbuilder.sh b/debian/_buildscripts/local/internals/_pbuilder.sh index 870758df0..ed4391dae 100755 --- a/debian/_buildscripts/local/internals/_pbuilder.sh +++ b/debian/_buildscripts/local/internals/_pbuilder.sh @@ -8,12 +8,6 @@ function run_pdebuild() PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell" PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps" - # Local option variables - # - internal pbuilder - OPT_INTERNAL_PBUILDER="" - if [ "$bool_INTERNAL_PBUILDER" = "y" ]; then - OPT_INTERNAL_PBUILDER="--use-pdebuild-internal" - fi # Sign packages optino OPT_SIGN_PKG_PBUILDER="" if [ ! -z "$GPG_SIGN_KEYID" ]; then @@ -82,7 +76,7 @@ END_D05_03 if [ ${DEB_BUILD_PARALLEL+x} ]; then OPT_BUILD_PARALLEL="DEB_BUILD_PARALLEL=$DEB_BUILD_PARALLEL" fi - eval pdebuild $OPT_INTERNAL_PBUILDER $OPT_SIGN_PKG_PBUILDER \ + eval pdebuild $OPT_SIGN_PKG_PBUILDER \ --architecture $ARCHITECTURE \ --buildresult \"$MOD_DEB_PATH\" \ --pbuilderroot \"sudo $OPT_BUILD_PARALLEL DISTRO_NAME=$DISTRO_NAME ARCHITECTURE=$ARCHITECTURE\" \ @@ -108,4 +102,4 @@ END_D05_03 #---------------------------- # The actual code is inside a function to allow the pdebuild return value to be # correctly passed back to the calling script in all cases (root and non root users) -run_pdebuild \ No newline at end of file +run_pdebuild