|
|
@ -4,7 +4,8 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# Load common code and initialization
|
|
|
|
# Load common code and initialization
|
|
|
|
. ./internals/_build_common.sh
|
|
|
|
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
|
|
|
|
|
|
|
. ${SCRIPT_DIR}/internals/_build_common.sh
|
|
|
|
init_common
|
|
|
|
init_common
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -74,7 +75,11 @@ function search_module()
|
|
|
|
# Unique module
|
|
|
|
# Unique module
|
|
|
|
MODULE_FOUND="y"
|
|
|
|
MODULE_FOUND="y"
|
|
|
|
MOD_NAME=$LOC_MATCH
|
|
|
|
MOD_NAME=$LOC_MATCH
|
|
|
|
|
|
|
|
if [ "${bool_BUILD_FROM_PATH}" = "y" ]; then
|
|
|
|
|
|
|
|
MOD_GIT_PATH="$MOD_PATH"
|
|
|
|
|
|
|
|
else
|
|
|
|
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
|
|
|
|
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
|
|
|
|
|
|
|
|
fi
|
|
|
|
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
|
|
|
|
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
|
|
|
|
MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
|
|
|
|
MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -122,9 +127,10 @@ function search_module()
|
|
|
|
#----------------------------
|
|
|
|
#----------------------------
|
|
|
|
MOD_NAME="" # the name of the specified module
|
|
|
|
MOD_NAME="" # the name of the specified module
|
|
|
|
bool_BUILD_FROM_GIT="n"
|
|
|
|
bool_BUILD_FROM_GIT="n"
|
|
|
|
|
|
|
|
bool_BUILD_FROM_PATH="n"
|
|
|
|
|
|
|
|
bool_BUILD_LOCALLY="n"
|
|
|
|
bool_EXTRADEP_MOD="n"
|
|
|
|
bool_EXTRADEP_MOD="n"
|
|
|
|
bool_SHOW_BUILD_LOGS="n"
|
|
|
|
bool_SHOW_BUILD_LOGS="n"
|
|
|
|
bool_BUILD_LOCALLY="n"
|
|
|
|
|
|
|
|
bool_LOG_RESULT="n"
|
|
|
|
bool_LOG_RESULT="n"
|
|
|
|
bool_SHELL_HOOK="n"
|
|
|
|
bool_SHELL_HOOK="n"
|
|
|
|
bool_PREPARE_ONLY="n"
|
|
|
|
bool_PREPARE_ONLY="n"
|
|
|
@ -144,6 +150,15 @@ while [ $# -gt 0 ]; do
|
|
|
|
-lr) # Log build Result to file
|
|
|
|
-lr) # Log build Result to file
|
|
|
|
bool_LOG_RESULT="y"
|
|
|
|
bool_LOG_RESULT="y"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
-p) # build from specific Path
|
|
|
|
|
|
|
|
if [ -z "$MOD_NAME" ]; then
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
MOD_NAME="$1"
|
|
|
|
|
|
|
|
bool_BUILD_FROM_PATH="y"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
bool_INVALID_PARAMETERS="y"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
;;
|
|
|
|
-po) # Prepare build folder Only but do not build
|
|
|
|
-po) # Prepare build folder Only but do not build
|
|
|
|
bool_PREPARE_ONLY="y"
|
|
|
|
bool_PREPARE_ONLY="y"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -163,12 +178,42 @@ while [ $# -gt 0 ]; do
|
|
|
|
|
|
|
|
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "${bool_BUILD_FROM_GIT}" = "y" -a "${bool_BUILD_FROM_PATH}" = "y" ]; then
|
|
|
|
|
|
|
|
bool_INVALID_PARAMETERS="y"
|
|
|
|
|
|
|
|
fi
|
|
|
|
if [ "$bool_INVALID_PARAMETERS" != "n" ]; then
|
|
|
|
if [ "$bool_INVALID_PARAMETERS" != "n" ]; then
|
|
|
|
echo "Invalid arguments."
|
|
|
|
echo "Invalid arguments."
|
|
|
|
MOD_NAME="N/A"
|
|
|
|
MOD_NAME="N/A"
|
|
|
|
do_exit 1
|
|
|
|
do_exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If building from a given path, look up the module name
|
|
|
|
|
|
|
|
if [ "${bool_BUILD_FROM_PATH}" = "y" ]; then
|
|
|
|
|
|
|
|
if [ -d "${MOD_NAME}" ]; then
|
|
|
|
|
|
|
|
cd "${MOD_NAME}"
|
|
|
|
|
|
|
|
MOD_PATH=`pwd`
|
|
|
|
|
|
|
|
if [ "${USE_GIT_WORKTREES}" = "y" ]; then
|
|
|
|
|
|
|
|
MOD_NAME=`git rev-parse --git-dir 2>/dev/null | sed "s|.*/\([^\/]\+\)\.git.*|\1|"`
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
MOD_NAME=`basename "${MOD_PATH}"`
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${MOD_NAME}" != "" -a "${MOD_NAME}" != "tde" -a "${MOD_NAME}" != ".git" ]; then
|
|
|
|
|
|
|
|
# Valid git module
|
|
|
|
|
|
|
|
if [[ "${MOD_PATH}" =~ ${TDE_BUILD_DIR} ]]; then
|
|
|
|
|
|
|
|
# Module from build folder
|
|
|
|
|
|
|
|
bool_BUILD_FROM_GIT="n"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# Module from git repo
|
|
|
|
|
|
|
|
bool_BUILD_FROM_GIT="y"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
MOD_NAME=""
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
MOD_NAME=""
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}"
|
|
|
|
echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}"
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$MOD_NAME" = "" ]; then
|
|
|
|
if [ "$MOD_NAME" = "" ]; then
|
|
|
@ -176,7 +221,7 @@ if [ "$MOD_NAME" = "" ]; then
|
|
|
|
do_exit 3
|
|
|
|
do_exit 3
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Shell hook is only valid if not building locally
|
|
|
|
# Shell hooks are only valid if not building locally
|
|
|
|
if [ "bool_BUILD_LOCALLY" = "y" ]; then
|
|
|
|
if [ "bool_BUILD_LOCALLY" = "y" ]; then
|
|
|
|
bool_SHELL_HOOK="n"
|
|
|
|
bool_SHELL_HOOK="n"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -228,39 +273,30 @@ fi
|
|
|
|
# Make sure the module exists
|
|
|
|
# Make sure the module exists
|
|
|
|
search_module $MOD_NAME
|
|
|
|
search_module $MOD_NAME
|
|
|
|
if [ "$MODULE_FOUND" != "y" ]; then
|
|
|
|
if [ "$MODULE_FOUND" != "y" ]; then
|
|
|
|
echo "Module \"$MOD_NAME\" not found in GIT"
|
|
|
|
echo "Module \"$MOD_NAME\" not found"
|
|
|
|
do_exit 5
|
|
|
|
do_exit 5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
|
|
|
|
bool_COPY_PKGING_FILES="y"
|
|
|
|
|
|
|
|
|
|
|
|
# packaging scripts
|
|
|
|
# packaging scripts
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_GIT_PKGING_PATH" ]; then
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_GIT_PKGING_PATH" ]; then
|
|
|
|
echo "Packaging for \"$MOD_NAME\" not found in GIT"
|
|
|
|
echo "Packaging for \"$MOD_NAME\" not found in GIT"
|
|
|
|
do_exit 6
|
|
|
|
do_exit 6
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
bool_COPY_PKGING_FILES="y"
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e "${CYellow}> Building from BUILD folder${CNone}"
|
|
|
|
echo -e "${CYellow}> Building from BUILD folder${CNone}"
|
|
|
|
# source files
|
|
|
|
|
|
|
|
bool_COPY_MOD_SRC="n"
|
|
|
|
|
|
|
|
if [ ! -d "$MOD_BUILD_PATH" ]; then
|
|
|
|
if [ ! -d "$MOD_BUILD_PATH" ]; then
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
echo "Build folder for \"$MOD_NAME\" not found"
|
|
|
|
|
|
|
|
do_exit 7
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
bool_COPY_MOD_SRC="n"
|
|
|
|
# packaging scripts
|
|
|
|
|
|
|
|
bool_COPY_PKGING_FILES="n"
|
|
|
|
bool_COPY_PKGING_FILES="n"
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_BUILD_PKGING_PATH" ]; then
|
|
|
|
|
|
|
|
if [ ! -d "$MOD_GIT_PKGING_PATH" ]; then
|
|
|
|
|
|
|
|
echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT"
|
|
|
|
|
|
|
|
do_exit 8
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
bool_COPY_PKGING_FILES="y"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -279,7 +315,7 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then
|
|
|
|
recreate_folder "$MOD_BUILD_PATH"
|
|
|
|
recreate_folder "$MOD_BUILD_PATH"
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" ]; then
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" ]; then
|
|
|
|
# Normal module
|
|
|
|
# Normal module
|
|
|
|
cp -R "$MOD_GIT_PATH" "$MOD_BUILD_PATH/.."
|
|
|
|
cp -R "$MOD_GIT_PATH/." "$MOD_BUILD_PATH"
|
|
|
|
# Add GIT information
|
|
|
|
# Add GIT information
|
|
|
|
echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|
echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|
echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|
echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|