From 11ffed1e0d76aaec36666133977ea32288f86e65 Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Thu, 8 Dec 2022 08:17:26 +0100 Subject: [PATCH] UBUNTU: [Packaging] Simplify debian/scripts/module-check 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 Signed-off-by: Andrea Righi --- debian/scripts/module-check | 40 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/debian/scripts/module-check b/debian/scripts/module-check index e33a4f0e1c03..5c1f341d5313 100755 --- a/debian/scripts/module-check +++ b/debian/scripts/module-check @@ -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: