[Cryptech-Commits] [releng/alpha] branch master updated: Packaging voodoo to support same code version on multiple releases.

git at cryptech.is git at cryptech.is
Sun Jun 17 06:43:34 UTC 2018


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository releng/alpha.

The following commit(s) were added to refs/heads/master by this push:
     new 38b9045  Packaging voodoo to support same code version on multiple releases.
38b9045 is described below

commit 38b90453bc26e73b827104219f1cfd014ea5f6ca
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun Jun 17 02:34:29 2018 -0400

    Packaging voodoo to support same code version on multiple releases.
    
    reprepro strictly follows the Debian package rule that two package
    files which have the same name must have identical content.  Which is
    fine, except when we want to support the same version of a package on
    multiple releases of the same Debian-flavored operating system.
    
    The usual hack for this is to add a release-specific tag to the end of
    the version string.  The brute force way of doing this requires
    modifying the source package for each release, but there's an obscure
    hack which lets us augment the binary package versions directly.
---
 Makefile            | 15 ++++++++++++---
 source/debian/rules | 17 +++++++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 131df63..ccc61fd 100644
--- a/Makefile
+++ b/Makefile
@@ -102,6 +102,12 @@ ${TAMPER}: tamper
 tamper:
 	${MAKE} -C $(dir ${TAMPER})
 
+# For extra credit, figure out how to put the right path names into
+# the initial source tarball so we don't need to mess with it in the loop.
+#
+# For more extra credit, figure out how to do the pbuilder stuff as
+# GNU make $(eval) rules rather than as a shell for loop.  Maybe.
+
 dsc:
 	rm -f source/debian/changelog ${PACKAGE_NAME}_*.dsc ${PACKAGE_NAME}_*.tar.xz ${PACKAGE_NAME}_*_source.build ${PACKAGE_NAME}_*_source.changes
 	cd source; ../scripts/build-debian-control-files.py --debemail='${GPG_USER}' --package='${PACKAGE_NAME}' --newversion='${PACKAGE_VERSION}' --conflicts='${PACKAGE_CONFLICT}'
@@ -110,14 +116,17 @@ dsc:
 pbuilder:
 	rm -f ${PBUILDER_BASE}/*result/*
 	touch -d 'last week' .pbuilder-sell-by-date
-	umask ${REPO_UMASK}; \
+	set -x; umask ${REPO_UMASK}; \
 	for target in ${PBUILDER_TARGETS}; do echo $$target | tr '/' ' '; done | \
 	while read dist code arch; do \
-		reprepro -b ${REPO_BASE}/apt/$$dist -A $$arch list $$code ${PACKAGE_NAME} | awk '{v = $$3} END {exit v != "${PACKAGE_VERSION}"}' && continue; \
+		reprepro -b ${REPO_BASE}/apt/$$dist -A $$arch list $$code ${PACKAGE_NAME} | awk -v "c=$$code" '{v = $$3} END {exit v != "${PACKAGE_VERSION}~" c}' && continue; \
 		if test $${HOME}/pbuilder/$${code}-$${arch}-base.tgz -ot .pbuilder-sell-by-date; then pbuilder-dist $$code $$arch update; else true; fi; \
 		pbuilder-dist $$code $$arch build ${PACKAGE_NAME}_${PACKAGE_VERSION}.dsc; \
+		test -f ${REPO_BASE}/brew/tarballs/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz || \
 		cp -p ${PBUILDER_BASE}/$${code}-$${arch}_result/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz ${REPO_BASE}/brew/tarballs/; \
-		reprepro -b ${REPO_BASE}/apt/$$dist include $$code ${PBUILDER_BASE}/$${code}-$${arch}_result/${PACKAGE_NAME}_${PACKAGE_VERSION}_$${arch}.changes; \
+		reprepro -b ${REPO_BASE}/apt/$$dist -T dsc list $$code ${PACKAGE_NAME} | awk '{v = $$3} END {exit v != "${PACKAGE_VERSION}"}' || \
+		reprepro -b ${REPO_BASE}/apt/$$dist includedsc $$code ${PBUILDER_BASE}/$${code}-$${arch}_result/${PACKAGE_NAME}_${PACKAGE_VERSION}.dsc; \
+		reprepro -b ${REPO_BASE}/apt/$$dist includedeb $$code ${PBUILDER_BASE}/$${code}-$${arch}_result/${PACKAGE_NAME}_${PACKAGE_VERSION}~$${code}_$${arch}.deb; \
 	done
 
 homebrew:
diff --git a/source/debian/rules b/source/debian/rules
index 88d6c5a..a0c3a65 100755
--- a/source/debian/rules
+++ b/source/debian/rules
@@ -16,6 +16,23 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/default.mk
+include /usr/share/dpkg/pkg-info.mk
 
 %:
 	dh $@ --with python2
+
+# Distinct binary package versions for a single source package built
+# on multiple releases, to keep reprepro happy.  See:
+#
+#   https://unix.stackexchange.com/questions/31584/two-differently-versioned-binary-debian-packages-from-one-source#32377
+#   https://salsa.debian.org/android-tools-team/android-sdk-meta/blob/master/debian/rules
+#
+# This relies on pbuilder-dist setting the DIST environment variable.
+# Without that, we fall back to the default behavior.
+
+ifneq (,${DIST})
+
+override_dh_gencontrol:
+	dh_gencontrol -- -v${DEB_VERSION}~${DIST}
+
+endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list