|
|
@ -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,25 +197,24 @@ 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
|
|
|
|
echo "Module \"$MOD_NAME\" not found in GIT"
|
|
|
|
MODULE_FOUND="n"
|
|
|
|
do_exit 5
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|
echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT"
|
|
|
|
MODULE_FOUND="n"
|
|
|
|
do_exit 7
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -195,10 +248,11 @@ else
|
|
|
|
echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT"
|
|
|
|
echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT"
|
|
|
|
do_exit 8
|
|
|
|
do_exit 8
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
bool_COPY_PKGING_FILES="y"
|
|
|
|
bool_COPY_PKGING_FILES="y"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------
|
|
|
|
#----------------------------
|
|
|
|
# Prepare source files
|
|
|
|
# Prepare source files
|
|
|
|
#----------------------------
|
|
|
|
#----------------------------
|
|
|
|