diff mbox series

UBUNTU: [Packaging] nvidia -- use dkms-versions to define versions built

Message ID 20210122162312.459010-2-apw@canonical.com
State New
Headers show
Series UBUNTU: [Packaging] nvidia -- use dkms-versions to define versions built | expand

Commit Message

Andy Whitcroft Jan. 22, 2021, 4:23 p.m. UTC
Currently each and every Nvidia version added or removed from
dkms-versions requires a pair of corresponding changes to debian/rules
and debian/rules.d/2-binary-arch.mk.  Switch to using the listed versions
in debian/dkms-versions to generate the rules we need during build.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules                    | 12 ++++--------
 debian/rules.d/2-binary-arch.mk | 24 ++++++++++++++----------
 2 files changed, 18 insertions(+), 18 deletions(-)

Comments

Kamal Mostafa Jan. 22, 2021, 5:36 p.m. UTC | #1
Note that this singlet-patch is actually the one for focal/linux,
not for groovy/linux.

Works fine for focal.  I'll ACK this for all the */linux series:

Acked-by: Kamal Mostafa <kamal@canonical.com>

 -Kamal

On Fri, Jan 22, 2021 at 04:23:02PM +0000, Andy Whitcroft wrote:
> Currently each and every Nvidia version added or removed from
> dkms-versions requires a pair of corresponding changes to debian/rules
> and debian/rules.d/2-binary-arch.mk.  Switch to using the listed versions
> in debian/dkms-versions to generate the rules we need during build.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  debian/rules                    | 12 ++++--------
>  debian/rules.d/2-binary-arch.mk | 24 ++++++++++++++----------
>  2 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/debian/rules b/debian/rules
> index 8c3c71a298e7..e490836b813d 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -125,17 +125,13 @@ do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
>  
>  # Versions of dkms packages.
>  dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390 / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_435_version=$(shell gawk '/^nvidia-graphics-drivers-435 / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_450_version=$(shell gawk '/^nvidia-graphics-drivers-450 / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_455_version=$(shell gawk '/^nvidia-graphics-drivers-455 / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_460_version=$(shell gawk '/^nvidia-graphics-drivers-460 / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_418_server_version=$(shell gawk '/^nvidia-graphics-drivers-418-server / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_440_server_version=$(shell gawk '/^nvidia-graphics-drivers-440-server / { print $$2; }' debian/dkms-versions)
> -dkms_nvidia_450_server_version=$(shell gawk '/^nvidia-graphics-drivers-450-server / { print $$2; }' debian/dkms-versions)
>  dkms_vbox_guest_version=$(shell gawk '/^virtualbox/ { print $$2; }' debian/dkms-versions)
>  dkms_wireguard_version=$(shell gawk '/^wireguard-linux-compat / { print $$2; }' debian/dkms-versions)
>  
> +# NVIDIA DKMS package gross series split into desktop and server.
> +nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions)
> +nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
> +
>  # Debian Build System targets
>  binary: binary-indep binary-arch
>  
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 703fd2ade338..593d711a3adb 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -63,6 +63,18 @@ define build_dkms =
>  	CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5)
>  endef
>  
> +# nvidia_build_payload 450 450 450_450.102.04-0ubuntu0.20.04.1
> +# nvidia_build_payload 450-server 450srv 50.102.04-0ubuntu0.20.04.1
> +define nvidia_build_payload =
> +	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-$(2), pool/restricted/n/nvidia-graphics-drivers-$(1)/nvidia-kernel-source-$(1)_$(3)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-$(1)/nvidia-dkms-$(1)_$(3)_$(arch).deb)
> +endef
> +# nvidia_build 450
> +# nvidia_build 450-server
> +define nvidia_build =
> +	$(call nvidia_build_payload,$(1),$(shell echo $(1) | sed -e 's/-server/srv/'),$(shell awk '/^nvidia-graphics-drivers-$(1) / {print($$2);}' debian/dkms-versions))
> +
> +endef
> +
>  define install_control =
>  	for which in $(3);							\
>  	do									\
> @@ -403,18 +415,10 @@ endif
>  	$(if $(filter true,$(do_dkms_wireguard)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, "", wireguard, pool/universe/w/wireguard-linux-compat/wireguard-dkms_$(dkms_wireguard_version)_all.deb))
>  
>  ifeq ($(do_dkms_nvidia),true)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-390, pool/restricted/n/nvidia-graphics-drivers-390/nvidia-kernel-source-390_$(dkms_nvidia_390_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-390/nvidia-dkms-390_$(dkms_nvidia_390_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-435, pool/restricted/n/nvidia-graphics-drivers-435/nvidia-kernel-source-435_$(dkms_nvidia_435_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-435/nvidia-dkms-435_$(dkms_nvidia_435_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-450, pool/restricted/n/nvidia-graphics-drivers-450/nvidia-kernel-source-450_$(dkms_nvidia_450_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-450/nvidia-dkms-450_$(dkms_nvidia_450_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-455, pool/restricted/n/nvidia-graphics-drivers-455/nvidia-kernel-source-455_$(dkms_nvidia_455_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-455/nvidia-dkms-455_$(dkms_nvidia_455_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-460, pool/restricted/n/nvidia-graphics-drivers-460/nvidia-kernel-source-460_$(dkms_nvidia_460_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-460/nvidia-dkms-460_$(dkms_nvidia_460_version)_$(arch).deb)
> +	$(foreach series,$(nvidia_desktop_series),$(call nvidia_build,$(series)))
>  endif
> -
>  ifeq ($(do_dkms_nvidia_server),true)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-418srv, pool/restricted/n/nvidia-graphics-drivers-418-server/nvidia-kernel-source-418-server_$(dkms_nvidia_418_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-418-server/nvidia-dkms-418-server_$(dkms_nvidia_418_server_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-440srv, pool/restricted/n/nvidia-graphics-drivers-440-server/nvidia-kernel-source-440-server_$(dkms_nvidia_440_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-440-server/nvidia-dkms-440-server_$(dkms_nvidia_440_server_version)_$(arch).deb)
> -	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-450srv, pool/restricted/n/nvidia-graphics-drivers-450-server/nvidia-kernel-source-450-server_$(dkms_nvidia_450_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-450-server/nvidia-dkms-450-server_$(dkms_nvidia_450_server_version)_$(arch).deb)
> -
> +	$(foreach series,$(nvidia_server_series),$(call nvidia_build,$(series)))
>  endif
>  
>  ifeq ($(do_extras_package),true)
> -- 
> 2.29.2
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Andy Whitcroft Jan. 25, 2021, 5:05 p.m. UTC | #2
Applied to bionic:linux, focal:linux, groovy:linux, and hirsute:linux.

Note this only applies to the main package changes.  We will apply the
LRM components separatly.

-apw
Andy Whitcroft Feb. 10, 2021, 12:45 p.m. UTC | #3
Applied to all LRM branches.  Note this was progamatically applied to
handle the local delta.  It appears as the single patch against the
launchpad bug; subject:

    UBUNTU: [Packaging] convert to v3 autogen form

-apw
diff mbox series

Patch

diff --git a/debian/rules b/debian/rules
index 8c3c71a298e7..e490836b813d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -125,17 +125,13 @@  do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
 
 # Versions of dkms packages.
 dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390 / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_435_version=$(shell gawk '/^nvidia-graphics-drivers-435 / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_450_version=$(shell gawk '/^nvidia-graphics-drivers-450 / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_455_version=$(shell gawk '/^nvidia-graphics-drivers-455 / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_460_version=$(shell gawk '/^nvidia-graphics-drivers-460 / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_418_server_version=$(shell gawk '/^nvidia-graphics-drivers-418-server / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_440_server_version=$(shell gawk '/^nvidia-graphics-drivers-440-server / { print $$2; }' debian/dkms-versions)
-dkms_nvidia_450_server_version=$(shell gawk '/^nvidia-graphics-drivers-450-server / { print $$2; }' debian/dkms-versions)
 dkms_vbox_guest_version=$(shell gawk '/^virtualbox/ { print $$2; }' debian/dkms-versions)
 dkms_wireguard_version=$(shell gawk '/^wireguard-linux-compat / { print $$2; }' debian/dkms-versions)
 
+# NVIDIA DKMS package gross series split into desktop and server.
+nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions)
+nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
+
 # Debian Build System targets
 binary: binary-indep binary-arch
 
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 703fd2ade338..593d711a3adb 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -63,6 +63,18 @@  define build_dkms =
 	CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5)
 endef
 
+# nvidia_build_payload 450 450 450_450.102.04-0ubuntu0.20.04.1
+# nvidia_build_payload 450-server 450srv 50.102.04-0ubuntu0.20.04.1
+define nvidia_build_payload =
+	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-$(2), pool/restricted/n/nvidia-graphics-drivers-$(1)/nvidia-kernel-source-$(1)_$(3)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-$(1)/nvidia-dkms-$(1)_$(3)_$(arch).deb)
+endef
+# nvidia_build 450
+# nvidia_build 450-server
+define nvidia_build =
+	$(call nvidia_build_payload,$(1),$(shell echo $(1) | sed -e 's/-server/srv/'),$(shell awk '/^nvidia-graphics-drivers-$(1) / {print($$2);}' debian/dkms-versions))
+
+endef
+
 define install_control =
 	for which in $(3);							\
 	do									\
@@ -403,18 +415,10 @@  endif
 	$(if $(filter true,$(do_dkms_wireguard)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, "", wireguard, pool/universe/w/wireguard-linux-compat/wireguard-dkms_$(dkms_wireguard_version)_all.deb))
 
 ifeq ($(do_dkms_nvidia),true)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-390, pool/restricted/n/nvidia-graphics-drivers-390/nvidia-kernel-source-390_$(dkms_nvidia_390_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-390/nvidia-dkms-390_$(dkms_nvidia_390_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-435, pool/restricted/n/nvidia-graphics-drivers-435/nvidia-kernel-source-435_$(dkms_nvidia_435_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-435/nvidia-dkms-435_$(dkms_nvidia_435_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-450, pool/restricted/n/nvidia-graphics-drivers-450/nvidia-kernel-source-450_$(dkms_nvidia_450_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-450/nvidia-dkms-450_$(dkms_nvidia_450_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-455, pool/restricted/n/nvidia-graphics-drivers-455/nvidia-kernel-source-455_$(dkms_nvidia_455_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-455/nvidia-dkms-455_$(dkms_nvidia_455_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-460, pool/restricted/n/nvidia-graphics-drivers-460/nvidia-kernel-source-460_$(dkms_nvidia_460_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-460/nvidia-dkms-460_$(dkms_nvidia_460_version)_$(arch).deb)
+	$(foreach series,$(nvidia_desktop_series),$(call nvidia_build,$(series)))
 endif
-
 ifeq ($(do_dkms_nvidia_server),true)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-418srv, pool/restricted/n/nvidia-graphics-drivers-418-server/nvidia-kernel-source-418-server_$(dkms_nvidia_418_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-418-server/nvidia-dkms-418-server_$(dkms_nvidia_418_server_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-440srv, pool/restricted/n/nvidia-graphics-drivers-440-server/nvidia-kernel-source-440-server_$(dkms_nvidia_440_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-440-server/nvidia-dkms-440-server_$(dkms_nvidia_440_server_version)_$(arch).deb)
-	$(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-450srv, pool/restricted/n/nvidia-graphics-drivers-450-server/nvidia-kernel-source-450-server_$(dkms_nvidia_450_server_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-450-server/nvidia-dkms-450-server_$(dkms_nvidia_450_server_version)_$(arch).deb)
-
+	$(foreach series,$(nvidia_server_series),$(call nvidia_build,$(series)))
 endif
 
 ifeq ($(do_extras_package),true)