diff mbox series

[disco/master-next,5/9] UBUNTU: [Packaging] dkms-build--nvidia* -- check gcc version against primary build

Message ID 20190312155719.3532-6-apw@canonical.com
State New
Headers show
Series [disco/master-next,1/9] UBUNTU: [Packaging] dkms-build -- support building against packages in PPAs | expand

Commit Message

Andy Whitcroft March 12, 2019, 3:57 p.m. UTC
The binaries have the gcc version burned into them in a way which is not
trivially correctable (as the length is not consistent).  Check that the
compiler version is the same in both builds using the version recorded
in the buildinfo.

BugLink: http://bugs.launchpad.net/bugs/1764792
Signed-off-by: Andy Whitcroft <apw@canonical.com>
 debian/scripts/dkms-build--nvidia-390 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/debian/scripts/dkms-build--nvidia-390 b/debian/scripts/dkms-build--nvidia-390
index 093035c756a0..ee05d575af6d 100755
--- a/debian/scripts/dkms-build--nvidia-390
+++ b/debian/scripts/dkms-build--nvidia-390
@@ -47,9 +47,22 @@  grep /usr/bin/ld.bfd "$log" | sed -e "s@$build/@@g" \
 	elif [ "$sign" = "--lrm" ]; then
 		# We are in LRM build the package a copy in any signatures we can
 		# find for them.  These will be added after linking.
+		base="/usr/lib/linux/$abi_flavour"
+		# Check the GCC version we are using against that used in the kernel
+		# NOTE: that we treat this as only a warning, as if the binaries did come
+		# out differently then we will actually 
+		echo "II: checking gcc version ..."
+		cat "$base/compiler"
+		gcc --version
+		gcc_was=$(cat "$base/compiler" | sed -e 's/^GCC:/gcc/')
+		gcc_is=$(gcc --version | head -1)
+		if [ "$gcc_was" != "$gcc_is" ]; then
+			echo "WW: gcc version missmatch between linux and linux-restricted-modules"
+			echo "WW: was: $gcc_was  is: $gcc_is"
+		fi
 		# Apply any local signatures.
-		base="/usr/lib/linux/$abi_flavour"
 		echo "II: adding signatures from $base ..."
 		cp "$base/signatures/$package/"*".ko.sig" "$pkgdir/bits"
 		sha256sum -c "$base/signatures/$package/SHA256SUMS" || exit 1