[Unstable][PATCH] UBUNTU: [Packaging] Add module versions to the ABI

Juerg Haefliger juerg.haefliger at canonical.com
Tue Apr 13 12:36:38 UTC 2021


Add module versions to the ABI (or '-' if the module doesn't report a
version) and make sure the module check only looks at the module name
and ignores the trailing version.

This info ends up in the buildinfo package which can be used by meta
packages so that they don't have to build-depend on the huge modules
package to determine versions of in-tree DKMS modules.

Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
 debian/rules.d/2-binary-arch.mk | 6 +++++-
 debian/scripts/module-check     | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 5ae9a989207c..c8ca29e7b739 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -461,7 +461,11 @@ endif
 
 	# Build the final ABI modules information.
 	find $(pkgdir_bin) $(pkgdir) $(pkgdir_ex) -name \*.ko | \
-		sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > $(abidir)/$*.modules
+	while read ko; do \
+		basename=$${ko##*/}; \
+		version=$$(/sbin/modinfo -F version "$${ko}" || true); \
+		echo "$${basename%.ko} $${version:--}"; \
+	done | sort > $(abidir)/$*.modules
 
 	# Build the final ABI firmware information.
 	find $(pkgdir_bin) $(pkgdir) $(pkgdir_ex) -name \*.ko | \
diff --git a/debian/scripts/module-check b/debian/scripts/module-check
index c754ea368cfb..4955211affbd 100755
--- a/debian/scripts/module-check
+++ b/debian/scripts/module-check
@@ -42,6 +42,7 @@ if (-f "$prev_abidir/../modules.ignore") {
 	while (<IGNORE>) {
 		chomp;
 		next if /\s*#/;
+		$_ = (split)[0];
 		$modules_ignore{$_} = 1;
 		$ignore++;
 	}
@@ -56,6 +57,7 @@ open(NEW, "< $abidir/$flavour.modules") or
 	die "Could not open $abidir/$flavour.modules";
 while (<NEW>) {
 	chomp;
+	$_ = (split)[0];
 	$modules{$_} = 1;
 	$new_count++;
 }
@@ -69,6 +71,7 @@ open(OLD, "< $prev_abidir/$flavour.modules") or
 	die "Could not open $prev_abidir/$flavour.modules";
 while (<OLD>) {
 	chomp;
+	$_ = (split)[0];
 	if (not defined($modules{$_})) {
 		print "\n" if not $missing;
 		$missing++;
-- 
2.27.0




More information about the kernel-team mailing list