[3/4] debian: permit compat level 9 dh builds
diff mbox series

Message ID 157784178177.1372453.9672761082907118417.stgit@magnolia
State New
Headers show
Series
  • xfsprogs: packaging cleanups
Related show

Commit Message

Darrick J. Wong Jan. 1, 2020, 1:23 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Retain compatibility with existing dh level 9 build systems.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 debian/rules |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/debian/rules b/debian/rules
index a79db896..1dd1f524 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,7 @@ 
 #!/usr/bin/make -f
 
+.PHONY: dpkg_config
+
 export DH_VERBOSE=1
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -7,6 +9,9 @@  ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     PMAKEFLAGS += -j$(NUMJOBS)
 endif
 
+DH_VERSION := $(shell dpkg-query -W -f '$${Version}' debhelper)
+USE_DH9 ?= $(shell if dpkg --compare-versions $(DH_VERSION) lt 11 ; then echo yes ; fi)
+
 package = xfsprogs
 develop = xfslibs-dev
 bootpkg = xfsprogs-udeb
@@ -33,11 +38,18 @@  checkdir = test -f debian/rules
 build: build-arch build-indep
 build-arch: built
 build-indep: built
-built: dibuild config
+built: dpkg_config dibuild config
 	@echo "== dpkg-buildpackage: build" 1>&2
 	$(MAKE) $(PMAKEFLAGS) default
 	touch built
 
+dpkg_config:
+ifeq ($(USE_DH9),yes)
+	mv debian/compat debian/compat.save
+	echo 9 > debian/compat
+endif
+	@true
+
 config: .census
 .census:
 	@echo "== dpkg-buildpackage: configure" 1>&2
@@ -93,7 +105,9 @@  binary-arch: checkroot built
 	dh_compress
 	dh_fixperms
 	dh_makeshlibs
+ifneq ($(USE_DH9),yes)
 	dh_installsystemd -p xfsprogs --no-enable --no-start --no-restart-after-upgrade --no-stop-on-upgrade
+endif
 	dh_installdeb
 	dh_shlibdeps
 	dh_gencontrol