diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-01-12 18:42:39 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-01-12 18:42:39 +0900 |
commit | 87b45d83dad83997851874d0d73edb678f9143d4 (patch) | |
tree | eeabc4f2e67ac5f023140d989968f93a9091285f | |
parent | 8ed404bd14495d0edab5f810b9ed17c026c18fcd (diff) | |
download | tde-packaging-87b45d83dad83997851874d0d73edb678f9143d4.tar.gz tde-packaging-87b45d83dad83997851874d0d73edb678f9143d4.zip |
DEB build scripts: add support for module search among the list of known modules.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rwxr-xr-x | debian/_buildscripts/local/01_base_01.sh | 1 | ||||
-rw-r--r-- | debian/_buildscripts/local/README.txt | 14 | ||||
-rwxr-xr-x | debian/_buildscripts/local/build_module.sh | 110 |
3 files changed, 96 insertions, 29 deletions
diff --git a/debian/_buildscripts/local/01_base_01.sh b/debian/_buildscripts/local/01_base_01.sh index 351e3c940..7f89ebf00 100755 --- a/debian/_buildscripts/local/01_base_01.sh +++ b/debian/_buildscripts/local/01_base_01.sh @@ -12,6 +12,7 @@ build_module "dependencies/tqtinterface" build_module "dependencies/arts" build_module "dependencies/dbus-tqt" build_module "dependencies/dbus-1-tqt" +build_module "dependencies/tqca" build_module "dependencies/tqca-tls" build_module "dependencies/libart-lgpl" build_module "dependencies/avahi-tqt" diff --git a/debian/_buildscripts/local/README.txt b/debian/_buildscripts/local/README.txt index 0286f9454..c5daf21fb 100644 --- a/debian/_buildscripts/local/README.txt +++ b/debian/_buildscripts/local/README.txt @@ -158,7 +158,19 @@ When building sets of modules or the whole TDE, a global build summary is automa If '-ub' is used, the '-so' branch name must be one of those specified in the 'ub' branches. - build_module.sh - Build a single module. + Build a single module. The name of the module can be specified in two ways: + 1) by providing the full "folder/module name" location + Examples: + tdebase + applications/abakus + dependencies/libr + edeps/imlib + 2) by providing only the module name and let the script look up for a unique match among the known modules. + Examples: + tdebase + abakus + libr + imlib Usage: build_module.sh [options] module_name Options: diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh index 969a67a1c..b010316ee 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_NAME\"${CGreen} succeeded ####${CNone}" + echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_GIVEN\"${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_NAME\"${CRed} failed ($1) ####${CNone}" + echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_GIVEN\"${CRed} failed ($1) ####${CNone}" if [ "$bool_LOG_RESULT" = "y" ]; then echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" fi @@ -55,9 +55,64 @@ function recreate_folder() #---------------------------- +# Set module related path variables +# Parameters: +# $1 - module name +function set_module_paths() +{ + local LOC_MOD_NAME=$1 + if [ "$bool_EXTRADEP_MOD" != "y" ]; then + # Standard module + MOD_GIT_PATH="$REPO_TDE_MAIN/$LOC_MOD_NAME" + MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$LOC_MOD_NAME/debian" + else + # Extra dependency module + MOD_GIT_PATH="$REPO_DIR/$LOC_MOD_NAME" + fi + export MOD_BUILD_PATH="$TDE_BUILD_DIR/$LOC_MOD_NAME" + MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian" +} + + +#---------------------------- +# Look for a module in the git repository or in the extra dependency folder. +# Set the new module name if found. +# Parameters: +# $1 - module name +function search_module() +{ + OLDIFS=$IFS + IFS="*" + local LOC_MOD_NAME=$1 + local LOC_MATCH + MODULE_FOUND="n" + + # Search in GIT repository + LOC_MATCH=`sed -n "s|^\[submodule \"main/\([^\"]*\)\"\]$|\1|p" <"$REPO_TDE/.gitmodules" | grep "/$LOC_MOD_NAME$"` + if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then + # Unique module found in GIT + MODULE_FOUND="y" + MOD_NAME=$LOC_MATCH + set_module_paths $MOD_NAME + else + # Search in extra dependency folder + LOC_MATCH=`ls "$REPO_EXTRA_DEPENDENCIES" | grep "^$LOC_MOD_NAME$"` + if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then + # Unique module found in extra dependency folder + MODULE_FOUND="y" + bool_EXTRADEP_MOD="y" + MOD_NAME="$CFG_EXTRA_DEPS_DIR/$LOC_MATCH" + set_module_paths $MOD_NAME + fi + fi + IFS=$OLDIFS +} + + +#---------------------------- # Check command line arguments and set options #---------------------------- -MOD_NAME="" # the module to be built +MOD_GIVEN="" # the name of the specified module bool_BUILD_FROM_GIT="n" bool_EXTRADEP_MOD="n" bool_SHOW_BUILD_LOGS="n" @@ -84,21 +139,19 @@ for arg in $@; do bool_DEBUG_MODE="y" elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental) bool_INTERNAL_PBUILDER="y" - elif [ "$MOD_NAME" = "" ]; then # module to be built - MOD_NAME="$arg" + elif [ "$MOD_GIVEN" = "" ]; then # module to be built + MOD_GIVEN="$arg" fi done +MOD_NAME=$MOD_GIVEN # the actal module to be built + +echo -e "${CLightCyan}#### Processing module \"$MOD_GIVEN\" ####${CNone}" if [ "$MOD_NAME" = "" ]; then echo "Please specify the module to build" do_exit 3 fi -# Check if module is an extra dependency -if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then - bool_EXTRADEP_MOD="y" -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 @@ -118,9 +171,6 @@ if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then fi export OPT_SHOW_LOGS -# Log start -echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}" - # This folders must exists BASE_DIRS=("REPO_DIR" "BUILD_DIR" "SCRIPT_DIR" "REPO_TDE_MAIN" "REPO_TDE_PACKAGING" "HOOK_DIR") if [[ "$USE_PREBUILD_EXTRA_DEPS" != "y" ]]; then @@ -147,25 +197,24 @@ done #---------------------------- -# Check module name validity +# Check for module existance #---------------------------- -if [ "$bool_EXTRADEP_MOD" != "y" ]; then - # Standard module - MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME" - MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian" -else - # Extra dependency module - MOD_GIT_PATH="$REPO_DIR/$MOD_NAME" +# Check if module is an extra dependency +if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then + bool_EXTRADEP_MOD="y" fi -export MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME" -MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian" +set_module_paths $MOD_NAME if [ "$bool_BUILD_FROM_GIT" = "y" ]; then echo -e "${CYellow}> Building from GIT repo${CNone}" # source files if [ ! -d "$MOD_GIT_PATH" ]; then - echo "Module \"$MOD_NAME\" not found in GIT" - do_exit 5 + MODULE_FOUND="n" + search_module $MOD_NAME + if [ "$MODULE_FOUND" != "y" -o ! -d "$MOD_GIT_PATH" ]; then + echo "Module \"$MOD_NAME\" not found in GIT" + do_exit 5 + fi fi bool_COPY_MOD_SRC="y" @@ -182,8 +231,12 @@ else bool_COPY_MOD_SRC="n" if [ ! -d "$MOD_BUILD_PATH" ]; then if [ ! -d "$MOD_GIT_PATH" ]; then - echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT" - do_exit 7 + MODULE_FOUND="n" + search_module $MOD_NAME + if [ "$MODULE_FOUND" != "y" -o ! -d "$MOD_GIT_PATH" ]; then + echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT" + do_exit 7 + fi fi bool_COPY_MOD_SRC="y" fi @@ -195,10 +248,11 @@ else echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT" do_exit 8 fi - bool_COPY_PKGING_FILES="y" + bool_COPY_PKGING_FILES="y" fi fi + #---------------------------- # Prepare source files #---------------------------- |