]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: [Packaging] dkms-build -- backport latest version from disco
authorAndrea Righi <andrea.righi@canonical.com>
Wed, 12 Jun 2019 15:38:19 +0000 (17:38 +0200)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:45:12 +0000 (09:45 -0600)
BugLink: https://bugs.launchpad.net/bugs/1764792
Re-align with the latest version of dkms-build present in disco.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Andy Whitcroft <andy.whitcroft@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
debian/scripts/dkms-build

index 51877ea4533c1070b1779fc189129a047e138a1c..6457d3650506e4fb5e6e636fa6bc8465f7bf6bda 100755 (executable)
@@ -9,8 +9,22 @@ pkgdir="$5"
 package="$6"
 shift 6
 
+srcdir=$(pwd)
 cd "$dkms_dir" || exit 1
 
+built_using_record()
+{
+       local subst="$1"
+       local built_using="$2"
+       if [ ! -f "$subst" ]; then
+               touch "$subst"
+       fi
+       if ! grep -q -s "^linux:BuiltUsing=" "$subst"; then
+               echo "linux:BuiltUsing=" >>"$subst"
+       fi
+       sed -i -e "s/^\(linux:BuiltUsing=.*\)/\1$built_using, /" "$subst"
+}
+
 # Download and extract the DKMS package -- note there may be more
 # than one package to install.
 for package_path in "$@"
@@ -56,6 +70,13 @@ do
                ;;
        esac
        dpkg -x "$lpackage"_*.deb "$package"
+
+       for lpackage_path in "$lpackage"_*.deb
+       do
+               break
+       done
+       lversion=$( echo "$lpackage_path" | sed -e 's@.*/@@' -e 's@_[^_]*$@@' -e 's@.*_@@')
+       built_using_record "$srcdir/debian/$pkgname.substvars" "$built_using$lpackage (= $lversion)"
 done
 
 # Pick out the package/version from the dkms.conf.
@@ -67,6 +88,29 @@ done
 # package is installed directly, but not so much if we build it out
 # of the normal location.
 sed -i -e '/^PACKAGE_NAME=/ s/#//g' "$dkms_conf"
+cat - <<'EOF' >>"$dkms_conf"
+POST_BUILD="ubuntu-save-objects ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/objects $POST_BUILD"
+EOF
+ubuntu_script="$(dirname "$dkms_conf")/ubuntu-save-objects"
+cat - <<'EOF' >"$ubuntu_script"
+#!/bin/sh
+from="$1"
+to="$2"
+script="$3"
+shift 2
+
+# Copy the objects.
+echo "II: copying objects to '$to'"
+mkdir -p "$to"
+(cd "$from" && find -name \*.o -o -name \*.o.ur-\* | cpio -Lpd "$to")
+
+# Call the original post_install script if there is one.
+[ "$script" = '' ] && exit 0
+
+shift
+exec "$(dirname "$0")/$script" "$@"
+EOF
+chmod +x "$ubuntu_script"
 dkms_package=$( sed -ne 's/PACKAGE_NAME="\(.*\)"/\1/p' "$dkms_conf" )
 dkms_version=$( sed -ne 's/PACKAGE_VERSION="\(.*\)"/\1/p' "$dkms_conf" )