From 38aaa2667f7c4e41fb399ac265456491068f60a7 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 19 Feb 2018 23:15:36 +0900 Subject: DEB build scripts: fixed version numbering scheme. Added check to make sure the selected distro and version is supported. Signed-off-by: Michele Calgaro --- .../_buildscripts/local/scripts/_build_common.sh | 32 +++++++++++++++++++++- .../local/scripts/_build_config_template.sh | 7 ++--- debian/_buildscripts/local/scripts/build_module.sh | 14 +++++----- debian/_buildscripts/local/scripts/create_repo.sh | 2 +- debian/_buildscripts/local/scripts/distro_list.txt | 31 +++++++++++++++++++++ 5 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 debian/_buildscripts/local/scripts/distro_list.txt (limited to 'debian/_buildscripts') diff --git a/debian/_buildscripts/local/scripts/_build_common.sh b/debian/_buildscripts/local/scripts/_build_common.sh index 60f589acf..1287f8e12 100755 --- a/debian/_buildscripts/local/scripts/_build_common.sh +++ b/debian/_buildscripts/local/scripts/_build_common.sh @@ -89,7 +89,37 @@ function init_common() echo "Please check and modify the TDE_DIR variable as required, then rerun this script." exit 5 fi - + + # Make sure we have selected a supported distribution + DISTS_FILE=$SCRIPT_DIR/distro_list.txt + if [ ! -f "$DISTS_FILE" ]; then + echo -e "${CYellow} --- NOTE ---${CNone}" + echo "Could not find the list of supported distributions." + echo "Please check the file $DISTS_FILE exists, then rerun this script." + exit 6 + fi + export DISTRO_FOUND=${DISTRO_FOUND:-"n"} + if [ "$DISTRO_FOUND" != "y" ]; then + # Need to use a "here string" otherwise if the DISTRO_FOUND value is modified + # inside the while loop, this would not remember after the loop. + while read l_distro l_version l_name l_rel_suffix; do + if [ "$l_distro" = "$DISTRO" -a "$l_name" = "$DISTRO_NAME" ]; then + export DISTRO_FOUND="y" + export DISTRO_VERSION="$l_version" + export REL_SUFFIX="$l_rel_suffix" + break + fi + done <<< $(cat $DISTS_FILE | grep -E "^(\s*[^#\s]+\s+[^\s]+.*)$") + fi + if [ "$DISTRO_FOUND" != "y" ]; then + echo -e "${CYellow} --- NOTE ---${CNone}" + echo "The specified distribution ($DISTRO $DISTRO_NAME) is not supported." + echo "Something is wrong with your configuration ($CFG_FILE)" + echo "or with the list of supported distributions ($DISTS_FILE)." + echo "Please check the DISTRO and DISTRO_NAME variables, then rerun this script." + exit 7 + fi + SCRIPT_LOG_DIR=$TDE_DIR/$CFG_SCRIPT_LOG_DIR LOG_RESULT_FILENAME="$SCRIPT_LOG_DIR/build_result.log" # Log result into the common build logfile diff --git a/debian/_buildscripts/local/scripts/_build_config_template.sh b/debian/_buildscripts/local/scripts/_build_config_template.sh index d0c5a9d2c..d9dbbf8b0 100644 --- a/debian/_buildscripts/local/scripts/_build_config_template.sh +++ b/debian/_buildscripts/local/scripts/_build_config_template.sh @@ -4,9 +4,8 @@ # Build information #---------------------------- TDE_RELEASE="14.1.0" # TDE release number -DISTRO="debian" # Build for this distro -D_VERSION="buster" # Build for this distro version -REL_SUFFIX="~a" # Relative suffix for packages +DISTRO="debian" # Distro family +DISTRO_NAME="buster" # Distro name of specific version ARCHITECTURE="amd64" # Build for this architecture USE_LOCAL_BUILD_NUMBER="n" # If == "y", use local build numbering for modules BUILD_NUMBER="b001" # TDE build number @@ -24,7 +23,7 @@ CFG_GIT_DIR="1_git" CFG_BUILD_DIR="2_build" CFG_REPO_DIR="3_repo" CFG_GIT_TDE_MAIN="$CFG_GIT_DIR/tde/main" -CFG_GIT_TDE_PACKAGING="$CFG_GIT_DIR/tde-packaging/$DISTRO/$D_VERSION" +CFG_GIT_TDE_PACKAGING="$CFG_GIT_DIR/tde-packaging/$DISTRO/$DISTRO_NAME" CFG_GIT_EXTRA_DEPENDENCIES="$CFG_GIT_DIR/edeps" CFG_HOOK_DIR="$CFG_GIT_DIR/hooks" #Absolute paths diff --git a/debian/_buildscripts/local/scripts/build_module.sh b/debian/_buildscripts/local/scripts/build_module.sh index 3a421e572..fe70aba25 100755 --- a/debian/_buildscripts/local/scripts/build_module.sh +++ b/debian/_buildscripts/local/scripts/build_module.sh @@ -286,7 +286,7 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then DATE=$(date -R) GITUSER="$(git config --get user.name) <$(git config --get user.email)>" - echo "$PKG_NAME ($REL-0$DISTRO$D_VERSION.$ADD_REL+$PKG_REL) $D_VERSION; urgency=low" > "$MOD_BUILD_PKGING_PATH/changelog" + echo "$PKG_NAME ($REL-0$DISTRO$DISTRO_VERSION.$ADD_REL+$PKG_REL) $DISTRO_NAME; urgency=low" > "$MOD_BUILD_PKGING_PATH/changelog" echo -e "\n * Automated git build\n\n -- $GITUSER $DATE\n" >> "$MOD_BUILD_PKGING_PATH/changelog" cat "$GIT_TDE_PACKAGING/$MOD_NAME/debian/changelog" >> "$MOD_BUILD_PKGING_PATH/changelog" else @@ -294,8 +294,8 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then if [ "$BUILD_DATE" = "" ]; then BUILD_DATE=`date +%Y%m%d+%H%M` fi - BUILD_VERSION="4:$TDE_RELEASE-${BUILD_NUMBER}+$BUILD_DATE" # Module build version number (quilt format) - dch -b -v "$BUILD_VERSION" -D "$D_VERSION" -c "$MOD_BUILD_PKGING_PATH/changelog" "Autogenerated by building script" &>/dev/null + BUILDISTRO_NAME="4:$TDE_RELEASE-${BUILD_NUMBER}+$BUILD_DATE" # Module build version number (quilt format) + dch -b -v "$BUILDISTRO_NAME" -D "$DISTRO_NAME" -c "$MOD_BUILD_PKGING_PATH/changelog" "Autogenerated by building script" &>/dev/null fi fi @@ -400,15 +400,15 @@ else echo -e "${CYellow}> Building using pbuilder${CNone}" if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then if [ "$bool_INTERNAL_PBUILDER" = "y" ]; then - pdebuild --use-pdebuild-internal --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$D_VERSION ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" + pdebuild --use-pdebuild-internal --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" else - pdebuild --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$D_VERSION ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" + pdebuild --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" fi else if [ "$bool_INTERNAL_PBUILDER" = "y" ]; then - pdebuild --use-pdebuild-internal --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$D_VERSION ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" &>"$BUILDING_LOG_FILE" + pdebuild --use-pdebuild-internal --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" &>"$BUILDING_LOG_FILE" else - pdebuild --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$D_VERSION ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" &>"$BUILDING_LOG_FILE" + pdebuild --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" &>"$BUILDING_LOG_FILE" fi fi build_retval=$? diff --git a/debian/_buildscripts/local/scripts/create_repo.sh b/debian/_buildscripts/local/scripts/create_repo.sh index 3fc2f0238..5f64c7032 100755 --- a/debian/_buildscripts/local/scripts/create_repo.sh +++ b/debian/_buildscripts/local/scripts/create_repo.sh @@ -20,7 +20,7 @@ done #---------------------------- # Create/update TDE local debian repository echo -e "${CLightCyan}#### TDE local repository creation begin ####${CNone}" -ARCH_PATH="dists/$D_VERSION/main/binary-$ARCHITECTURE" +ARCH_PATH="dists/$DISTRO_NAME/main/binary-$ARCHITECTURE" REPO_DIR="$TDE_DIR/$CFG_REPO_DIR" REPO_DIR_BACKUP="$REPO_DIR.backup" REPO_PKG_DIR="$REPO_DIR/$ARCH_PATH" diff --git a/debian/_buildscripts/local/scripts/distro_list.txt b/debian/_buildscripts/local/scripts/distro_list.txt new file mode 100644 index 000000000..0ca037eb0 --- /dev/null +++ b/debian/_buildscripts/local/scripts/distro_list.txt @@ -0,0 +1,31 @@ +#!/bin/bash + +# List of supported distributions +DISTROS=" + debian 5.0 lenny + debian 6.0 squeeze + debian 7.0 wheezy + debian 8.0 jessie + debian 9.0 stretch + debian 10.0 buster ~a + debian 10.0 sid ~b + raspbian 7.0 raspbian-wheezy + raspbian 8.0 raspbian-jessie + ubuntu 10.04 lucid + ubuntu 10.10 maverick + ubuntu 11.04 natty + ubuntu 11.10 oneiric + ubuntu 12.04 precise + ubuntu 12.10 quantal + ubuntu 13.04 raring + ubuntu 13.10 saucy + ubuntu 14.04 trusty + ubuntu 14.10 utopic + ubuntu 15.04 vivid + ubuntu 15.10 wily + ubuntu 16.04 xenial + ubuntu 16.10 yakkety + ubuntu 17.04 zesty + ubuntu 17.10 artful + ubuntu 18.04 bionic ~a +" -- cgit v1.2.1