Package: systemd
Version: 231-5
Severity: wishlist

Hello,

I'm looking to modify debian/rules and I've noticed that some common
variables are re-invented, instead using things that are provided by a
standard/typical dpkg include.

Please consider applying below patch to use common variables.

>From 946748868d3db7ec6ba3611c05de4d6cd8f2ff51 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <[email protected]>
Date: Fri, 9 Sep 2016 11:30:31 +0100
Subject: [PATCH] Use idiomatic variables from dpkg include.

---
 debian/rules           | 23 +++++++++++------------
 debian/shlibs.local.in |  2 +-
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/debian/rules b/debian/rules
index 57a85f8..b928693 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,10 +3,9 @@
 #export DH_VERBOSE = 1
 #export DEB_BUILD_OPTIONS = nostrip
 
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-UPSTREAM_VERSION = $(shell dpkg-parsechangelog -SVersion | sed 's/[+-].*$$//')
+include /usr/share/dpkg/default.mk
 
-ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
+ifeq ($(DEB_VENDOR),Ubuntu)
     DEFAULT_NTP_SERVERS = ntp.ubuntu.com
     BREAKS_USB_MODESWITCH =
     SUPPORT_URL = http://www.ubuntu.com/support
@@ -300,14 +299,14 @@ endif
 	fi
 
 	# Ubuntu specific files
-	if dpkg-vendor --is ubuntu; then \
-		install -D --mode=644 debian/extra/udev.py debian/udev/usr/share/apport/package-hooks/udev.py; \
-		install -D --mode=644 debian/extra/systemd.py debian/systemd/usr/share/apport/package-hooks/systemd.py; \
-		install --mode=644 debian/extra/rules-ubuntu/*.rules debian/udev/lib/udev/rules.d/; \
-		cp -a debian/extra/units-ubuntu/* debian/systemd/lib/systemd/system/; \
-		install --mode=755 debian/extra/set-cpufreq debian/systemd/lib/systemd/; \
-		ln -s ../ondemand.service debian/systemd/lib/systemd/system/multi-user.target.wants/ondemand.service; \
-	fi
+ifeq ($(DEB_VENDOR),Ubuntu)
+	install -D --mode=644 debian/extra/udev.py debian/udev/usr/share/apport/package-hooks/udev.py
+	install -D --mode=644 debian/extra/systemd.py debian/systemd/usr/share/apport/package-hooks/systemd.py
+	install --mode=644 debian/extra/rules-ubuntu/*.rules debian/udev/lib/udev/rules.d/
+	cp -a debian/extra/units-ubuntu/* debian/systemd/lib/systemd/system/
+	install --mode=755 debian/extra/set-cpufreq debian/systemd/lib/systemd/
+	ln -s ../ondemand.service debian/systemd/lib/systemd/system/multi-user.target.wants/ondemand.service
+endif
 
 ifeq ($(TEST_UPSTREAM),)
 ifeq (, $(filter nocheck, $(DEB_BUILD_OPTIONS)))
@@ -338,7 +337,7 @@ override_dh_shlibdeps:
 	dh_shlibdeps --remaining-packages -Lsystemd
 
 override_dh_makeshlibs:
-	sed 's/UPSTREAM_VERSION/$(UPSTREAM_VERSION)/' debian/shlibs.local.in > debian/shlibs.local
+	sed 's/DEB_VERSION_UPSTREAM/$(DEB_VERSION_UPSTREAM)/' debian/shlibs.local.in > debian/shlibs.local
 	dh_makeshlibs -plibudev1 --add-udeb=libudev1-udeb -- -c$(GENSYMBOLS_LEVEL)
 	dh_makeshlibs -psystemd -Xlibsystemd-shared -- -c$(GENSYMBOLS_LEVEL)
 	dh_makeshlibs --remaining-packages -- -c$(GENSYMBOLS_LEVEL)
diff --git a/debian/shlibs.local.in b/debian/shlibs.local.in
index a2db6eb..6dd2a84 100644
--- a/debian/shlibs.local.in
+++ b/debian/shlibs.local.in
@@ -1,3 +1,3 @@
 udeb: libudev 1 libudev1-udeb
 libsystemd 0 libsystemd0 (= ${binary:Version})
-libsystemd-shared UPSTREAM_VERSION systemd (= ${binary:Version})
+libsystemd-shared DEB_VERSION_UPSTREAM systemd (= ${binary:Version})
-- 
2.7.4

Regards,

Dimitri.

Reply via email to