On Sun, 2018-11-25 at 21:03:32 -0500, Jeremy Bicha wrote: > Yes, I would appreciate a less cumbersome way of checking the build > vendor than what we have now. > > One package that makes fairly extensive use of dpkg-vendor is gnome-software: > > https://salsa.debian.org/gnome-team/gnome-software/blob/debian/master/debian/rules#L45
Ok, I went with the versioned symbol option, which seems more fine grained and less cumbersome to maintain than a fully versioned file API (a la cdbs). Here are the patches I've queued. Thanks, Guillem
From 6302cb88ab04df5b8689601f060e90fa338be03f Mon Sep 17 00:00:00 2001 From: Colin Watson <cjwat...@debian.org> Date: Fri, 16 Nov 2018 04:15:13 +0100 Subject: [PATCH 1/2] scripts/mk: Fix dpkg_vendor_derives_from macro documentation Add a missing comma, and $(shell) make function invocation. Closes: #913816 Signed-off-by: Guillem Jover <guil...@debian.org> --- scripts/mk/vendor.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk index aa75cd6fc..fe06828f5 100644 --- a/scripts/mk/vendor.mk +++ b/scripts/mk/vendor.mk @@ -6,7 +6,7 @@ # The snippet also defines a macro "dpkg_vendor_derives_from" that you can # use to verify if the current vendor derives from another vendor with a # simple test like this one: -# ifeq ($(call dpkg_vendor_derives_from ubuntu),yes) +# ifeq ($(shell $(call dpkg_vendor_derives_from,ubuntu)),yes) # ... # endif -- 2.20.0.rc1.387.gf8505762e3
From 7b295e50f70a5e21e3c6ee127c739ac4cc7d0084 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Tue, 27 Nov 2018 04:05:09 +0100 Subject: [PATCH 2/2] scripts/mk: Add support for an improved dpkg_vendor_derives_from macro Version the macros so that both can be used, and default the unversioned one to the version 0 macro. --- scripts/mk/vendor.mk | 38 +++++++++++++++++++++++++++++++------- scripts/t/mk.t | 4 +++- scripts/t/mk/vendor-v0.mk | 6 ++++++ scripts/t/mk/vendor-v1.mk | 6 ++++++ scripts/t/mk/vendor.mk | 1 + 5 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 scripts/t/mk/vendor-v0.mk create mode 100644 scripts/t/mk/vendor-v1.mk diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk index fe06828f5..f3b1565bb 100644 --- a/scripts/mk/vendor.mk +++ b/scripts/mk/vendor.mk @@ -3,16 +3,40 @@ # DEB_VENDOR: output of dpkg-vendor --query Vendor # DEB_PARENT_VENDOR: output of dpkg-vendor --query Parent (can be empty) # -# The snippet also defines a macro "dpkg_vendor_derives_from" that you can -# use to verify if the current vendor derives from another vendor with a -# simple test like this one: -# ifeq ($(shell $(call dpkg_vendor_derives_from,ubuntu)),yes) -# ... -# endif +# This Makefile snippet also defines a set "dpkg_vendor_derives_from" +# macros that can be used to verify if the current vendor derives from +# another vendor. The unversioned variant defaults to the v0 version if +# undefined, which can be defined explicitly to one of the versions or the +# versioned macros can be used directly. The following are example usages: +# +# - dpkg_vendor_derives_from (since dpkg 1.16.1) +# +# ifeq ($(shell $(call dpkg_vendor_derives_from,ubuntu)),yes) +# ... +# endif +# +# - dpkg_vendor_derives_from_v0 (since dpkg 1.19.3) +# +# ifeq ($(shell $(call dpkg_vendor_derives_from_v0,ubuntu)),yes) +# ... +# endif +# +# - dpkg_vendor_derives_from_v1 (since dpkg 1.19.3) +# +# dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v1) +# ifeq ($(call dpkg_vendor_derives_from,ubuntu),yes) +# ... +# endif +# ifeq ($(call dpkg_vendor_derives_from_v1,ubuntu),yes) +# ... +# endif dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1))) DEB_VENDOR = $(call dpkg_late_eval,DEB_VENDOR,dpkg-vendor --query Vendor) DEB_PARENT_VENDOR = $(call dpkg_late_eval,DEB_PARENT_VENDOR,dpkg-vendor --query Parent) -dpkg_vendor_derives_from = dpkg-vendor --derives-from $(1) && echo yes || echo no +dpkg_vendor_derives_from_v0 = dpkg-vendor --derives-from $(1) && echo yes || echo no +dpkg_vendor_derives_from_v1 = $(shell $(dpkg_vendor_derives_from_v0)) + +dpkg_vendor_derives_from ?= $(dpkg_vendor_derives_from_v0) diff --git a/scripts/t/mk.t b/scripts/t/mk.t index 0062e993c..98c7e5083 100644 --- a/scripts/t/mk.t +++ b/scripts/t/mk.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 8; use Test::Dpkg qw(:paths); use File::Spec::Functions qw(rel2abs); @@ -117,5 +117,7 @@ foreach my $tool (keys %buildtools) { test_makefile('pkg-info.mk'); test_makefile('vendor.mk'); +test_makefile('vendor-v0.mk'); +test_makefile('vendor-v1.mk'); 1; diff --git a/scripts/t/mk/vendor-v0.mk b/scripts/t/mk/vendor-v0.mk new file mode 100644 index 000000000..602a8c63a --- /dev/null +++ b/scripts/t/mk/vendor-v0.mk @@ -0,0 +1,6 @@ +dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v0) + +include $(srcdir)/mk/vendor.mk + +test: + test "$(shell $(call dpkg_vendor_derives_from,debian))" = "yes" diff --git a/scripts/t/mk/vendor-v1.mk b/scripts/t/mk/vendor-v1.mk new file mode 100644 index 000000000..11c1314ef --- /dev/null +++ b/scripts/t/mk/vendor-v1.mk @@ -0,0 +1,6 @@ +include $(srcdir)/mk/vendor.mk + +dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v1) + +test: + test "$(call dpkg_vendor_derives_from,debian)" = "yes" diff --git a/scripts/t/mk/vendor.mk b/scripts/t/mk/vendor.mk index 371b39c87..4e0d9ff89 100644 --- a/scripts/t/mk/vendor.mk +++ b/scripts/t/mk/vendor.mk @@ -3,3 +3,4 @@ include $(srcdir)/mk/vendor.mk test: test "$(DEB_VENDOR)" = "Debian" test "$(DEB_PARENT_VENDOR)" = "" + test "$(shell $(call dpkg_vendor_derives_from,debian))" = "yes" -- 2.20.0.rc1.387.gf8505762e3