Package: galternatives
Version: 1.0.7
Tags: patch

debian/rules compares the version from debian/changelog with the version
reported by the INFO dict. However, this fails if a binnmu is at play:

A binnmu adds a changelog entry with +bX (X being an integer), but
generally speaking, rebuilds might add almost any +<whatever> suffixes.

I suggest to change debian/rules as follows to allow for binnmus:

Add:

BASE_VERSION=$(shell dpkg-parsechangelog \
      sed -rne 's/^Version: ([0-9.]+)(\+.*)?/\1/p')

And compare to that instead of DEB_VERSION_UPSTREAM

This is similar to what is done for DEB_VERSION_UPSTREAM in pkg-info.mk,
but acknowledges the fact that galternatives is a native Debian package and
thus the whole version from the changelog is recognized as the upstream
version.

For 1.2-1+b1, DEB_VERSION_UPSTREAM would have 1.2, as it strips the last -
and everything after it.

Patch attached, this time I'll refrain from submitting anything to salsa...
I caused too much chaos with the previous commits already (I hope I cleaned
it up though).
Index: galternatives-1.0.7/debian/rules
===================================================================
--- galternatives-1.0.7.orig/debian/rules
+++ galternatives-1.0.7/debian/rules
@@ -5,11 +5,15 @@ export PYBUILD_NAME=galternatives
 
 include /usr/share/dpkg/pkg-info.mk
 
+# Cut of any +* suffixes if there are any (from bin-nmus)
+BASE_VERSION=$(shell dpkg-parsechangelog \
+			 | sed -rne 's/^Version: ([0-9.]+)(\+.*)?/\1/p')
+
 
 %:
 	dh $@ --buildsystem=pybuild
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	python3 -c "import galternatives; assert galternatives.INFO['version'] == '$(DEB_VERSION_UPSTREAM)'"
+	python3 -c "import galternatives; assert galternatives.INFO['version'] == '$(BASE_VERSION)'"
 endif

Reply via email to