[PATCH 2/3] package: debian: add missing Depends to linux-headers

From: Thomas Böhler
Date: Thu Oct 31 2024 - 09:26:58 EST


The linux-headers package is missing a dependency to libc. Lintian
complains about this as well:

W: linux-headers-6.12.0-rc4-g7e04fcfc6195: undeclared-elf-prerequisites (libc.so.6) [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/asn1_compiler]
W: linux-headers-6.12.0-rc4-g7e04fcfc6195: undeclared-elf-prerequisites (libc.so.6) [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/basic/fixdep]
W: linux-headers-6.12.0-rc4-g7e04fcfc6195: undeclared-elf-prerequisites (libc.so.6) [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/kallsyms]
W: linux-headers-6.12.0-rc4-g7e04fcfc6195: undeclared-elf-prerequisites (libc.so.6) [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/mod/modpost]
W: linux-headers-6.12.0-rc4-g7e04fcfc6195: undeclared-elf-prerequisites (libc.so.6) [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/sorttable]

Fix this by introducing "dh_shlibdeps" into the build process. It
calculates shared library dependencies for packages and creates a
substvar entry for them, making them usable in "debian/control" by
specifying "${shlibs:Depends}" in the "Depends" field.

"dh_shlibdeps" detects the dependency on libc for the linux-headers
package and by specifying the substvar for the linux-headers package in
"debian/control" this dependency is correctly declared and lintian won't
complain about it anymore.

Signed-off-by: Thomas Böhler <t.boehler@xxxxxxxxxx>
---
scripts/package/debian/rules | 1 +
scripts/package/mkdebian | 1 +
2 files changed, 2 insertions(+)

diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
index 0c75319acae1..2a51564128ff 100755
--- a/scripts/package/debian/rules
+++ b/scripts/package/debian/rules
@@ -52,6 +52,7 @@ define binary
$(Q)dh_installchangelogs $(DH_OPTIONS)
$(Q)dh_compress $(DH_OPTIONS)
$(Q)dh_fixperms $(DH_OPTIONS)
+ $(Q)dh_shlibdeps $(DH_OPTIONS)
$(Q)dh_gencontrol $(DH_OPTIONS) -- -f$(call mk-files,$@)
$(Q)dh_md5sums $(DH_OPTIONS)
$(Q)dh_builddeb $(DH_OPTIONS) -- $(addprefix -Z,$(KDEB_COMPRESS))
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 10637d403777..5d96cb0d0bf8 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -224,6 +224,7 @@ cat <<EOF >> debian/control

Package: linux-headers-$version
Architecture: $debarch
+Depends: \${shlibs:Depends}
Description: Linux kernel headers for $version on $debarch
This package provides kernel header files for $version on $debarch
.
--
2.39.2