DEB build scripts: fixed up spacing/tabs in commit 1ccf2a151.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/94/head
Michele Calgaro 3 years ago
parent 1ccf2a151e
commit b6a6bac01b
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -131,42 +131,42 @@ bool_PREPARE_ONLY="n"
bool_DEBUG_MODE="n"
bool_INVALID_PARAMETERS="n"
while [ $# -gt 0 ]; do
case "$1" in
-d) # build with Debug symbols (used in hook scripts)
bool_DEBUG_MODE="y"
;;
-g) # select code to build from Git repo (-g) or from local build copy
bool_BUILD_FROM_GIT="y"
;;
-l) # build module Locally instead of in a clean chroot environment
bool_BUILD_LOCALLY="y"
;;
-lr) # Log build Result to file
bool_LOG_RESULT="y"
;;
-po) # Prepare build folder Only but do not build
bool_PREPARE_ONLY="y"
;;
-sh) # install Shell Hook for failing builds (only valid if NOT building locally)
bool_SHELL_HOOK="y"
;;
-sl) # output the building logs to terminal (ShowLog)
bool_SHOW_BUILD_LOGS="y"
;;
*) # module to be built
if [ -z "$MOD_NAME" ]; then
MOD_NAME="$1"
else
bool_INVALID_PARAMETERS="y"
fi
esac
shift
case "$1" in
-d) # build with Debug symbols (used in hook scripts)
bool_DEBUG_MODE="y"
;;
-g) # select code to build from Git repo (-g) or from local build copy
bool_BUILD_FROM_GIT="y"
;;
-l) # build module Locally instead of in a clean chroot environment
bool_BUILD_LOCALLY="y"
;;
-lr) # Log build Result to file
bool_LOG_RESULT="y"
;;
-po) # Prepare build folder Only but do not build
bool_PREPARE_ONLY="y"
;;
-sh) # install Shell Hook for failing builds (only valid if NOT building locally)
bool_SHELL_HOOK="y"
;;
-sl) # output the building logs to terminal (ShowLog)
bool_SHOW_BUILD_LOGS="y"
;;
*) # module to be built
if [ -z "$MOD_NAME" ]; then
MOD_NAME="$1"
else
bool_INVALID_PARAMETERS="y"
fi
esac
shift
done
if [ "$bool_INVALID_PARAMETERS" != "n" ]; then
echo "Invalid arguments."
MOD_NAME="N/A"
do_exit 1
MOD_NAME="N/A"
do_exit 1
fi
echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}"

@ -2,100 +2,100 @@
function run_pdebuild()
{
# pbuilder absolute paths
PBUILDER_HOOK_DIR="/var/cache/pbuilder/hooks"
PBUILDER_SHELL_HOOK_TEMPLATE="$SCRIPT_DIR/internals/C10shell"
PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell"
PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps"
# Sign packages optino
OPT_SIGN_PKG_PBUILDER=""
if [ ! -z "$GPG_SIGN_KEYID" ]; then
OPT_SIGN_PKG_LOCAL="-k$GPG_SIGN_KEYID"
OPT_SIGN_PKG_PBUILDER="--auto-debsign --debsign-k $GPG_SIGN_KEYID"
fi
## Build module in a clean chroot environment using pbuilder
# Install/remove shell hook
if [ ! -d "$PBUILDER_HOOK_DIR" ]; then
mkdir -p "$PBUILDER_HOOK_DIR"
fi
if [ "$bool_SHELL_HOOK" = "y" ]; then
cp "$PBUILDER_SHELL_HOOK_TEMPLATE" "$PBUILDER_SHELL_HOOK"
chmod a+x "$PBUILDER_SHELL_HOOK"
else
if [ -x "$PBUILDER_SHELL_HOOK" ]; then
rm "$PBUILDER_SHELL_HOOK"
fi
fi
# Build using pbuilder
echo -e "${CYellow}> Building using pbuilder${CNone}"
# Create pbuilder hook to make sure all available packages are scanned
# Store any existing D05 hook as a temporary file, this will be reinstated at the end
cat <<END_D05_01 > "$PBUILDER_DEPS_HOOK"
# pbuilder absolute paths
PBUILDER_HOOK_DIR="/var/cache/pbuilder/hooks"
PBUILDER_SHELL_HOOK_TEMPLATE="$SCRIPT_DIR/internals/C10shell"
PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell"
PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps"
# Sign packages optino
OPT_SIGN_PKG_PBUILDER=""
if [ ! -z "$GPG_SIGN_KEYID" ]; then
OPT_SIGN_PKG_LOCAL="-k$GPG_SIGN_KEYID"
OPT_SIGN_PKG_PBUILDER="--auto-debsign --debsign-k $GPG_SIGN_KEYID"
fi
## Build module in a clean chroot environment using pbuilder
# Install/remove shell hook
if [ ! -d "$PBUILDER_HOOK_DIR" ]; then
mkdir -p "$PBUILDER_HOOK_DIR"
fi
if [ "$bool_SHELL_HOOK" = "y" ]; then
cp "$PBUILDER_SHELL_HOOK_TEMPLATE" "$PBUILDER_SHELL_HOOK"
chmod a+x "$PBUILDER_SHELL_HOOK"
else
if [ -x "$PBUILDER_SHELL_HOOK" ]; then
rm "$PBUILDER_SHELL_HOOK"
fi
fi
# Build using pbuilder
echo -e "${CYellow}> Building using pbuilder${CNone}"
# Create pbuilder hook to make sure all available packages are scanned
# Store any existing D05 hook as a temporary file, this will be reinstated at the end
cat <<END_D05_01 > "$PBUILDER_DEPS_HOOK"
#!/bin/sh
(cd "$TDE_DEBS_DIR"; apt-ftparchive packages . > Packages)
echo "deb [trusted=yes] file:$TDE_DEBS_DIR ./" >> /etc/apt/sources.list
END_D05_01
if [[ "$USE_PREBUILD_EXTRA_DEPS" = "y" ]]; then
# Get building branch from .tdescminfo file
if [[ -f "$MOD_BUILD_PATH/.tdescminfo" ]]; then
BUILD_BRANCH=`sed -n -r "s/^Revision: ([^-]+)-.*/\1/p" "$MOD_BUILD_PATH/.tdescminfo"`
bool_EDEPS_FOUND="n"
OLD_IFS=$IFS && IFS=$' \t'
while read l_branch l_repo l_component; do
if [ "$l_branch" = "$BUILD_BRANCH" ]; then
bool_EDEPS_FOUND="y"
cat <<END_D05_02 >> "$PBUILDER_DEPS_HOOK"
if [[ "$USE_PREBUILD_EXTRA_DEPS" = "y" ]]; then
# Get building branch from .tdescminfo file
if [[ -f "$MOD_BUILD_PATH/.tdescminfo" ]]; then
BUILD_BRANCH=`sed -n -r "s/^Revision: ([^-]+)-.*/\1/p" "$MOD_BUILD_PATH/.tdescminfo"`
bool_EDEPS_FOUND="n"
OLD_IFS=$IFS && IFS=$' \t'
while read l_branch l_repo l_component; do
if [ "$l_branch" = "$BUILD_BRANCH" ]; then
bool_EDEPS_FOUND="y"
cat <<END_D05_02 >> "$PBUILDER_DEPS_HOOK"
echo "deb [trusted=yes] $l_repo $DISTRO_NAME $l_component" >> /etc/apt/sources.list
END_D05_02
break
fi
done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$")
if [ "$bool_EDEPS_FOUND" != "y" ]; then
# EDEPS repository not found, use default. This could happen when building from sub branches of the main package repo
while read l_branch l_repo l_component; do
if [ "$l_branch" = "default" ]; then
bool_EDEPS_FOUND="y"
cat <<END_D05_02 >> "$PBUILDER_DEPS_HOOK"
break
fi
done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$")
if [ "$bool_EDEPS_FOUND" != "y" ]; then
# EDEPS repository not found, use default. This could happen when building from sub branches of the main package repo
while read l_branch l_repo l_component; do
if [ "$l_branch" = "default" ]; then
bool_EDEPS_FOUND="y"
cat <<END_D05_02 >> "$PBUILDER_DEPS_HOOK"
echo "deb [trusted=yes] $l_repo $DISTRO_NAME $l_component" >> /etc/apt/sources.list
END_D05_02
break
fi
done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$")
fi
IFS=$OLD_IFS
fi
fi
cat <<END_D05_03 >> "$PBUILDER_DEPS_HOOK"
break
fi
done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$")
fi
IFS=$OLD_IFS
fi
fi
cat <<END_D05_03 >> "$PBUILDER_DEPS_HOOK"
apt-get update
END_D05_03
chmod a+x "$PBUILDER_DEPS_HOOK"
# Build
OPT_BUILD_PARALLEL=""
if [ ${DEB_BUILD_PARALLEL+x} ]; then
OPT_BUILD_PARALLEL="DEB_BUILD_PARALLEL=$DEB_BUILD_PARALLEL"
fi
eval pdebuild $OPT_SIGN_PKG_PBUILDER \
--architecture $ARCHITECTURE \
--buildresult \"$MOD_DEB_PATH\" \
--pbuilderroot \"sudo $OPT_BUILD_PARALLEL DISTRO_NAME=$DISTRO_NAME ARCHITECTURE=$ARCHITECTURE\" \
--logfile \"$BUILDING_LOG_FILE\" \
-- \
--bindmounts \"$TDE_DEBS_DIR\" \
--hookdir \"$PBUILDER_HOOK_DIR\" \
$OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\"
PBUILDER_RETVAL=$?
# Remove shell hook if it was installed before the build
if [ -x "$PBUILDER_SHELL_HOOK" ]; then
rm "$PBUILDER_SHELL_HOOK"
fi
# Remove deps hook
if [ -x "$PBUILDER_DEPS_HOOK" ]; then
rm "$PBUILDER_DEPS_HOOK"
fi
# Return pdebuild return value to calling function
return $PBUILDER_RETVAL
chmod a+x "$PBUILDER_DEPS_HOOK"
# Build
OPT_BUILD_PARALLEL=""
if [ ${DEB_BUILD_PARALLEL+x} ]; then
OPT_BUILD_PARALLEL="DEB_BUILD_PARALLEL=$DEB_BUILD_PARALLEL"
fi
eval pdebuild $OPT_SIGN_PKG_PBUILDER \
--architecture $ARCHITECTURE \
--buildresult \"$MOD_DEB_PATH\" \
--pbuilderroot \"sudo $OPT_BUILD_PARALLEL DISTRO_NAME=$DISTRO_NAME ARCHITECTURE=$ARCHITECTURE\" \
--logfile \"$BUILDING_LOG_FILE\" \
-- \
--bindmounts \"$TDE_DEBS_DIR\" \
--hookdir \"$PBUILDER_HOOK_DIR\" \
$OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\"
PBUILDER_RETVAL=$?
# Remove shell hook if it was installed before the build
if [ -x "$PBUILDER_SHELL_HOOK" ]; then
rm "$PBUILDER_SHELL_HOOK"
fi
# Remove deps hook
if [ -x "$PBUILDER_DEPS_HOOK" ]; then
rm "$PBUILDER_DEPS_HOOK"
fi
# Return pdebuild return value to calling function
return $PBUILDER_RETVAL
}

Loading…
Cancel
Save