Hello.
This version is (trivially) rebased on a609e1d2.
From 39ea68aadb043a3f38143bb41ad929cbeb11b5c9 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nicolas@debian.org>
Date: Thu, 8 Jul 2021 17:11:19 +0200
Subject: debian/rules: Filter packages and platforms without build profiles
This idea has been discussed since #979296, but the initial
implementation was incompatible with dpkg-buildpackage.
All three variants should now work:
debian/rules package_filter=u-boot/%rockchip/%sunxi platform_filter=%-rk3399/a64-olinuxino%
dpkg-buildpackage '--rules-file=debian/rules package_filter=...'
sbuild '--debbuildopt=--rules-file=debian/rules package_filter=...'
diff --git a/debian/rules b/debian/rules
index fc7c8e54d4..f1ac900bb9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -34,22 +34,20 @@ notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
subarchs := $(shell dh_listpackages --arch --no-package=u-boot-tools)
-# Each .deb P in subarch contains $(P_platforms).
-# These profiles remove values from $(P_platforms) for debugging.
-
-# DEB_BUILD_PROFILES='pkg.uboot.subarch.P1 pkg.uboot.subarch.P2'
-# removes all platforms but in packages u-boot-P1 u-boot-P2.
-only_subarchs := $(patsubst pkg.uboot.subarch.%,u-boot-%,\
- $(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
+# For debugging purposes, some filters may restrict the actually built
+# platforms. The expected contents are Make patterns (with at most
+# one % wildcard), separated by / (because spaces are difficult to
+# escape from dpkg-buildpackage --rules-file).
+# package_filter=u-boot/%amlogic/%mvebu
+# platform_filter=khadas-vim%
+
+only_subarchs := $(subst /, ,$(package_filter))
ifneq (,$(only_subarchs))
$(foreach pkg,$(filter-out $(only_subarchs),$(subarchs)),$(eval \
$(pkg)_platforms :=))
endif
-# DEB_BUILD_PROFILES='pkg.uboot.platform.P1 pkg.uboot.platform.P2'
-# removes all platforms but P1 P2.
-only_platforms := $(patsubst pkg.uboot.platform.%,%,\
- $(filter pkg.uboot.platform.%,$(DEB_BUILD_PROFILES)))
+only_platforms := $(subst /, ,$(platform_filter))
ifneq (,$(only_platforms))
$(foreach pkg,$(subarchs),$(eval \
$(pkg)_platforms := $(filter $(only_platforms),$($(pkg)_platforms))))