DEB build scripts: add support for module search among the list of known modules.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/32/head
Michele Calgaro 5 years ago
parent 8ed404bd14
commit 87b45d83da
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -12,6 +12,7 @@ build_module "dependencies/tqtinterface"
build_module "dependencies/arts" build_module "dependencies/arts"
build_module "dependencies/dbus-tqt" build_module "dependencies/dbus-tqt"
build_module "dependencies/dbus-1-tqt" build_module "dependencies/dbus-1-tqt"
build_module "dependencies/tqca"
build_module "dependencies/tqca-tls" build_module "dependencies/tqca-tls"
build_module "dependencies/libart-lgpl" build_module "dependencies/libart-lgpl"
build_module "dependencies/avahi-tqt" build_module "dependencies/avahi-tqt"

@ -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. If '-ub' is used, the '-so' branch name must be one of those specified in the 'ub' branches.
- build_module.sh - 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: Usage:
build_module.sh [options] module_name build_module.sh [options] module_name
Options: Options:

@ -28,12 +28,12 @@ function do_exit()
{ {
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
if [ $1 -eq 0 ]; then 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 if [ "$bool_LOG_RESULT" = "y" ]; then
echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME"
fi fi
else 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 if [ "$bool_LOG_RESULT" = "y" ]; then
echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME"
fi fi
@ -54,10 +54,65 @@ 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 # 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_BUILD_FROM_GIT="n"
bool_EXTRADEP_MOD="n" bool_EXTRADEP_MOD="n"
bool_SHOW_BUILD_LOGS="n" bool_SHOW_BUILD_LOGS="n"
@ -84,21 +139,19 @@ for arg in $@; do
bool_DEBUG_MODE="y" bool_DEBUG_MODE="y"
elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental) elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental)
bool_INTERNAL_PBUILDER="y" bool_INTERNAL_PBUILDER="y"
elif [ "$MOD_NAME" = "" ]; then # module to be built elif [ "$MOD_GIVEN" = "" ]; then # module to be built
MOD_NAME="$arg" MOD_GIVEN="$arg"
fi fi
done done
MOD_NAME=$MOD_GIVEN # the actal module to be built
echo -e "${CLightCyan}#### Processing module \"$MOD_GIVEN\" ####${CNone}"
if [ "$MOD_NAME" = "" ]; then if [ "$MOD_NAME" = "" ]; then
echo "Please specify the module to build" echo "Please specify the module to build"
do_exit 3 do_exit 3
fi 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 # Shell hook is only valid if not building locally
# Internal pbuilder option has no meaning if we are building locally # Internal pbuilder option has no meaning if we are building locally
if [ "bool_BUILD_LOCALLY" = "y" ]; then if [ "bool_BUILD_LOCALLY" = "y" ]; then
@ -118,9 +171,6 @@ if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then
fi fi
export OPT_SHOW_LOGS export OPT_SHOW_LOGS
# Log start
echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}"
# This folders must exists # This folders must exists
BASE_DIRS=("REPO_DIR" "BUILD_DIR" "SCRIPT_DIR" "REPO_TDE_MAIN" "REPO_TDE_PACKAGING" "HOOK_DIR") BASE_DIRS=("REPO_DIR" "BUILD_DIR" "SCRIPT_DIR" "REPO_TDE_MAIN" "REPO_TDE_PACKAGING" "HOOK_DIR")
if [[ "$USE_PREBUILD_EXTRA_DEPS" != "y" ]]; then if [[ "$USE_PREBUILD_EXTRA_DEPS" != "y" ]]; then
@ -147,26 +197,25 @@ done
#---------------------------- #----------------------------
# Check module name validity # Check for module existance
#---------------------------- #----------------------------
if [ "$bool_EXTRADEP_MOD" != "y" ]; then # Check if module is an extra dependency
# Standard module if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME" bool_EXTRADEP_MOD="y"
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
else
# Extra dependency module
MOD_GIT_PATH="$REPO_DIR/$MOD_NAME"
fi 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 if [ "$bool_BUILD_FROM_GIT" = "y" ]; then
echo -e "${CYellow}> Building from GIT repo${CNone}" echo -e "${CYellow}> Building from GIT repo${CNone}"
# source files # source files
if [ ! -d "$MOD_GIT_PATH" ]; then if [ ! -d "$MOD_GIT_PATH" ]; then
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" echo "Module \"$MOD_NAME\" not found in GIT"
do_exit 5 do_exit 5
fi fi
fi
bool_COPY_MOD_SRC="y" bool_COPY_MOD_SRC="y"
# packaging scripts # packaging scripts
@ -182,8 +231,12 @@ else
bool_COPY_MOD_SRC="n" bool_COPY_MOD_SRC="n"
if [ ! -d "$MOD_BUILD_PATH" ]; then if [ ! -d "$MOD_BUILD_PATH" ]; then
if [ ! -d "$MOD_GIT_PATH" ]; then if [ ! -d "$MOD_GIT_PATH" ]; then
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" echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT"
do_exit 7 do_exit 7
fi
fi fi
bool_COPY_MOD_SRC="y" bool_COPY_MOD_SRC="y"
fi fi
@ -199,6 +252,7 @@ else
fi fi
fi fi
#---------------------------- #----------------------------
# Prepare source files # Prepare source files
#---------------------------- #----------------------------

Loading…
Cancel
Save