summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/build_module.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debian/_buildscripts/local/build_module.sh')
-rwxr-xr-xdebian/_buildscripts/local/build_module.sh110
1 files changed, 62 insertions, 48 deletions
diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh
index e8ccec472..515303ebe 100755
--- a/debian/_buildscripts/local/build_module.sh
+++ b/debian/_buildscripts/local/build_module.sh
@@ -69,54 +69,55 @@ function search_module()
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
- MODULE_FOUND="y"
- MOD_NAME=$LOC_MATCH
- if [ "${bool_BUILD_FROM_PATH}" = "y" ]; then
- MOD_GIT_PATH="$MOD_PATH"
+ # Check if it is a metapackage
+ LOC_BASENAME=`echo "$LOC_MOD_NAME" | sed -r "s|^(metapackages/)?||"`
+ LOC_MATCH=`ls "$REPO_TDE_MAIN/metapackages" | grep "^$LOC_BASENAME\$"`
+ if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then
+ # Unique metapackage found
+ MODULE_FOUND="y"
+ bool_METAPACKAGE_MOD="y"
+ MOD_NAME="metapackages/$LOC_MATCH"
+ MOD_GIT_PATH="$REPO_TDE_MAIN/metapackages/$LOC_BASENAME"
+ MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
+ MOD_BUILD_PATH="$TDE_BUILD_DIR/metapackages/$LOC_BASENAME"
+ else
+ # Search for unique 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
+ MODULE_FOUND="y"
+ 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"
+ fi
+ MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
+ MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
else
- MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
+ # Search for a unique folder with the same name
+ if [ -d "${REPO_TDE_MAIN}/$LOC_MOD_NAME" ]; then
+ # Folder found
+ MODULE_FOUND="y"
+ MOD_NAME=$LOC_MOD_NAME
+ MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
+ MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
+ MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
+ else
+ # Search in extra dependency folder
+ LOC_BASENAME=`echo "$LOC_MOD_NAME" | sed -r "s|^${CFG_EXTRA_DEPS_DIR}/(debian/)?||"`
+ LOC_MATCH=`ls "$REPO_EXTRA_DEPENDENCIES/debian" | grep "^$LOC_BASENAME\$"`
+ if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then
+ # Unique module found
+ MODULE_FOUND="y"
+ bool_EXTRADEP_MOD="y"
+ MOD_NAME="$CFG_EXTRA_DEPS_DIR/$LOC_MATCH"
+ MOD_GIT_PATH="$REPO_EXTRA_DEPENDENCIES/debian/$LOC_BASENAME"
+ MOD_BUILD_PATH="$TDE_BUILD_DIR/$CFG_EXTRA_DEPS_DIR/$LOC_BASENAME"
+ fi
+ fi
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
- if [ -d "${REPO_TDE_MAIN}/$LOC_MOD_NAME" ]; then
- # Folder found
- MODULE_FOUND="y"
- MOD_NAME=$LOC_MOD_NAME
- MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
- MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
- MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
- else
- # Search in extra dependency folder
- LOC_BASENAME=`echo "$LOC_MOD_NAME" | sed -r "s|^${CFG_EXTRA_DEPS_DIR}/(debian/)?||"`
- LOC_MATCH=`ls "$REPO_EXTRA_DEPENDENCIES/debian" | grep "^$LOC_BASENAME\$"`
- if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then
- # Unique module found
- MODULE_FOUND="y"
- bool_EXTRADEP_MOD="y"
- MOD_NAME="$CFG_EXTRA_DEPS_DIR/$LOC_MATCH"
- MOD_GIT_PATH="$REPO_EXTRA_DEPENDENCIES/debian/$LOC_BASENAME"
- MOD_BUILD_PATH="$TDE_BUILD_DIR/$CFG_EXTRA_DEPS_DIR/$LOC_BASENAME"
- else
- # Search in metapackages folder
- LOC_BASENAME=`echo "$LOC_MOD_NAME" | sed -r "s|^(metapackages/)?||"`
- LOC_MATCH=`ls "$REPO_TDE_MAIN/metapackages" | grep "^$LOC_BASENAME\$"`
- if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then
- # Unique module found
- MODULE_FOUND="y"
- MOD_NAME="metapackages/$LOC_MATCH"
- MOD_GIT_PATH="$REPO_TDE_MAIN/metapackages/$LOC_BASENAME"
- MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
- MOD_BUILD_PATH="$TDE_BUILD_DIR/metapackages/$LOC_BASENAME"
- fi
- fi
- fi
- fi
+ fi
export MOD_BUILD_PATH
MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian"
IFS=$OLDIFS
@@ -131,6 +132,7 @@ bool_BUILD_FROM_GIT="n"
bool_BUILD_FROM_PATH="n"
bool_BUILD_LOCALLY="n"
bool_EXTRADEP_MOD="n"
+bool_METAPACKAGE_MOD="n"
bool_SHOW_BUILD_LOGS="n"
bool_LOG_RESULT="n"
bool_SHELL_HOOK="n"
@@ -359,7 +361,7 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then
QUILT_PATCHES="debian/patches" quilt push -a >/dev/null
# Make sure patches are not reapplied in future local builds. This could stop pdebuild from working.
if [ -f "$MOD_BUILD_PATH/debian/patches/series" ]; then
- cp /dev/null "$MOD_BUILD_PATH/debian/patches/series"
+ rm "$MOD_BUILD_PATH/debian/patches/series"
fi
else
echo "There must be one and only one module folder in \"$MOD_GIT_PATH\""
@@ -373,7 +375,19 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then
if [ -d "$MOD_BUILD_PKGING_PATH" ]; then
$SUDO_CMD rm -R $MOD_BUILD_PKGING_PATH
fi
- cp -R "$MOD_GIT_PKGING_PATH" "$MOD_BUILD_PKGING_PATH"
+ if [ "$bool_METAPACKAGE_MOD" = "y" ]; then
+ cp -R "$MOD_GIT_PKGING_PATH/.." "$MOD_BUILD_PATH"
+ else
+ cp -R "$MOD_GIT_PKGING_PATH" "$MOD_BUILD_PKGING_PATH"
+ fi
+ if [[ -s "$MOD_BUILD_PKGING_PATH/patches/series" ]]; then
+ cd "$MOD_BUILD_PATH"
+ quilt push -a
+ # Make sure patches are not reapplied in future local builds. This could stop pdebuild from working.
+ if [ -f "$MOD_BUILD_PKGING_PATH/patches/series" ]; then
+ rm "$MOD_BUILD_PKGING_PATH/patches/series"
+ fi
+ fi
# Default package name
package=$(basename $PWD)-trinity-$pkgver