[Unstable][PATCH] UBUNTU: [Packaging] Introduce do_sources_list build flag

Juerg Haefliger juerg.haefliger at canonical.com
Wed Apr 23 07:05:09 UTC 2025


Introduce a flag to control the collection of source files used for
the build. The default is to enable it except for mainline builds
and for linux-unstable. The default can be overriden via the rules
files in debian.<variant>/rules.d/.

Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
 debian/rules                    | 1 +
 debian/rules.d/0-common-vars.mk | 7 +++++++
 debian/rules.d/1-maintainer.mk  | 1 +
 debian/rules.d/2-binary-arch.mk | 4 ++++
 4 files changed, 13 insertions(+)

diff --git a/debian/rules b/debian/rules
index 3ba65aaf46cc..e03555f2755d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -108,6 +108,7 @@ ifeq ($(do_mainline_build),true)
 	no_dumpfile=1
 $(foreach _m,$(all_dkms_modules),$(eval do_$(_m) = false))
 	do_skip_checks=true
+	do_sources_list = false
 endif
 
 # Disable tools build and packaging if do_tools != true
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index aba0839a71b6..4d383b65962d 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -159,6 +159,13 @@ ifeq ($(DEB_DISTRIBUTION),jammy)
 do_zstd_ko=
 endif
 
+# Generate a list of source files used for the build
+ifeq ($(DEB_SOURCE),linux-unstable)
+	do_sources_list = false
+else
+	do_sources_list = true
+endif
+
 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
 #
 # These 2 environment variables set the -j value of the kernel build. For example,
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 6892f71b7964..8431c65ca1c5 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -71,6 +71,7 @@ printenv:
 	@echo "do_flavour_header_package = $(do_flavour_header_package)"
 	@echo "do_common_headers_indep   = $(do_common_headers_indep)"
 	@echo "do_lib_rust               = $(do_lib_rust)"
+	@echo "do_sources_list           = $(do_sources_list)"
 	@echo "do_tools                  = $(do_tools)"
 	@echo "do_tools_common           = $(do_tools_common)"
 	@echo "do_any_tools              = $(do_any_tools)"
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 23377515edda..e798a23e51c4 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -71,10 +71,14 @@ endif
 
 	# Collect the list of kernel source files used for this build. Need to do this early
 	# before modules are stripped. Fail if the resulting file is empty.
+ifeq ($(do_sources_list),true)
 	find $(build_dir) \( -name vmlinux -o -name \*.ko \) -exec dwarfdump -i {} \; | \
 		grep -E 'DW_AT_(call|decl)_file' | sed -n 's|.*\s/|/|p' | sort -u > \
 		$(build_dir)/sources.list
 	test -s $(build_dir)/sources.list
+else
+	true > $(build_dir)/sources.list
+endif
 
 	$(stamp)
 
-- 
2.43.0




More information about the kernel-team mailing list