diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-07-30 22:49:19 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-07-30 22:49:19 +0900 |
commit | 10a972bbd7ab75c6d3cd68ec3e30b8a70bf3b168 (patch) | |
tree | 93bac0bbb97f8907b4445d617e4046d6bb1050ea | |
parent | 55d493de587a08b20eec26ada3cdad49c8329cf9 (diff) | |
download | tde-packaging-10a972bbd7ab75c6d3cd68ec3e30b8a70bf3b168.tar.gz tde-packaging-10a972bbd7ab75c6d3cd68ec3e30b8a70bf3b168.zip |
DEB build scripts:
- fixed support for Devuan Jessie.
- dropped Sarge, Etch, Lenny, Lucid from list of supported distros.
- added auto detection of distro, distro name and architecture.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
6 files changed, 105 insertions, 102 deletions
diff --git a/debian/_buildscripts/local/README.txt b/debian/_buildscripts/local/README.txt index d4434444b..f2eb1a2b2 100644 --- a/debian/_buildscripts/local/README.txt +++ b/debian/_buildscripts/local/README.txt @@ -56,9 +56,9 @@ A) Environment preparation to the respectivily named folders. 7) Create pbuilder base package with the command: - sudo pbuilder --create + sudo pbuilder create If you wish to build for a different distro or architecture, use the command: - sudo DIST=<target distro> ARCH=<target architecture> pbuilder --create + sudo DISTRIBUTION=<target distro> ARCHITECTURE=<target architecture> pbuilder create 8) Setup the build scripts locally: - copy build scripts from "TDE_DIR/1_git/tde-packaging/debian/_buildscripts/local" to "TDE_DIR/buildscripts" @@ -68,7 +68,8 @@ A) Environment preparation - edit "_config.sh" to set your preferences and check that the various folder names match the structure on your disk. Make sure to set the following variables: * TDE_DIR to the correct path. - * DISTRO, DISTRO_NAME and ARCHITECTURE to match the distro and architecture you want to build for. + * DISTRO, DISTRO_NAME and ARCHITECTURE to match the distro and architecture you want to build for if different + from your current setup. Otherwise the variables can be left empty and auto detection will be performed. * UPDATE_BRANCHES to the branches you want to keep updated from the main repositories. * DEFAULT_REPO_BRANCH to the branch to check out at the end of the repositories update process. diff --git a/debian/_buildscripts/local/additional_files/etc/pbuilderrc b/debian/_buildscripts/local/additional_files/etc/pbuilderrc index fde052b35..00ed2cd8a 100644 --- a/debian/_buildscripts/local/additional_files/etc/pbuilderrc +++ b/debian/_buildscripts/local/additional_files/etc/pbuilderrc @@ -33,108 +33,103 @@ export SHELL=/bin/bash PKGNAME_LOGFILE="__build__.log" #-- get desired distribution and architecture -if [ "$DIST" = "" ]; then - DIST=$(lsb_release -cs) -fi -DISTRIBUTION=$DIST -if [ "$ARCH" = "" ]; then - ARCH=$(dpkg --print-architecture) -fi -ARCHITECTURE=$ARCH - -if [ -n "$T" ]; then - if [ "${T##*-}" = "vm" ]; then - BUILD_VM="qemu" - T=${T%-vm} - fi - if [ "${T#*@}" = "$T" ]; then - DISTRIBUTION=${T%-*} - ARCHITECTURE=${T##*-} - else - DISTRIBUTION=${T%@*} - ARCHITECTURE=${T##*@} - fi - if [ "${DISTRIBUTION##*-}" = "backports" ]; then - BACKPORTS="yes" - DISTRIBUTION=${DISTRIBUTION%-backports} - fi -fi +DISTRIBUTION="$DISTRO_NAME" +[[ "$DISTRO" = "" ]] && DISTRO=$(lsb_release -is | sed -e 's/\(.*\)/\L\1/') +[[ "$DISTRIBUTION" = "" ]] && DISTRIBUTION=$(lsb_release -cs | sed -e 's/\(.*\)/\L\1/') +[[ "$ARCHITECTURE" = "" ]] && ARCHITECTURE=$(dpkg --print-architecture) -BASETGZ="/var/cache/pbuilder/base-$DIST@$ARCH.tgz" +BASETGZ="/var/cache/pbuilder/base-$DISTRIBUTION@$ARCHITECTURE.tgz" #-- select apt components case "$DISTRIBUTION" in - sid|buster|stretch|jessie|wheezy|squeeze|lenny|etch|sarge) - COMPONENTS="main contrib non-free" - ;; - - ceres|beowulf|ascii) - COMPONENTS="main" - DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) - EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring" - ;; - - bionic|artful|zesty|yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) - COMPONENTS="main restricted universe multiverse" - DEBOOTSTRAPOPTS=(--variant=buildd) - ;; - - raspbian-jessie|raspbian-wheezy) - COMPONENTS="main contrib non-free" - DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) - ;; + jessie) + if [[ "$DISTRO" = "devuan" ]]; then + COMPONENTS="main" + DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) + EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring" + else + COMPONENTS="main contrib non-free" + fi + ;; + + sid|buster|stretch|wheezy|squeeze) + COMPONENTS="main contrib non-free" + ;; + + ceres|beowulf|ascii) + COMPONENTS="main" + DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) + EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring" + ;; + + bionic|artful|zesty|yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick) + COMPONENTS="main restricted universe multiverse" + DEBOOTSTRAPOPTS=(--variant=buildd) + ;; + + raspbian-jessie|raspbian-wheezy) + COMPONENTS="main contrib non-free" + DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) + ;; esac EXTRAPACKAGES="$EXTRAPACKAGES fakeroot apt-transport-https ca-certificates" #-- select base apt sources case "$DISTRIBUTION" in - sid|buster|stretch|jessie|wheezy) - MIRRORSITE=http://deb.debian.org/debian - ;; - - squeeze|lenny|etch|sarge) - MIRRORSITE=http://archive.debian.org/debian - OTHERMIRROR="#deb http://archive.debian.org/backports.org $DISTRIBUTION-backports main contrib non-free" - ;; - - ceres|beowulf|ascii) - MIRRORSITE=http://auto.mirror.devuan.org/merged - ;; - - bionic|artful|zesty|yakkety|wily|vivid|trusty|precise) - if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then - MIRRORSITE=http://archive.ubuntu.com/ubuntu - else - MIRRORSITE=http://ports.ubuntu.com - fi - ;; - - xenial) - if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then - MIRRORSITE=http://archive.ubuntu.com/ubuntu - else - MIRRORSITE=http://ports.ubuntu.com - fi - OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS" - ;; - - utopic|saucy|raring|quantal|oneiric|natty|maverick|lucid) - MIRRORSITE=http://old-releases.ubuntu.com/ubuntu - ;; - - raspbian-jessie|raspbian-wheezy) - MIRRORSITE=http://ftp.fi.muni.cz/pub/linux/raspbian/raspbian - ;; + jessie) + if [[ "$DISTRO" = "devuan" ]]; then + MIRRORSITE=http://auto.mirror.devuan.org/merged + else + MIRRORSITE=http://deb.debian.org/debian + fi + ;; + + sid|buster|stretch|wheezy) + MIRRORSITE=http://deb.debian.org/debian + ;; + + squeeze) + MIRRORSITE=http://archive.debian.org/debian + ;; + + ceres|beowulf|ascii) + MIRRORSITE=http://auto.mirror.devuan.org/merged + ;; + + bionic|artful|zesty|yakkety|wily|vivid|trusty|precise) + if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then + MIRRORSITE=http://archive.ubuntu.com/ubuntu + else + MIRRORSITE=http://ports.ubuntu.com + fi + ;; + + xenial) + if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then + MIRRORSITE=http://archive.ubuntu.com/ubuntu + else + MIRRORSITE=http://ports.ubuntu.com + fi + OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS" + ;; + + utopic|saucy|raring|quantal|oneiric|natty|maverick) + MIRRORSITE=http://old-releases.ubuntu.com/ubuntu + ;; + + raspbian-jessie|raspbian-wheezy) + MIRRORSITE=http://ftp.fi.muni.cz/pub/linux/raspbian/raspbian + ;; esac -if [ -n "${ARCH}" ]; then - NAME="$NAME-$ARCH" - DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") +if [ -n "${ARCHITECTURE}" ]; then + NAME="$NAME-$ARCHITECTURE" + DEBOOTSTRAPOPTS=("--arch" "$ARCHITECTURE" "${DEBOOTSTRAPOPTS[@]}") fi -BUILDRESULT="/var/cache/pbuilder/$DISTRIBUTION/result/" +BUILDRESULT="/var/cache/pbuilder/$DISTRO-$DISTRIBUTION/result/" -APTCACHE="/var/cache/pbuilder/aptcache/$DISTRIBUTION/" +APTCACHE="/var/cache/pbuilder/aptcache/$DISTRO-$DISTRIBUTION/" if [ -n "$APTCACHE" ] && [ ! -d "$APTCACHE" ]; then mkdir $APTCACHE fi @@ -168,9 +163,8 @@ case "$DISTRIBUTION" in PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt" ;; - jessie|wheezy|squeeze|lenny|etch|sarge|\ - raspbian-jessie|raspbian-wheezy|\ - yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) + jessie|wheezy|squeeze|raspbian-jessie|raspbian-wheezy|\ + yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick) PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude" ;; esac diff --git a/debian/_buildscripts/local/internals/_build_common.sh b/debian/_buildscripts/local/internals/_build_common.sh index 8b048a635..28f3fb2bf 100755 --- a/debian/_buildscripts/local/internals/_build_common.sh +++ b/debian/_buildscripts/local/internals/_build_common.sh @@ -54,6 +54,12 @@ function _set_path_variables() { # Set useful path variables set -a + + #-- get desired distribution and architecture + [[ "$DISTRO" = "" ]] && DISTRO=$(lsb_release -is | sed -e 's/\(.*\)/\L\1/') + [[ "$DISTRO_NAME" = "" ]] && DISTRO_NAME=$(lsb_release -cs | sed -e 's/\(.*\)/\L\1/') + [[ "$ARCHITECTURE" = "" ]] && ARCHITECTURE=$(dpkg --print-architecture) + REPO_DIR="$TDE_DIR/$CFG_GIT_DIR" REPO_TDE="$TDE_DIR/$CFG_GIT_DIR/tde" REPO_TDE_MAIN="$REPO_TDE/main" @@ -111,6 +117,7 @@ function init_common() # -- 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. DISTRO_FOUND="n" + OLD_IFS=$IFS && IFS=$' \t' while read l_distro l_version l_name l_rel_suffix l_packaging_path; do if [ "$l_distro" = "$DISTRO" -a "$l_name" = "$DISTRO_NAME" ]; then DISTRO_FOUND="y" @@ -124,6 +131,7 @@ function init_common() break fi done <<< $(cat $DISTS_FILE | grep -E "^(\s*[^#\s]+\s+[^\s]+.*)$") + IFS=$OLD_IFS if [ "$DISTRO_FOUND" != "y" ]; then echo -e "${CLightRed} --- ERROR ---${CNone}" echo -e "The specified distribution (${CYellow}$DISTRO $DISTRO_NAME${CNone}) is not supported." diff --git a/debian/_buildscripts/local/internals/_config_template.sh b/debian/_buildscripts/local/internals/_config_template.sh index 00d25e315..232d99799 100644 --- a/debian/_buildscripts/local/internals/_config_template.sh +++ b/debian/_buildscripts/local/internals/_config_template.sh @@ -14,9 +14,9 @@ DEFAULT_REPO_BRANCH="master" # After update in completed, switch repo to th # Build information #---------------------------- TDE_RELEASE="14.1.0" # TDE release number -DISTRO="debian" # Distro family -DISTRO_NAME="buster" # Distro name of specific version -ARCHITECTURE="amd64" # Build for this architecture +DISTRO="" # Distro family (leave empty for auto-detection). For ex. debian +DISTRO_NAME="" # Distro name of specific version (leave empty for auto-detection). For ex. buster +ARCHITECTURE="" # Build for this architecture (leave empty for auto-detection). For ex. amd64 USE_PREBUILD_EXTRA_DEPS="y" # If == "y", use pre-built extra dependency packages BUILD_DEFAULT_OPTIONS="-g -lr" # Default building options (pbuilder) GPG_SIGN_KEYID="" # Use this GPG key to sign packages. If null, packages will not be signed diff --git a/debian/_buildscripts/local/internals/_pbuilder.sh b/debian/_buildscripts/local/internals/_pbuilder.sh index 931fba56f..d2b176ded 100755 --- a/debian/_buildscripts/local/internals/_pbuilder.sh +++ b/debian/_buildscripts/local/internals/_pbuilder.sh @@ -47,7 +47,8 @@ END_D05_01 # Get building branch from .tdescmrevision file if [[ -f "$MOD_BUILD_PATH/.tdescmrevision" ]]; then BUILD_BRANCH=`sed -r "s/([^-]+)-.*/\1/" "$MOD_BUILD_PATH/.tdescmrevision"` - while read l_branch l_repo l_component; do + OLD_IFS=$IFS && IFS=$' \t' + while read l_branch l_repo l_component; do if [ "$l_branch" = "$BUILD_BRANCH" ]; then cat <<END_D05_02 >> "$PBUILDER_DEPS_HOOK" echo "deb [trusted=yes] $l_repo $DISTRO_NAME $l_component" >> /etc/apt/sources.list @@ -55,6 +56,7 @@ END_D05_02 break fi done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$") + IFS=$OLD_IFS fi fi cat <<END_D05_03 >> "$PBUILDER_DEPS_HOOK" diff --git a/debian/_buildscripts/local/internals/distro_list.txt b/debian/_buildscripts/local/internals/distro_list.txt index 9d2707e7b..3d6eb05ef 100644 --- a/debian/_buildscripts/local/internals/distro_list.txt +++ b/debian/_buildscripts/local/internals/distro_list.txt @@ -11,8 +11,7 @@ # DISTROS=" # -- debian -- - debian 5.0 lenny '' '' - debian 6.0 squeeze '' '' + debian 6.0 squeeze '' '' debian 7.0 wheezy '' '' debian 8.0 jessie '' '' debian 9.0 stretch '' '' @@ -28,8 +27,7 @@ DISTROS=" raspbian 8.0 raspbian-jessie '' '' raspbian 9.0 raspbian-stretch '' '' # -- ubuntu -- - ubuntu 10.04 lucid '' '' - ubuntu 10.10 maverick '' '' + ubuntu 10.10 maverick '' '' ubuntu 11.04 natty '' '' ubuntu 11.10 oneiric '' '' ubuntu 12.04 precise '' '' |