#990824 debian/rules: Filter packages and platforms without build profiles

Package:
src:u-boot
Source:
u-boot
Submitter:
Nicolas Boulenguez
Date:
2025-01-02 17:27:03 UTC
Severity:
wishlist
Tags:
#990824#5
Date:
2021-07-08 15:34:14 UTC
From:
To:
Hi.
This idea has been discussed since #979296, but the initial
implementation was incompatible with the way dpkg-buildpackage breaks
the command line given by its rules-file option.

#990824#10
Date:
2021-09-09 03:09:53 UTC
From:
To:
Control: merge 990824 992082
#990824#19
Date:
2024-02-29 21:25:32 UTC
From:
To:
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))))

#990824#24
Date:
2025-01-01 14:45:25 UTC
From:
To:
Hello.
The interest of this suggestion seems less and less obvious.
I think it is time to close the related bug.