diff mbox series

[2/9] UBUNTU: [Packaging] gen-rules -- clean up debian/rules fragment

Message ID 20210308150004.1746089-3-apw@canonical.com
State New
Headers show
Series LP#1918134 -- LRMv4 switch to signing with Ubuntu Kernel Modules signing key | expand

Commit Message

Andy Whitcroft March 8, 2021, 2:59 p.m. UTC
Convert debian/rules fragement to a simple here script in line with
the others in this section.  Makes the thing simpler to read, to quote
for, and more consistent.

BugLink: https://bugs.launchpad.net/bugs/1918134
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/scripts/gen-rules.lrm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/debian/scripts/gen-rules.lrm b/debian/scripts/gen-rules.lrm
index 19830c0..7dc774e 100755
--- a/debian/scripts/gen-rules.lrm
+++ b/debian/scripts/gen-rules.lrm
@@ -70,23 +70,23 @@  EOL
 		echo "II: build $package for $flavour $archs"
 
 		# debian/rules.gen
-		{
-			echo ""
-			#echo "# $package $version $suffix_minus $suffix_under"
-			echo "dkms_nvidia_${suffix_under}_version=\$(shell gawk '/^${package} / { print \$\$2; }' debian/dkms-versions)"
-			echo "nvidia_${suffix_under}_upstream_version=\$(shell echo \"\$(dkms_nvidia_${suffix_under}_version)\" | cut -d '-' -f 1)"
-			echo "gencontrol_flags += -Vdkms:nvidia-${suffix_minus}-modules=\"nvidia-dkms-${suffix_minus} (= \$(dkms_nvidia_${suffix_under}_version))\""
-			echo "gencontrol_flags += -Vnvk:nvidia-${suffix_minus}=\"nvidia-kernel-common-${suffix_minus} (<= \$(nvidia_${suffix_under}_upstream_version)-1), nvidia-kernel-common-${suffix_minus} (>= \$(nvidia_${suffix_under}_upstream_version))\""
-			echo "test::"
-			echo "	@echo $package $version $suffix_minus $suffix_under $suffix_short $targets"
-			echo "$targets::"
-			echo "	rm -rf \$(dkms_dir)/build \$(dkms_dir)/source"
-			echo "	mkdir -p \$(dkms_dir)/build \$(dkms_dir)/source"
-			echo "	install -d debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}"
-			echo "	install -d debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}/usr/lib/linux/triggers"
-			echo "	\$(call build_dkms, \$(src_abi)-${flavour}, linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}, \$(CURDIR)/debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}/lib/modules/\$(src_abi)-${flavour}/kernel, \"\", nvidia-${suffix_short}, pool/restricted/n/nvidia-graphics-drivers-${suffix_minus}/nvidia-kernel-source-${suffix_minus}_\$(dkms_nvidia_${suffix_under}_version)_\$(arch).deb pool/restricted/n/nvidia-graphics-drivers-${suffix_minus}/nvidia-dkms-${suffix_minus}_\$(dkms_nvidia_${suffix_under}_version)_\$(arch).deb)"
-			echo "	\$(call install_control,linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour},${flavour},nvidia,${suffix_short},postinst postrm prerm config templates)"
-		} >>"debian/rules.gen"
+		cat - >>"debian/rules.gen" <<EOL
+
+# $package $version $suffix_minus $suffix_under
+dkms_nvidia_${suffix_under}_version=\$(shell gawk '/^${package} / { print \$\$2; }' debian/dkms-versions)
+nvidia_${suffix_under}_upstream_version=\$(shell echo "\$(dkms_nvidia_${suffix_under}_version)" | cut -d '-' -f 1)
+gencontrol_flags += -Vdkms:nvidia-${suffix_minus}-modules="nvidia-dkms-${suffix_minus} (= \$(dkms_nvidia_${suffix_under}_version))"
+gencontrol_flags += -Vnvk:nvidia-${suffix_minus}="nvidia-kernel-common-${suffix_minus} (<= \$(nvidia_${suffix_under}_upstream_version)-1), nvidia-kernel-common-${suffix_minus} (>= \$(nvidia_${suffix_under}_upstream_version))"
+test::
+	@echo $package $version $suffix_minus $suffix_under $suffix_short $targets
+$targets::
+	rm -rf \$(dkms_dir)/build \$(dkms_dir)/source
+	mkdir -p \$(dkms_dir)/build \$(dkms_dir)/source
+	install -d debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}
+	install -d debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}/usr/lib/linux/triggers
+	\$(call build_dkms, \$(src_abi)-${flavour}, linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}, \$(CURDIR)/debian/linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour}/lib/modules/\$(src_abi)-${flavour}/kernel, "", nvidia-${suffix_short}, pool/restricted/n/nvidia-graphics-drivers-${suffix_minus}/nvidia-kernel-source-${suffix_minus}_\$(dkms_nvidia_${suffix_under}_version)_\$(arch).deb pool/restricted/n/nvidia-graphics-drivers-${suffix_minus}/nvidia-dkms-${suffix_minus}_\$(dkms_nvidia_${suffix_under}_version)_\$(arch).deb)
+	\$(call install_control,linux-modules-nvidia-${suffix_minus}-\$(src_abi)-${flavour},${flavour},nvidia,${suffix_short},postinst postrm prerm config templates)
+EOL
 
 		# debian/control.d/meta-nvidia
 		cat - >>"debian/control.d/meta-nvidia" <<EOL