summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-08-23 11:12:47 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-08-23 11:12:47 +0900
commitf1f0f187ab68bac4d9f5402f64d887a539a92218 (patch)
tree86dfdf33e68a4b649d67bc97d8c1571a22f57bf5 /debian/_buildscripts
parent684553c8146c7f379581fb51664f09abe2fa1aa5 (diff)
downloadtde-packaging-f1f0f187ab68bac4d9f5402f64d887a539a92218.tar.gz
tde-packaging-f1f0f187ab68bac4d9f5402f64d887a539a92218.zip
DEB build scripts: added ability to build from a specified folder.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/_buildscripts')
-rw-r--r--debian/_buildscripts/local/README.txt7
-rwxr-xr-xdebian/_buildscripts/local/build_module.sh84
-rwxr-xr-xdebian/_buildscripts/local/create_repo.sh3
-rwxr-xr-xdebian/_buildscripts/local/internals/_build_common.sh4
-rwxr-xr-xdebian/_buildscripts/local/internals/_build_set_common.sh3
-rwxr-xr-xdebian/_buildscripts/local/update_repositories.sh3
6 files changed, 75 insertions, 29 deletions
diff --git a/debian/_buildscripts/local/README.txt b/debian/_buildscripts/local/README.txt
index 6d9ea0b29..12044c7ae 100644
--- a/debian/_buildscripts/local/README.txt
+++ b/debian/_buildscripts/local/README.txt
@@ -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.
diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh
index c7c6cec0f..920e49716 100755
--- a/debian/_buildscripts/local/build_module.sh
+++ b/debian/_buildscripts/local/build_module.sh
@@ -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"
diff --git a/debian/_buildscripts/local/create_repo.sh b/debian/_buildscripts/local/create_repo.sh
index f03f92e84..222cb7740 100755
--- a/debian/_buildscripts/local/create_repo.sh
+++ b/debian/_buildscripts/local/create_repo.sh
@@ -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
#----------------------------
diff --git a/debian/_buildscripts/local/internals/_build_common.sh b/debian/_buildscripts/local/internals/_build_common.sh
index be1b520ec..0a17cb700 100755
--- a/debian/_buildscripts/local/internals/_build_common.sh
+++ b/debian/_buildscripts/local/internals/_build_common.sh
@@ -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}"
}
diff --git a/debian/_buildscripts/local/internals/_build_set_common.sh b/debian/_buildscripts/local/internals/_build_set_common.sh
index 08b4bf80e..82e7e8bba 100755
--- a/debian/_buildscripts/local/internals/_build_set_common.sh
+++ b/debian/_buildscripts/local/internals/_build_set_common.sh
@@ -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
diff --git a/debian/_buildscripts/local/update_repositories.sh b/debian/_buildscripts/local/update_repositories.sh
index 934a5a1b1..4286393ef 100755
--- a/debian/_buildscripts/local/update_repositories.sh
+++ b/debian/_buildscripts/local/update_repositories.sh
@@ -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