diff mbox series

[2/9] UBUNTU: [Packaging] generate nvidia version mappings at clean time -- add transitionals

Message ID 20210122162312.459010-4-apw@canonical.com
State New
Headers show
Series LP: #1912803 -- autogenerate Nvidia rules/control | expand

Commit Message

Andy Whitcroft Jan. 22, 2021, 4:23 p.m. UTC
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/control.d/migrate-nvidia-435      | 13 ------
 debian/control.d/migrate-nvidia-440      | 13 ------
 debian/control.d/transitionals-oem-20.04 | 13 ------
 debian/dkms-versions                     |  5 +--
 debian/package.config                    |  2 +
 debian/scripts/gen-rules                 | 55 +++++++++++++++++++++++-
 6 files changed, 58 insertions(+), 43 deletions(-)
 delete mode 100644 debian/control.d/migrate-nvidia-435
 delete mode 100644 debian/control.d/migrate-nvidia-440
 delete mode 100644 debian/control.d/transitionals-oem-20.04
diff mbox series

Patch

diff --git a/debian/control.d/migrate-nvidia-435 b/debian/control.d/migrate-nvidia-435
deleted file mode 100644
index 35c343d..0000000
--- a/debian/control.d/migrate-nvidia-435
+++ /dev/null
@@ -1,13 +0,0 @@ 
-Package: linux-modules-nvidia-435-generic${variant:suffix}
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-455-generic${variant:suffix}
-Description: Extra drivers for nvidia-435 for the generic flavour (dummy transitional package)
- Transitional package for upgrades of -435 to -455.
-
-Package: linux-modules-nvidia-435-lowlatency${variant:suffix}
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-455-lowlatency${variant:suffix}
-Description: Extra drivers for nvidia-435 for the generic flavour (dummy transitional package)
- Transitional package for upgrades of -435 to -455.
diff --git a/debian/control.d/migrate-nvidia-440 b/debian/control.d/migrate-nvidia-440
deleted file mode 100644
index 29f3423..0000000
--- a/debian/control.d/migrate-nvidia-440
+++ /dev/null
@@ -1,13 +0,0 @@ 
-Package: linux-modules-nvidia-440-generic${variant:suffix}
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-450-generic${variant:suffix}
-Description: Extra drivers for nvidia-440 for the generic flavour (dummy transitional package)
- Transitional package for upgrades of -440 to -450.
-
-Package: linux-modules-nvidia-440-lowlatency${variant:suffix}
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-450-lowlatency${variant:suffix}
-Description: Extra drivers for nvidia-440 for the generic flavour (dummy transitional package)
- Transitional package for upgrades of -440 to -450.
diff --git a/debian/control.d/transitionals-oem-20.04 b/debian/control.d/transitionals-oem-20.04
deleted file mode 100644
index 4643b4f..0000000
--- a/debian/control.d/transitionals-oem-20.04
+++ /dev/null
@@ -1,13 +0,0 @@ 
-Package: linux-modules-nvidia-440-oem-20.04
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-450-generic
-Description: Extra drivers for nvidia-440 for the generic flavour (dummy transitional package)
- Transitional package for upgrades from 20.04 to 20.10.
-
-Package: linux-modules-nvidia-450-oem-20.04
-Architecture: amd64
-Section: oldlibs
-Depends: linux-modules-nvidia-450-generic
-Description: Extra drivers for nvidia-450 for the generic flavour (dummy transitional package)
- Transitional package for upgrades from 20.04 to 20.10.
diff --git a/debian/dkms-versions b/debian/dkms-versions
index a8f8e9b..b119726 100644
--- a/debian/dkms-versions
+++ b/debian/dkms-versions
@@ -1,8 +1,7 @@ 
 zfs-linux 0.8.4-1ubuntu11
 nvidia-graphics-drivers-390 390.138-0ubuntu2
-nvidia-graphics-drivers-435 435.21-0ubuntu8
-nvidia-graphics-drivers-450 450.80.02-0ubuntu1
-nvidia-graphics-drivers-455 455.38-0ubuntu0.20.10.1
+nvidia-graphics-drivers-450 450.80.02-0ubuntu1 transition=nvidia-graphics-drivers-440
+nvidia-graphics-drivers-455 455.38-0ubuntu0.20.10.1 transition=nvidia-graphics-drivers-435
 nvidia-graphics-drivers-418-server 418.152.00-0ubuntu2
 nvidia-graphics-drivers-440-server 440.95.01-0ubuntu2
 nvidia-graphics-drivers-450-server 450.80.02-0ubuntu3
diff --git a/debian/package.config b/debian/package.config
index 2b69799..86c0e19 100644
--- a/debian/package.config
+++ b/debian/package.config
@@ -1,2 +1,4 @@ 
 build generic amd64
 build lowlatency amd64
+transitional 440-oem-20.04 450-generic amd64
+transitional 450-oem-20.04 450-generic amd64
diff --git a/debian/scripts/gen-rules b/debian/scripts/gen-rules
index 1a3fe02..2b7a177 100755
--- a/debian/scripts/gen-rules
+++ b/debian/scripts/gen-rules
@@ -1,8 +1,11 @@ 
 #!/bin/bash
 
+mkdir -p "debian/control.d"
 cat "debian/rules.in" >"debian/rules.gen"
 : >"debian/control.d/meta-nvidia"
 : >"debian/control.d/nvidia"
+: >"debian/control.d/migrate-nvidia"
+: >"debian/control.d/transitionals-local"
 
 while read command flavour archs
 do
@@ -13,7 +16,12 @@  do
 
 	targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
 
-	while read package version
+	cat - >>"debian/control.gen" <<EOL
+ linux-headers-@ABI@-${flavour} [${archs}] (>= @VERSION@),
+ linux-buildinfo-@ABI@-${flavour} [${archs}] (>= @VERSION@),
+EOL
+
+	while read package version extra
 	do
 		case "$package" in
 		nvidia-graphics-drivers-*)	;;
@@ -24,6 +32,8 @@  do
 		suffix_under=$(echo "$suffix_minus" | sed -e 's/-/_/g')
 		suffix_short=$(echo "$suffix_minus" | sed -e 's/-server/srv/g')
 
+		echo "II: build $package for $flavour $archs"
+
 		# debian/rules.gen
 		{
 			echo ""
@@ -81,5 +91,48 @@  Description: Linux kernel nvidia modules for version @ABI@
  also installed.
 
 EOL
+		# debian/control.d/migrate-nvidia
+		for cmd in $extra
+		do
+			case "$cmd" in
+			transition=*)
+				from="${cmd#transition=}"
+				from_minus=$(echo "$from" | sed -e 's/nvidia-graphics-drivers-//')
+				echo "II: general transition $from -> $package ($from_minus -> $suffix_minus)"
+				cat - >>"debian/control.d/migrate-nvidia" <<EOL
+Package: linux-modules-nvidia-${from_minus}-${flavour}\${variant:suffix}
+Architecture: ${archs}
+Section: oldlibs
+Depends: linux-modules-nvidia-${suffix_minus}-${flavour}\${variant:suffix}
+Description: Extra drivers for nvidia-${from_minus} for the ${flavour} flavour (dummy transitional package)
+ Transitional package for upgrades of -${from_minus} to -${suffix_minus}.
+
+EOL
+				;;
+			esac
+				#suffix_minus=$(echo "$package" | sed -e 's/nvidia-graphics-drivers-//')
+				#suffix_under=$(echo "$suffix_minus" | sed -e 's/-/_/g')
+				#suffix_short=$(echo "$suffix_minus" | sed -e 's/-server/srv/g')
+		done
 	done <"debian/dkms-versions"
 done <"debian/package.config"
+
+while read command from to archs
+do
+	case "$command" in
+	transitional)	;;
+	*)		continue ;;
+	esac
+
+	# debian/control.d/transitionals-local
+	echo "II: manual transition linux-modules-nvidia-$from -> linux-modules-nvidia-$to"
+	cat - >>"debian/control.d/transitionals-local" <<EOL
+Package: linux-modules-nvidia-${from}
+Architecture: ${archs}
+Section: oldlibs
+Depends: linux-modules-nvidia-${to}
+Description: Extra drivers for nvidia-${from} (dummy transitional package)
+ Transitional package for upgrades of ${from} to ${to}.
+
+EOL
+done <"debian/package.config"