]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
UBUNTU: [Packaging] Simplify debian/scripts/module-check
authorJuerg Haefliger <juerg.haefliger@canonical.com>
Thu, 8 Dec 2022 07:17:26 +0000 (08:17 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Thu, 9 Mar 2023 14:58:11 +0000 (15:58 +0100)
Split the reading of the old modules and the checking of missing/new
modules into two separate blocks. This makes the code simpler and
easier to understand and also aligns it with similar code in the new
abi-check script.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
debian/scripts/module-check

index e33a4f0e1c031faac99c063b7f9efa71bf0b2a3b..5c1f341d531325d09599a092038ca67f426e0775 100755 (executable)
@@ -58,11 +58,11 @@ for f in (curr_modules, curr_modules + '.builtin'):
     with open(f) as fh:
         for mod in fh:
             mod = mod.strip()
-            modules[mod] = 1
+            modules[mod] = {'new': 1}
             new_count += 1
 print('read {} modules.'.format(new_count))
 
-# Now the old modules, checking for missing ones
+# Now the old modules
 print('   reading old modules...', end='')
 old_count = 0
 for f in (prev_modules, prev_modules + '.builtin'):
@@ -72,24 +72,28 @@ for f in (prev_modules, prev_modules + '.builtin'):
         for mod in fh:
             mod = mod.strip()
             if mod not in modules:
-                if not missing:
-                    print()
-                missing += 1
-                if mod not in modules_ignore:
-                    print('      MISS: {}'.format(mod))
-                    errors += 1
-                else:
-                    print('      MISS: {} (ignored)'.format(mod))
-            else:
-                modules[mod] += 1
+                modules[mod] = {}
+            modules[mod]['old'] = 1
             old_count += 1
-# Check for new modules
-for mod, cnt in modules.items():
-    if cnt < 2:
-        if not missing and not new:
-            print()
-        print('      NEW: {}'.format(mod))
+print('read {} modules.'.format(old_count))
+
+print('II: Checking for modules changes...')
+for mod, vals in modules.items():
+    # New modules
+    if 'old' not in vals:
+        print('    NEW: {}'.format(mod))
         new += 1
+
+    # Missing modules
+    if 'new' not in vals:
+        missing += 0
+        if mod in modules_ignore:
+            ignored = ' (ignored)'
+        else:
+            ignored = ''
+            errors += 1
+        print('    MISS : {}{}'.format(mod, ignored))
+
 if new or missing:
     print('      read {} modules : new({})  missing({})'.format(old_count, new, missing))
 else: