diff mbox series

[jammy/master-next,1/1] UBUNTU: [Packaging] Remove in-tree abi checks

Message ID 20240301140906.3634335-4-apw@canonical.com
State New
Headers show
Series [jammy/master-next,1/1] UBUNTU: [Packaging] Remove in-tree abi checks | expand

Commit Message

Andy Whitcroft March 1, 2024, 2:09 p.m. UTC
linux-buildinfo packages are now externally compared by swm, with
results approving or rejecting updates based on the stable
tracker. Those checks also allow hints and overrides to accept
intentional changes.

Also these are done on the correct pair-wise comparisons, especially
when two streams are being cranked.

The above eliminates the need to identify previous build abi,
download, extract it, vendor it in, and assert it at build time.

BugLink: https://bugs.launchpad.net/bugs/2055686
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules                    |   8 +-
 debian/rules.d/0-common-vars.mk |   1 -
 debian/rules.d/4-checks.mk      |  20 +--
 debian/scripts/abi-check        | 210 --------------------------------
 debian/scripts/module-check     | 113 -----------------
 debian/scripts/retpoline-check  |  47 -------
 6 files changed, 2 insertions(+), 397 deletions(-)
 delete mode 100755 debian/scripts/abi-check
 delete mode 100755 debian/scripts/module-check
 delete mode 100755 debian/scripts/retpoline-check
diff mbox series

Patch

diff --git a/debian/rules b/debian/rules
index 85ecc790713f..da1817874ad5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -101,12 +101,6 @@  ifneq ($(do_tools),true)
 	do_tools_host=
 endif
 
-$(foreach _m,$(all_built-in_dkms_modules), \
-  $(if $(filter true,$(do_$(_m))),, \
-    $(eval do_$(_m)_disable := $$(shell for m in $$$$(cat $(DROOT)/$(_m)-modules.ignore); do grep -qxF $$$$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$$$m >> $(prev_abidir)/../modules.ignore; done)) \
-  ) \
-)
-
 ifeq ($(do_dkms_wireguard),false)
 	do_wireguard_disable:=$(shell for m in $$(cat $(DROOT)/wireguard-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done)
 endif
@@ -129,7 +123,7 @@  clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.
 	dh_clean
 
 	# normal build junk
-	rm -rf $(DEBIAN)/abi/$(release)-$(revision)
+	rm -rf $(DEBIAN)/abi
 	rm -rf $(builddir)
 	rm -f $(stampdir)/stamp-*
 	rm -rf $(DEBIAN)/linux-*
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index 2f27d1710ea5..cdd5dcbe76db 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -128,7 +128,6 @@  ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 endif
 
 abidir		:= $(CURDIR)/$(DEBIAN)/__abi.current/$(arch)
-prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/$(arch)
 commonconfdir	:= $(CURDIR)/$(DEBIAN)/config
 archconfdir	:= $(CURDIR)/$(DEBIAN)/config/$(arch)
 sharedconfdir	:= $(CURDIR)/debian.master/config
diff --git a/debian/rules.d/4-checks.mk b/debian/rules.d/4-checks.mk
index 1671dba31f6b..a54248a7ba03 100644
--- a/debian/rules.d/4-checks.mk
+++ b/debian/rules.d/4-checks.mk
@@ -1,15 +1,3 @@ 
-# Check ABI for package against last release (if not same abinum)
-abi-check-%: $(stampdir)/stamp-install-%
-	@echo Debug: $@
-	@perl -f $(DROOT)/scripts/abi-check "$*" "$(prev_abinum)" "$(abinum)" \
-		"$(prev_abidir)" "$(abidir)" "$(skipabi)"
-
-# Check the module list against the last release (always)
-module-check-%: $(stampdir)/stamp-install-%
-	@echo Debug: $@
-	$(DROOT)/scripts/module-check "$*" \
-		"$(prev_abidir)" "$(abidir)" $(skipmodule)
-
 # Check the signature of staging modules
 module-signature-check-%: $(stampdir)/stamp-install-%
 	@echo Debug: $@
@@ -17,13 +5,7 @@  module-signature-check-%: $(stampdir)/stamp-install-%
 		"$(DROOT)/$(mods_pkg_name)-$*" \
 		"$(DROOT)/$(mods_extra_pkg_name)-$*"
 
-# Check the reptoline jmp/call functions against the last release.
-retpoline-check-%: $(stampdir)/stamp-install-%
-	@echo Debug: $@
-	$(SHELL) $(DROOT)/scripts/retpoline-check "$*" \
-		"$(prev_abidir)" "$(abidir)" "$(skipretpoline)" "$(builddir)/build-$*"
-
-checks-%: module-check-% module-signature-check-% abi-check-% retpoline-check-%
+checks-%: module-signature-check-%
 	@echo Debug: $@
 
 # Check the config against the known options list.
diff --git a/debian/scripts/abi-check b/debian/scripts/abi-check
deleted file mode 100755
index d065f3d698c0..000000000000
--- a/debian/scripts/abi-check
+++ /dev/null
@@ -1,210 +0,0 @@ 
-#!/usr/bin/perl -w
-
-my $flavour = shift;
-my $prev_abinum = shift;
-my $abinum = shift;
-my $prev_abidir = shift;
-my $abidir = shift;
-my $skipabi = shift;
-
-my $fail_exit = 1;
-my $EE = "EE:";
-my $errors = 0;
-my $abiskip = 0;
-
-my $count;
-
-print "II: Checking ABI for $flavour...\n";
-
-if (-f "$prev_abidir/ignore"
-    or -f "$prev_abidir/$flavour.ignore" or "$skipabi" eq "true") {
-	print "WW: Explicitly asked to ignore ABI, running in no-fail mode\n";
-	$fail_exit = 0;
-	$abiskip = 1;
-	$EE = "WW:";
-}
-
-if ($prev_abinum != $abinum) {
-	print "II: Different ABI's, running in no-fail mode\n";
-	$fail_exit = 0;
-	$EE = "WW:";
-}
-
-if (not -f "$abidir/$flavour" or not -f "$prev_abidir/$flavour") {
-	print "EE: Previous or current ABI file missing!\n";
-	print "    $abidir/$flavour\n" if not -f "$abidir/$flavour";
-	print "    $prev_abidir/$flavour\n" if not -f "$prev_abidir/$flavour";
-
-	# Exit if the ABI files are missing, but return status based on whether
-	# skip ABI was indicated.
-	if ("$abiskip" eq "1") {
-		exit(0);
-	} else {
-		exit(1);
-	}
-}
-
-my %symbols;
-my %symbols_ignore;
-my %modules_ignore;
-my %module_syms;
-
-# See if we have any ignores
-my $ignore = 0;
-print "    Reading symbols/modules to ignore...";
-
-for $file ("$prev_abidir/../blacklist") {
-	if (-f $file) {
-		open(IGNORE, "< $file") or
-			die "Could not open $file";
-		while (<IGNORE>) {
-			chomp;
-			if ($_ =~ m/M: (.*)/) {
-				$modules_ignore{$1} = 1;
-			} else {
-				$symbols_ignore{$_} = 1;
-			}
-			$ignore++;
-		}
-		close(IGNORE);
-	}
-}
-print "read $ignore symbols/modules.\n";
-
-sub is_ignored($$) {
-	my ($mod, $sym) = @_;
-
-	die "Missing module name in is_ignored()" if not defined($mod);
-	die "Missing symbol name in is_ignored()" if not defined($sym);
-
-	if (defined($symbols_ignore{$sym}) or defined($modules_ignore{$mod})) {
-		return 1;
-	}
-	return 0;
-}
-
-# Read new syms first
-print "    Reading new symbols ($abinum)...";
-$count = 0;
-open(NEW, "< $abidir/$flavour") or
-	die "Could not open $abidir/$flavour";
-while (<NEW>) {
-	chomp;
-	m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
-	$symbols{$4}{'type'} = $1;
-	$symbols{$4}{'loc'} = $2;
-	$symbols{$4}{'hash'} = $3;
-	$module_syms{$2} = 0;
-	$count++;
-}
-close(NEW);
-print "read $count symbols.\n";
-
-# Now the old symbols, checking for missing ones
-print "    Reading old symbols ($prev_abinum)...";
-$count = 0;
-open(OLD, "< $prev_abidir/$flavour") or
-	die "Could not open $prev_abidir/$flavour";
-while (<OLD>) {
-	chomp;
-	m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
-	$symbols{$4}{'old_type'} = $1;
-	$symbols{$4}{'old_loc'} = $2;
-	$symbols{$4}{'old_hash'} = $3;
-	$count++;
-}
-close(OLD);
-
-print "read $count symbols.\n";
-
-print "II: Checking for missing symbols in new ABI...";
-$count = 0;
-foreach $sym (keys(%symbols)) {
-	if (!defined($symbols{$sym}{'type'})) {
-		print "\n" if not $count;
-		printf("    MISS : %s%s\n", $sym,
-			is_ignored($symbols{$sym}{'old_loc'}, $sym) ? " (ignored)" : "");
-		$count++ if !is_ignored($symbols{$sym}{'old_loc'}, $sym);
-	}
-}
-print "    " if $count;
-print "found $count missing symbols\n";
-if ($count) {
-	print "$EE Symbols gone missing (what did you do!?!)\n";
-	$errors++;
-}
-
-
-print "II: Checking for new symbols in new ABI...";
-$count = 0;
-foreach $sym (keys(%symbols)) {
-	if (!defined($symbols{$sym}{'old_type'})) {
-		print "\n" if not $count;
-		print "    NEW : $sym\n";
-		$count++;
-	}
-}
-print "    " if $count;
-print "found $count new symbols\n";
-if ($count and $prev_abinum == $abinum) {
-	print "WW: Found new symbols within same ABI. Not recommended\n";
-}
-
-print "II: Checking for changes to ABI...\n";
-$count = 0;
-my $moved = 0;
-my $changed_type = 0;
-my $changed_hash = 0;
-foreach $sym (keys(%symbols)) {
-	if (!defined($symbols{$sym}{'old_type'}) or
-	    !defined($symbols{$sym}{'type'})) {
-		next;
-	}
-
-	# Changes in location don't hurt us, but log it anyway
-	if ($symbols{$sym}{'loc'} ne $symbols{$sym}{'old_loc'}) {
-		printf("    MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'},
-			$symbols{$sym}{'loc'});
-		$moved++;
-	}
-
-	# Changes to export type are only bad if new type isn't
-	# EXPORT_SYMBOL. Changing things to GPL are bad.
-	if ($symbols{$sym}{'type'} ne $symbols{$sym}{'old_type'}) {
-		printf("    TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
-			$symbols{$sym}{'type'}, is_ignored($symbols{$sym}{'loc'}, $sym)
-			? " (ignored)" : "");
-		$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL"
-			and !is_ignored($symbols{$sym}{'loc'}, $sym);
-	}
-
-	# Changes to the hash are always bad
-	if ($symbols{$sym}{'hash'} ne $symbols{$sym}{'old_hash'}) {
-		printf("    HASH : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_hash'},
-			$symbols{$sym}{'hash'}, is_ignored($symbols{$sym}{'loc'}, $sym)
-			? " (ignored)" : "");
-		$changed_hash++ if !is_ignored($symbols{$sym}{'loc'}, $sym);
-		$module_syms{$symbols{$sym}{'loc'}}++;
-	}
-}
-
-print "WW: $moved symbols changed location\n" if $moved;
-print "$EE $changed_type symbols changed export type and weren't ignored\n" if $changed_type;
-print "$EE $changed_hash symbols changed hash and weren't ignored\n" if $changed_hash;
-
-$errors++ if $changed_hash or $changed_type;
-if ($changed_hash) {
-	print "II: Module hash change summary...\n";
-	foreach $mod (sort { $module_syms{$b} <=> $module_syms{$a} } keys %module_syms) {
-		next if ! $module_syms{$mod};
-		printf("    %-40s: %d\n", $mod, $module_syms{$mod});
-	}
-}
-
-print "II: Done\n";
-
-if ($errors) {
-	exit($fail_exit);
-} else {
-	exit(0);
-}
diff --git a/debian/scripts/module-check b/debian/scripts/module-check
deleted file mode 100755
index e33a4f0e1c03..000000000000
--- a/debian/scripts/module-check
+++ /dev/null
@@ -1,113 +0,0 @@ 
-#!/usr/bin/python3
-
-import os
-import sys
-
-if len(sys.argv) < 4 or len(sys.argv) > 5:
-    print('Usage: module-check <flavor> <prev_abidir> <abidir> [<skipmodule>]')
-    sys.exit(2)
-
-flavor, prev_abidir, abidir = sys.argv[1:4]  # pylint: disable=W0632
-if len(sys.argv) > 4:
-    skipmodule = sys.argv[4]
-else:
-    skipmodule = ''
-
-print('II: Checking modules for {}...'.format(flavor), end='')
-
-if ((os.path.exists('{}/ignore.modules'.format(prev_abidir)) or
-     os.path.exists('{}/{}.ignore.modules'.format(prev_abidir, flavor)))):
-    print('explicitly ignoring modules')
-    sys.exit(0)
-
-curr_modules = '{}/{}.modules'.format(abidir, flavor)
-prev_modules = '{}/{}.modules'.format(prev_abidir, flavor)
-if not os.path.exists(curr_modules) or not os.path.exists(prev_modules):
-    print('previous or current modules file missing!')
-    print('   {}'.format(curr_modules))
-    print('   {}'.format(prev_modules))
-    sys.exit(0 if skipmodule else 1)
-
-print()
-
-modules = {}
-modules_ignore = {}
-missing = 0
-new = 0
-errors = 0
-
-# See if we have any ignores
-prev_modules_ignore = '{}/../modules.ignore'.format(prev_abidir)
-if os.path.exists(prev_modules_ignore):
-    ignore = 0
-    with open(prev_modules_ignore) as fh:
-        for mod in fh:
-            mod = mod.strip()
-            if mod.startswith('#'):
-                continue
-            modules_ignore[mod] = 1
-            ignore += 1
-    print('read {} modules.'.format(ignore))
-
-# Read new modules first
-print('   reading new modules...', end='')
-new_count = 0
-for f in (curr_modules, curr_modules + '.builtin'):
-    if not os.path.exists(f):
-        continue
-    with open(f) as fh:
-        for mod in fh:
-            mod = mod.strip()
-            modules[mod] = 1
-            new_count += 1
-print('read {} modules.'.format(new_count))
-
-# Now the old modules, checking for missing ones
-print('   reading old modules...', end='')
-old_count = 0
-for f in (prev_modules, prev_modules + '.builtin'):
-    if not os.path.exists(f):
-        continue
-    with open(f) as fh:
-        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
-            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))
-        new += 1
-if new or missing:
-    print('      read {} modules : new({})  missing({})'.format(old_count, new, missing))
-else:
-    print('read {} modules.'.format(old_count))
-
-# Let's see where we stand...
-if errors:
-    if skipmodule:
-        print('WW: Explicitly asked to ignore failures')
-    else:
-        print('EE: Missing modules')
-        sys.exit(1)
-
-if new:
-    print('II: New modules')
-else:
-    print('II: No new modules')
-
-print('II: Done')
-
-sys.exit(0)
diff --git a/debian/scripts/retpoline-check b/debian/scripts/retpoline-check
deleted file mode 100755
index 7dbfb303360b..000000000000
--- a/debian/scripts/retpoline-check
+++ /dev/null
@@ -1,47 +0,0 @@ 
-#!/bin/bash
-
-flavour="$1"
-prev_abidir="$2"
-curr_abidir="$3"
-skipretpoline="$4"
-
-echo "II: Checking retpoline indirections for $flavour...";
-
-if [ "$skipretpoline" = 'true' ]; then
-	echo "manual request ignoring retpoline delta"
-fi
-
-if [ -f "$prev_abidir/ignore.retpoline" -o \
-     -f "$prev_abidir/$flavour.ignore.retpoline" ]; then
-	echo "explicitly ignoring retpoline delta"
-	skipretpoline='true'
-fi
-
-prev="$prev_abidir/$flavour.retpoline"
-curr="$curr_abidir/$flavour.retpoline"
-if [ ! -f "$prev" ]; then
-	echo "previous retpoline file missing!"
-	echo "   $prev"
-	prev="/dev/null"
-fi
-if [ ! -f "$curr" ]; then
-	echo "current retpoline file missing!"
-	echo "   $curr"
-	curr="/dev/null"
-fi
-
-echo "II: retpoline delta in this package..."
-rc=0
-diff -u "$prev" "$curr" || true
-count=$( diff -u "$prev" "$curr" | grep '^+[^+]' | wc -l )
-if [ "$count" != 0 ]; then
-	rc=1
-	echo "WW: $count new retpoline sequences detected"
-fi
-
-echo "II: Done";
-if [ "$skipretpoline" = 'true' -a "$rc" -ne 0 ]; then
-	echo "II: ignoring errors"
-	exit 0
-fi
-exit "$rc"