diff mbox series

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

Message ID 20210304095516.575613-3-juergh@canonical.com
State New
Headers show
Series Fix udeb-less derivatives | expand

Commit Message

Juerg Haefliger March 4, 2021, 9:55 a.m. UTC
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@canonical.com>
---
 debian/rules                   | 5 +++++
 debian/rules.d/1-maintainer.mk | 1 +
 2 files changed, 6 insertions(+)
diff mbox series

Patch

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' | \