diff mbox series

[Unstable,v2,3/5] UBUNTU: [Packaging] module-check: Handle current/new ABI modules directory

Message ID 20210610080807.25518-4-juergh@canonical.com
State New
Headers show
Series Use modinfo data for the ABI | expand

Commit Message

Juerg Haefliger June 10, 2021, 8:08 a.m. UTC
The previous commits converted the ABI from a single modules file to a
directory containing per-module files. Handle that for the current/new
ABI.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 debian/scripts/module-check | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/debian/scripts/module-check b/debian/scripts/module-check
index c754ea368cfb..2e31045f834f 100755
--- a/debian/scripts/module-check
+++ b/debian/scripts/module-check
@@ -13,9 +13,9 @@  if (-f "$prev_abidir/ignore.modules"
 	exit(0);
 }
 
-if (not -f "$abidir/$flavour.modules" or not -f
+if (not -d "$abidir/$flavour.modules" or not -f
     "$prev_abidir/$flavour.modules") {
-	print "previous or current modules file missing!\n";
+	print "previous or current modules file/directory missing!\n";
 	print "   $abidir/$flavour.modules\n";
 	print "   $prev_abidir/$flavour.modules\n";
 	if (defined($skipmodule)) {
@@ -52,10 +52,11 @@  if (-f "$prev_abidir/../modules.ignore") {
 # Read new modules first
 print "   reading new modules...";
 $new_count = 0;
-open(NEW, "< $abidir/$flavour.modules") or
-	die "Could not open $abidir/$flavour.modules";
-while (<NEW>) {
+opendir(NEW, "$abidir/$flavour.modules") or
+	die "Could not open directory $abidir/$flavour.modules";
+while (readdir NEW) {
 	chomp;
+	next if /^\./;  # Ignore '.' and '..'
 	$modules{$_} = 1;
 	$new_count++;
 }