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 4 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/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"

@ -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:

@ -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
@ -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
#----------------------------
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
#----------------------------

Loading…
Cancel
Save