From b9992a54faffe763946fc1ca9276ee65149c5b46 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Fri, 1 Jul 2016 07:46:02 +0200 Subject: bin/sbuild-deb-package: change package versioning to mitigate errors during dist-upgrades. The local version now contains a numerical version of the code name instead of a string, which is lexicographically compared and will wrap around at some point for Ubuntu, or just be plain random between releases for Debian. Descriptions have been updated to include a capitalized distro name and also the numerical version in addition to the code name. In order to make the transition work, ALL packages (releases and nightlies) must be revbumped. For nightlies, one commit to each repo is enough to generate a new git date and commit number, while release packages need a proper revision or version bump. Merely rebuilding with the old version is not enough, as the new packages will be seen as older than the old ones. --- bin/sbuild-deb-package | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/bin/sbuild-deb-package b/bin/sbuild-deb-package index a0c714e..6519c4b 100755 --- a/bin/sbuild-deb-package +++ b/bin/sbuild-deb-package @@ -233,13 +233,34 @@ build_packages() { } # for Ubuntu version is the codename of the distribution release - VERSION="${l_CODENAME}" + typeset -l codename="${l_CODENAME}" # translate the version name for Debian releases - [ "x${l_CODENAME}" = "xsid" ] && VERSION="unstable" - #[ "x$l_CODENAME" = "xjessie" ] && VERSION=testing - #[ "x$l_CODENAME" = "xwheezy" ] && VERSION=stable - #[ "x$l_CODENAME" = "xoldstable" ] && VERSION=oldstable + [ "x${l_CODENAME}" = "xsid" ] && codename="unstable" + #[ "x$l_CODENAME" = "xjessie" ] && codename=testing + #[ "x$l_CODENAME" = "xwheezy" ] && codename=stable + #[ "x$l_CODENAME" = "xoldstable" ] && codename=oldstable + + typeset -l numerical_version="" + typeset -l -i tmp_ret="1" + typeset -l pretty_dist="" + + if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ]; then + pretty_dist="Debian" + numerical_version="$("${script_path}/debian-codename-to-version.sh" "${codename}")" + tmp_ret="${?}" + fi + + if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "ubuntu" ]; then + pretty_dist="Ubuntu" + numerical_version="$("${script_path}/ubuntu-codename-to-version.sh" "${codename}")" + tmp_ret="${?}" + fi + + if [ "${tmp_ret}" -ne "0" ]; then + echo "Error: unable to map code name \"${codename}\" to Debian or Ubuntu numerical versions. Unknown code name or not applicable to distribution \"${dist_pretty}\"? Aborting." >&2 + exit 1 + fi # modify the section for non-main package builds [ "x${COMPONENT}" != "xmain" ] && { @@ -249,9 +270,9 @@ build_packages() { # modify changelog for this build if [ "${COMPONENT}" != "${COMPONENT_NIGHTLY}" ]; then - dch --distribution "${VERSION}" --force-distribution -l "+git${DATE}.${GITREV}+${l_CODENAME}.${COMPONENT}." "Auto-built ${l_DIST} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})." + dch --distribution "${codename}" --force-distribution -l "+git${DATE}.${GITREV}+${numerical_version}.${COMPONENT}." "Auto-built ${pretty_dist} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})." else - dch --distribution "${VERSION}" --force-distribution -l "~git${DATE}.${GITREV}+${l_CODENAME}.${COMPONENT}." "Development-Snapshot!!! Auto-built ${l_DIST} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})." + dch --distribution "${codename}" --force-distribution -l "~git${DATE}.${GITREV}+${numerical_version}.${COMPONENT}." "Development-Snapshot!!! Auto-built ${pretty_dist} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})." fi mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/"{amd64,i386} OTHERMIRROR="" @@ -268,7 +289,7 @@ build_packages() { cd .. DSCFILE="$(pwd)/$(ls -1 "${PROJECT}_"*.dsc | head -n1)" - SBUILD_OPTIONS="-n -j2 -sAd ${VERSION} -k ${GPG_KEY} --build-dep-resolver=aptitude" + SBUILD_OPTIONS="-n -j2 -sAd ${codename} -k ${GPG_KEY} --build-dep-resolver=aptitude" SBUILD_OPTIONS_64="${SBUILD_OPTIONS} -c arctica-${l_CODENAME}" SBUILD_OPTIONS_32="${SBUILD_OPTIONS} -c arctica-${l_CODENAME}-i386 --arch=i386 --debbuildopts=-B" if [ -n "${SA_OPTION}" ]; then -- cgit v1.2.3