DEB build scripts: added ability to build from a specified folder.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/97/head
Michele Calgaro 3 years ago
parent 684553c814
commit f1f0f187ab
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -178,16 +178,21 @@ When building sets of modules or the whole TDE, a global build summary is automa
subfolder
edeps/imlib
Usage:
build_module.sh [options] module_name
build_module.sh [options] [module_name]
Options:
-g (Git) : build from git repo sources. If missing, build from the local copy in build folder.
-l (Local) : build the module locally. If missing, build in a clean chroot environment
-p <folder> (Path): build from the specified folder. This option cannot be used together with -g.
The path must be a module in the git repository or in the local build folder.
This option is mostly intended to be used when using branches with git worktrees.
-sl (Show Log) : output the building logs to terminal while the build is ongoing
-lr (Log Result) : log (append) build result (OK, FAILED) to TDE_DIR/0_logs/build_result.log file
-sh (Shell Hook) : use a shell hook for failing builds, only valid if building using pbuilder (clean chroot environment)
-po (Prepare Only): only prepare the source folder but do not build the module. Useful to prepare the source code before
doing local changes/development. The module can then be built from the modified local folder
-d (Debug) : enable debug symbols if possible (debian/rules file must contain "RelWithDebInfo" for this to work)
module_name : the module to build. If '-p <folder>' is used, this parameter must not be specified since the module
is derived from the <folder> parameter.
- <dd>_<set_name>.sh
A number of scripts used to build sets of modules. Each script builds an individual set.

@ -4,7 +4,8 @@
#
# Load common code and initialization
. ./internals/_build_common.sh
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
. ${SCRIPT_DIR}/internals/_build_common.sh
init_common
@ -74,8 +75,12 @@ function search_module()
# Unique module
MODULE_FOUND="y"
MOD_NAME=$LOC_MATCH
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
if [ "${bool_BUILD_FROM_PATH}" = "y" ]; then
MOD_GIT_PATH="$MOD_PATH"
else
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
fi
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
else
# Search for a unique folder with the same name
@ -122,9 +127,10 @@ function search_module()
#----------------------------
MOD_NAME="" # the name of the specified module
bool_BUILD_FROM_GIT="n"
bool_BUILD_FROM_PATH="n"
bool_BUILD_LOCALLY="n"
bool_EXTRADEP_MOD="n"
bool_SHOW_BUILD_LOGS="n"
bool_BUILD_LOCALLY="n"
bool_LOG_RESULT="n"
bool_SHELL_HOOK="n"
bool_PREPARE_ONLY="n"
@ -144,6 +150,15 @@ while [ $# -gt 0 ]; do
-lr) # Log build Result to file
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
bool_PREPARE_ONLY="y"
;;
@ -163,12 +178,42 @@ while [ $# -gt 0 ]; do
shift
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
echo "Invalid arguments."
MOD_NAME="N/A"
do_exit 1
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}"
if [ "$MOD_NAME" = "" ]; then
@ -176,7 +221,7 @@ if [ "$MOD_NAME" = "" ]; then
do_exit 3
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
bool_SHELL_HOOK="n"
fi
@ -222,45 +267,36 @@ done
#----------------------------
# Check if module is an extra dependency
if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then
bool_EXTRADEP_MOD="y"
bool_EXTRADEP_MOD="y"
fi
# Make sure the module exists
search_module $MOD_NAME
if [ "$MODULE_FOUND" != "y" ]; then
echo "Module \"$MOD_NAME\" not found in GIT"
do_exit 5
echo "Module \"$MOD_NAME\" not found"
do_exit 5
fi
if [ "$bool_BUILD_FROM_GIT" = "y" ]; then
echo -e "${CYellow}> Building from GIT repo${CNone}"
# source files
bool_COPY_MOD_SRC="y"
bool_COPY_PKGING_FILES="y"
# packaging scripts
if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_GIT_PKGING_PATH" ]; then
echo "Packaging for \"$MOD_NAME\" not found in GIT"
do_exit 6
fi
bool_COPY_PKGING_FILES="y"
#
else
echo -e "${CYellow}> Building from BUILD folder${CNone}"
# source files
bool_COPY_MOD_SRC="n"
if [ ! -d "$MOD_BUILD_PATH" ]; then
bool_COPY_MOD_SRC="y"
echo "Build folder for \"$MOD_NAME\" not found"
do_exit 7
fi
# packaging scripts
bool_COPY_MOD_SRC="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
@ -279,7 +315,7 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then
recreate_folder "$MOD_BUILD_PATH"
if [ "$bool_EXTRADEP_MOD" != "y" ]; then
# Normal module
cp -R "$MOD_GIT_PATH" "$MOD_BUILD_PATH/.."
cp -R "$MOD_GIT_PATH/." "$MOD_BUILD_PATH"
# Add GIT information
echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo"
echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo"

@ -4,7 +4,8 @@
#
# Load common code and initialization
. ./internals/_build_common.sh
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
. ${SCRIPT_DIR}/internals/_build_common.sh
init_common
#----------------------------

@ -89,6 +89,8 @@ function _set_path_variables()
#----------------------------
function init_common()
{
local CURR_DIR=`pwd`
# Check script folder
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
@ -230,7 +232,7 @@ function init_common()
exit 10
fi
cd "$SCRIPT_DIR"
cd "${CURR_DIR}"
}

@ -1,7 +1,8 @@
#!/bin/bash
# Load common code and initialization
. ./internals/_build_common.sh
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
. ${SCRIPT_DIR}/internals/_build_common.sh
init_common
_BUILDSET_TIMER=1

@ -35,7 +35,8 @@ for ((idx=1; idx<=$#; idx++)); do
done
# Load common code
. ./internals/_build_common.sh
export SCRIPT_DIR=$(dirname $(readlink -f "$0"))
. ${SCRIPT_DIR}/internals/_build_common.sh
init_common
UPDATE_LOCK_FILENAME="/var/lock/TDE_update_repo_lock" # Lock file for incremental update

Loading…
Cancel
Save