[SRU][H][PATCH 2/2] UBUNTU: [Packaging] Disable udebs if $DEBIAN/d-i doesn't exist

Juerg Haefliger juerg.haefliger at canonical.com
Thu Mar 4 09:55:16 UTC 2021


Commit ("UBUNTU: [Packaging] replace custom filter script with dctrl-tools")
introduced the use of grep-dctrl which fails for a kernel that doesn't
build any udebs at all:

$ ./debian/rules clean
<snip>
echo >> debian/control
export KW_DEFCONFIG_DIR=debian.raspi/d-i && \
export KW_CONFIG_DIR=debian.raspi/d-i && \
LANG=C kernel-wedge gen-control 5.11.0-1002 | \
    grep-dctrl -FArchitecture amd64 \
    >><snip>/ubuntu/hirsute/linux-raspi/debian/control
make: *** [debian/rules:229: debian/control] Error 1
Script failed

Because d-i/kernel-versions is empty in this case. With the previous commit
it is now possible to remove the d-i directory tree in kernels that don't
need/want udebs and use that as a global check to set disable_d_i=true.

While at it, add disable_d_i to the list of variables that printenv prints
out.

Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
 debian/rules                   | 5 +++++
 debian/rules.d/1-maintainer.mk | 1 +
 2 files changed, 6 insertions(+)

diff --git a/debian/rules b/debian/rules
index f66052e74a1f..1d53ecc1df7f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -43,6 +43,11 @@ ifneq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
 disable_d_i=true
 endif
 
+# Don't build udebs if $(DEBIAN)/d-i/ doesn't exist
+ifeq ($(wildcard $(DEBIAN)/d-i/.),)
+	disable_d_i=true
+endif
+
 # Don't build tools or udebs in a cross compile environment.
 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
 	do_tools=false
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 956829027e0f..b7a92591c155 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -108,6 +108,7 @@ printenv:
 	@echo "DEB_BUILD_ARCH            = $(DEB_BUILD_ARCH)"
 	@echo "arch                      = $(arch)"
 	@echo "kmake                     = $(kmake)"
+	@echo "disable_d_i               = $(disable_d_i)"
 
 printchanges:
 	@baseCommit=$$(git log --pretty=format:'%H %s' | \
-- 
2.27.0




More information about the kernel-team mailing list