diff mbox series

[disco/master-next,6/9] UBUNTU: [Packaging] dkms-build -- add support for unversioned overrides

Message ID 20190312155719.3532-7-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
We allow package specific overrides for dkms-build.  However some
packages have versions in their names.  To make these easier to handle
when the version changes add optional unversioned overrides.  Where a
package ends with a -NNN version look for overrides in the full name
and with a (literal) -N suffix.

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


diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build
index 251761b54e4f..6457d3650506 100755
--- a/debian/scripts/dkms-build
+++ b/debian/scripts/dkms-build
@@ -163,9 +163,14 @@  done
 # it the original source directory, destination package directory, the objects
 # as squirreled away, and the log in case it is useful.  Finally pass a formed
 # signing command line in case we need to do that.
-if [ -e "$dkms_build" ]; then
-	echo "II: dkms-build override $package found, executing"
+dkms_build_generic=$(echo "$dkms_build_specific" | sed -e 's/-[0-9][0-9]*$/-N/')
+for dkms_build in "$dkms_build_specific" "$dkms_build_generic"
+	if [ ! -e "$dkms_build" ]; then
+		continue
+	fi
+	echo "II: dkms-build override $(basename "$dkms_build") found, executing"
 	$SHELL "$dkms_build" \
 		"$srcdir" \
 		"$dkms_dir/build/$dkms_package/$dkms_version/objects" \
@@ -177,6 +182,7 @@  if [ -e "$dkms_build" ]; then
 		"$pkgdir" \
 		"$package" \
 		"$@" || exit 1
+	break
 echo "II: dkms-build build $package complete"