[artful/master-next,2/3] UBUNTU: [Packaging] final-checks -- sanity checking ABI contents
diff mbox series

Message ID 20180222115340.11733-3-apw@canonical.com
State New
Headers show
Series
  • [artful/master-next,1/3] UBUNTU: [Packaging] retpoline-extract -- instantiate retpoline files for i386
Related show

Commit Message

Andy Whitcroft Feb. 22, 2018, 11:53 a.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1751021
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules.d/1-maintainer.mk   |  7 +++--
 debian/scripts/misc/final-checks | 55 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100755 debian/scripts/misc/final-checks

Patch
diff mbox series

diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 49ad8ba28881..d67488366339 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -1,7 +1,7 @@ 
 # The following targets are for the maintainer only! do not run if you don't
 # know what they do.
 
-.PHONY: printenv updateconfigs printchanges insertchanges startnewrelease diffupstream help updateportsconfigs editportsconfigs autoreconstruct
+.PHONY: printenv updateconfigs printchanges insertchanges startnewrelease diffupstream help updateportsconfigs editportsconfigs autoreconstruct finalchecks
 
 help:
 	@echo "These are the targets in addition to the normal $(DEBIAN) ones:"
@@ -107,12 +107,15 @@  printchanges:
 	git log "$$baseCommit"..HEAD | \
 	$(DROOT)/scripts/misc/git-ubuntu-log $(ubuntu_log_opts)
 
-insertchanges: autoreconstruct
+insertchanges: autoreconstruct finalchecks
 	@perl -w -f $(DROOT)/scripts/misc/insert-changes.pl $(DROOT) $(DEBIAN) 
 
 autoreconstruct:
 	$(DROOT)/scripts/misc/gen-auto-reconstruct $(upstream_tag) $(DEBIAN)/reconstruct $(DROOT)/source/options
 
+finalchecks:
+	$(DROOT)/scripts/misc/final-checks "$(DEBIAN)" "$(prev_fullver)"
+
 diffupstream:
 	@git diff-tree -p refs/remotes/linux-2.6/master..HEAD $(shell ls | grep -vE '^(ubuntu|$(DEBIAN)|\.git.*)')
 
diff --git a/debian/scripts/misc/final-checks b/debian/scripts/misc/final-checks
new file mode 100755
index 000000000000..548dea99e6a0
--- /dev/null
+++ b/debian/scripts/misc/final-checks
@@ -0,0 +1,55 @@ 
+#!/bin/bash
+
+debian="$1"
+abi="$2"
+
+. "$debian/etc/kernelconfig"
+
+fail=0
+
+failure()
+{
+	echo "EE: $@" 1>&2
+	fail=1
+}
+
+abi_check()
+{
+	local abidir="$1"
+	local arch="$2"
+	local flavour="$3"
+
+	local abidir="$abidir/$arch"
+
+	if [ ! -f "$abidir/$flavour" -a \
+	     ! -f "$abidir/$flavour.ignore" -a \
+	     ! -f "$abidir/ignore" ]
+	then
+		failure "$arch/$flavour ABI symbol file missing"
+	fi
+
+	if [ ! -f "$abidir/$flavour.modules" -a \
+	     ! -f "$abidir/$flavour.ignore.modules" -a \
+	     ! -f "$abidir/ignore.modules" ]
+	then
+		failure "$arch/$flavour ABI modules file missing"
+	fi
+
+	if [ ! -f "$abidir/$flavour.retpoline" -a \
+	     ! -f "$abidir/$flavour.ignore.retpoline" -a \
+	     ! -f "$abidir/ignore.retpoline" ]
+	then
+		failure "$arch/$flavour ABI retpoline file missing"
+	fi
+}
+
+for arch in $archs
+do
+	for flavour in $(ls -1 "$debian/config/$arch/config.flavour."*)
+	do
+		flavour=$(echo "$flavour" | sed -e 's@.*/config.flavour.@@')
+		abi_check "$debian/abi/$abi" "$arch" "$flavour"
+	done
+done
+
+exit "$fail"