From 39772a761dfdf810cc23a1ec6084ea3100e6abf0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 11 Jan 2023 12:17:15 +0100 Subject: [PATCH] deb: move packaging revision before distro information Commit f8299f20216a4e2def617f7d3605eab1d68132ee introduced the `$pkgRevision` in the package version, but we now actually had two separate escape hatches for when we needed to do a packaging-only update; one before the packaging version, and one after the distro-ID (VERSION_ID). The latter one was confusing, as it appeared to be part of the distro-version (e.g. `22.04.0`). This patch removes the additional version, and moves it to the start, and updates the default to use "1", which aligns with the "_release" used for RPM packages, and may help with warnings that the package version is not an "upstream" (debian) version. Comparing same version old vs new (works because we now use 1 as default): dpkg --compare-versions "23.0.0~rc.1-1~ubuntu.22.04~jammy" ">>" "23.0.0~rc.1-0~ubuntu.22.04.0~jammy" && echo "OK" || echo "KO" OK Comparing newer version (new format) vs older version (old format) is ok: dpkg --compare-versions "23.0.0~rc.2-1~ubuntu.22.04~jammy" ">>" "23.0.0~rc.1-0~ubuntu.22.04.0~jammy" && echo "OK" || echo "KO" OK Comparing same version, but newer $pkgRevision (either new format <-> old-format, or new-format <-> new-format) is also ok: dpkg --compare-versions "23.0.0~rc.1-2~ubuntu.22.04~jammy" ">>" "23.0.0~rc.1-1~ubuntu.22.04~jammy" && echo "OK" || echo "KO" OK dpkg --compare-versions "23.0.0~rc.1-2~ubuntu.22.04~jammy" ">>" "23.0.0~rc.1-1~ubuntu.22.04.0~jammy" && echo "OK" || echo "KO" OK Signed-off-by: Sebastiaan van Stijn --- deb/build-deb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deb/build-deb b/deb/build-deb index 77ece7b68a..91d1f8a902 100755 --- a/deb/build-deb +++ b/deb/build-deb @@ -43,9 +43,9 @@ debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)" debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)" debDate="$(date --rfc-2822)" -# Include an extra `.0` in the version, in case we ever would have to re-build an +# Include an extra `1` in the version, in case we ever would have to re-build an # already published release with a packaging-only change. -pkgRevision=0 +pkgRevision=1 # Generate changelog. The version/name of the generated packages are based on this. # @@ -53,12 +53,13 @@ pkgRevision=0 # # - name of the package (e.g., "docker-ce") # - version (e.g., "23.0.0~beta.0") -# - "-0" (mostly "best practice", and allows updating for specific situations) +# - pkgRevision (usually "-0", see above), which allows updating packages with +# packaging-only changes (without a corresponding release of the software +# that's packaged). # - distro (e.g., "ubuntu") # - VERSION_ID (e.g. "22.04" or "11") this must be "sortable" to make sure that # packages are upgraded when upgrading to a newer distro version ("codename" # cannot be used for this, as they're not sorted) -# - pkgRevision (usually "0", see above) # - SUITE ("codename"), e.g. "jammy" or "bullseye". This is mostly for convenience, # because some places refer to distro versions by codename, others by version. # we prefix the codename with a tilde (~), which effectively excludes it from @@ -71,10 +72,10 @@ pkgRevision=0 # # Examples: # -# docker-ce_23.0.0~beta.0-0~debian.11.0~bullseye_amd64.deb -# docker-ce_23.0.0~beta.0-0~ubuntu.22.04.0~jammy_amd64.deb +# docker-ce_23.0.0~beta.0-1~debian.11~bullseye_amd64.deb +# docker-ce_23.0.0~beta.0-1~ubuntu.22.04~jammy_amd64.deb cat > "debian/changelog" <<-EOF -$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}-0~${DISTRO}.${VERSION_ID}.${pkgRevision}~${SUITE}) $SUITE; urgency=low +$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}-${pkgRevision}~${DISTRO}.${VERSION_ID}~${SUITE}) $SUITE; urgency=low * Version: $VERSION -- $debMaintainer $debDate EOF