[disco/master-next,9/9] UBUNTU: [Packaging] dkms-build--nvidia-N -- remove GCC versions
diff mbox series

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

Commit Message

Andy Whitcroft March 12, 2019, 3:57 p.m. UTC
Builds contain gcc version markers which trigger a binary delta in the
resulting *.ko files.  Remove these as we build to reduce irrelevant delta.
Obviously it is possible the compiler version is a different length and
a 'invalid' missmatch will occur, it is also possible the (different)
compiler could generate different code.  In these cases we will still
throw a missmatch.

BugLink: http://bugs.launchpad.net/bugs/1764792
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/scripts/dkms-build--nvidia-N | 13 ++++++++++++-
 debian/scripts/fix-filenames.c      |  1 -
 2 files changed, 12 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N
index ee05d575af6d..27da4ca7ecdb 100755
--- a/debian/scripts/dkms-build--nvidia-N
+++ b/debian/scripts/dkms-build--nvidia-N
@@ -20,7 +20,18 @@  build="$( dirname "$objects" )/build"
 # any retpoline sequences therein.  For our purposes we only want the *.o
 # files, elide the rest.
 mkdir -p "$pkgdir/bits/scripts"
-(cd "$objects" && find -name \*.o | cpio -Lpd "$pkgdir/bits")
+(
+	gcc_variant1=$(gcc --version | head -1 | sed -e 's/^gcc/GCC:/')
+	gcc_variant2=$(gcc --version | head -1 | sed -e 's/^\(gcc\) \((.*)\) \(.*\)$/\1 version \3 \2/')
+	cd "$objects" || exit 1
+	find -name \*.o | \
+	while read file
+	do
+		cp --parents "$file" "$pkgdir/bits"
+		"$srcdir/debian/scripts/fix-filenames" "$pkgdir/bits/$file" "$gcc_variant1"
+		"$srcdir/debian/scripts/fix-filenames" "$pkgdir/bits/$file" "$gcc_variant2"
+	done
+)
 
 # Install the support files we need.
 cp "$srcdir/scripts/module-common.lds" "$pkgdir/bits/scripts"
diff --git a/debian/scripts/fix-filenames.c b/debian/scripts/fix-filenames.c
index f1367922655c..9bd144a6efa8 100644
--- a/debian/scripts/fix-filenames.c
+++ b/debian/scripts/fix-filenames.c
@@ -48,7 +48,6 @@  main(int argc, char *argv[])
 		exit(1);
 	}
 	size = in_info.st_size;
-	printf("%s %ld bytes\n", in_name, size);
 
 	in = mmap((void *)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, in_fd, (off_t)0);
 	if (!in) {