APPLIED [OEM-5.17] Re: [JAMMY/linux-restricted-modules-oem-5.17|intel-iotg][PATCH] UBUNTU: [Packaging] LRMv6: add multi-architecture support

Timo Aaltonen tjaalton at ubuntu.com
Tue Jun 28 11:05:23 UTC 2022


On 17.6.2022 18.09, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1968774
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> ---
> 
>   This patch upgrades LRMv5.2 to LRMv6.0 in:
>   - jammy/linux-restricted-modules-oem-5.17
>   - jammy/linux-restricted-modules-intel-iotg
> 
>   To update packaging to feature parity with LRM jammy generic.
> 
>   debian/lrm-version           |  2 +-
>   debian/scripts/gen-rules     |  1 +
>   debian/scripts/gen-rules.lrg | 43 ++++++++++++++++++++++++++---
>   debian/scripts/gen-rules.lrm | 53 ++++++++++++++++++++++++++++++------
>   debian/scripts/gen-rules.lrs | 12 ++++++++
>   5 files changed, 97 insertions(+), 14 deletions(-)
> 
> diff --git a/debian/lrm-version b/debian/lrm-version
> index ef425ca982..e0ea36feef 100644
> --- a/debian/lrm-version
> +++ b/debian/lrm-version
> @@ -1 +1 @@
> -5.2
> +6.0
> diff --git a/debian/scripts/gen-rules b/debian/scripts/gen-rules
> index 48944818a8..c5c36a60e8 100755
> --- a/debian/scripts/gen-rules
> +++ b/debian/scripts/gen-rules
> @@ -1,4 +1,5 @@
>   #!/bin/bash
> +set -e
>   
>   src_package=$(LC_ALL=C dpkg-parsechangelog -SSource)
>   case "$src_package" in
> diff --git a/debian/scripts/gen-rules.lrg b/debian/scripts/gen-rules.lrg
> index 61ad057804..db613272ae 100755
> --- a/debian/scripts/gen-rules.lrg
> +++ b/debian/scripts/gen-rules.lrg
> @@ -1,4 +1,15 @@
>   #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> +	[ "$#" = "2" ]
> +	local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> +	if [ "$duplicates" ]; then
> +		echo "EE: duplicate values in $1" 1>&2
> +		exit 1
> +	fi
> +}
>   
>   # Pick out relevant version and package information including our predecessor
>   # packages: linux -> linux-restricted-modules-signatures -> linux-restricted-modules
> @@ -58,6 +69,7 @@ do
>   	*)		continue ;;
>   	esac
>   
> +	validate_unique "archs" "$archs"
>   	for arch in $archs
>   	do
>   		case " $build_archs " in
> @@ -66,8 +78,6 @@ do
>   		esac
>   	done
>   
> -	targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
> -
>   	while read package version extra
>   	do
>   		case "$package" in
> @@ -87,14 +97,39 @@ do
>   		*\ signonly\ *)		continue ;;
>   		esac
>   
> +		# If package specifies arch= keys, only build it on
> +		# the intersection of kernel flavour arches & the
> +		# package arches, otherwise build for all kernel
> +		# flavour arches.
> +		pkg_archs=
> +		for cmd in $extra
> +		do
> +			case "$cmd" in
> +			arch=*) pkg_archs="$pkg_archs ${cmd#arch=}" ;;
> +			esac
> +		done
> +		# No package arches set, build for everything
> +		if [ -z "$pkg_archs" ]; then
> +			pkg_archs=$archs
> +		else
> +			# Package arches set, build for intersection
> +			validate_unique "pkg_archs" "$pkg_archs"
> +			pkg_archs=$(sort <(echo $archs | tr " " "\n") <(echo $pkg_archs | tr " " "\n") | uniq -d | tr "\n" " ")
> +			# No intersection, skip
> +			if [ -z "$pkg_archs" ]; then
> +				continue
> +			fi
> +		fi
> +
> +		targets=$(echo "$pkg_archs" | sed -e 's/\</nvidia-/g')
>   		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')
>   
> -		echo "II: build $package for $flavour $archs"
> +		echo "II: build $package for $flavour $pkg_archs"
>   
>   		cat - >>"debian/control.interlock-up" <<EOL
> - linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour} (>= ${src_lrm_version}) [${archs}],
> + linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour} (>= ${src_lrm_version}) [${pkg_archs}],
>   EOL
>   
>   		# debian/rules.gen
> diff --git a/debian/scripts/gen-rules.lrm b/debian/scripts/gen-rules.lrm
> index 574a00ec3a..223918f50a 100755
> --- a/debian/scripts/gen-rules.lrm
> +++ b/debian/scripts/gen-rules.lrm
> @@ -1,4 +1,15 @@
>   #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> +	[ "$#" = "2" ]
> +	local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> +	if [ "$duplicates" ]; then
> +		echo "EE: duplicate values in $1" 1>&2
> +		exit 1
> +	fi
> +}
>   
>   # Pick out relevant version and package information including our predecessor
>   # packages: linux -> linux-restricted-modules-signatures -> linux-restricted-modules
> @@ -70,8 +81,7 @@ do
>   	*)		continue ;;
>   	esac
>   
> -	targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
> -
> +	validate_unique "archs" "$archs"
>   	cat - >>"debian/control.interlock-up" <<EOL
>    linux-headers-${src_abi}-${flavour} (>= @VERSION@) [${archs}],
>   EOL
> @@ -95,11 +105,36 @@ EOL
>   		*\ signonly\ *)		continue ;;
>   		esac
>   
> +		# If package specifies arch= keys, only build it on
> +		# the intersection of kernel flavour arches & the
> +		# package arches, otherwise build for all kernel
> +		# flavour arches.
> +		pkg_archs=
> +		for cmd in $extra
> +		do
> +			case "$cmd" in
> +			arch=*)		pkg_archs="$pkg_archs ${cmd#arch=}" ;;
> +			esac
> +		done
> +		# No package arches set, build for everything
> +		if [ -z "$pkg_archs" ]; then
> +			pkg_archs=$archs
> +		else
> +			# Package arches set, build for intersection
> +			validate_unique "pkg_archs" "$pkg_archs"
> +			pkg_archs=$(sort <(echo $archs | tr " " "\n") <(echo $pkg_archs | tr " " "\n") | uniq -d | tr "\n" " ")
> +			# No intersection, skip
> +			if [ -z "$pkg_archs" ]; then
> +				continue
> +			fi
> +		fi
> +
> +		targets=$(echo "$pkg_archs" | sed -e 's/\</nvidia-/g')
>   		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')
>   
> -		echo "II: build $package for $flavour $archs"
> +		echo "II: build $package for $flavour $pkg_archs"
>   
>   		# debian/rules.gen
>   		cat - >>"debian/rules.gen" <<EOL
> @@ -126,7 +161,7 @@ EOL
>   
>   Package: linux-modules-nvidia-${suffix_minus}-${flavour}\${variant:suffix}
>   Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
>   Section: kernel
>   Provides: \${dkms:nvidia-${suffix_minus}-modules}, nvidia-prebuilt-kernel
>   Depends:
> @@ -142,7 +177,7 @@ EOL
>   
>   Package: linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour}
>   Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
>   Section: kernel
>   Priority: optional
>   Built-Using: \${linux:BuiltUsing}
> @@ -160,7 +195,7 @@ Description: Linux kernel nvidia modules for version ${src_abi} (objects)
>   
>   Package: linux-modules-nvidia-${suffix_minus}-${src_abi}-${flavour}
>   Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
>   Section: kernel
>   Priority: optional
>   Built-Using: \${linux:BuiltUsing}
> @@ -187,11 +222,11 @@ EOL
>   			transition=*)
>   				from="${cmd#transition=}"
>   				from_minus=$(echo "$from" | sed -e 's/nvidia-graphics-drivers-//')
> -				echo "II: general transition $from -> $package ($from_minus -> $suffix_minus)"
> +				echo "II: general transition $from -> $package ($from_minus -> $suffix_minus) $pkg_archs"
>   				cat - >>"debian/control.d/migrate-nvidia" <<EOL
>   
>   Package: linux-modules-nvidia-${from_minus}-${flavour}\${variant:suffix}
> -Architecture: ${archs}
> +Architecture: ${pkg_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)
> @@ -214,7 +249,7 @@ do
>   	esac
>   
>   	# debian/control.d/transitionals-local
> -	echo "II: manual transition linux-modules-nvidia-$from -> linux-modules-nvidia-$to"
> +	echo "II: manual transition linux-modules-nvidia-$from -> linux-modules-nvidia-$to $archs"
>   	cat - >>"debian/control.d/transitionals-local" <<EOL
>   
>   Package: linux-modules-nvidia-${from}
> diff --git a/debian/scripts/gen-rules.lrs b/debian/scripts/gen-rules.lrs
> index c28fc2f66b..e2ab3a1493 100755
> --- a/debian/scripts/gen-rules.lrs
> +++ b/debian/scripts/gen-rules.lrs
> @@ -1,4 +1,15 @@
>   #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> +	[ "$#" = "2" ]
> +	local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> +	if [ "$duplicates" ]; then
> +		echo "EE: duplicate values in $1" 1>&2
> +		exit 1
> +	fi
> +}
>   
>   # Pick out relevant version and package information including our predecessor
>   # packages: linux-restricted-generate -> linux-restricted-signatures -> linux-restricted-modules
> @@ -57,6 +68,7 @@ do
>   	*)		continue ;;
>   	esac
>   
> +	validate_unique "archs" "$archs"
>   	targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
>   
>   	echo "II: build linux-signatures-nvidia-${src_abi}-${flavour} for ${archs}"


-- 
t



More information about the kernel-team mailing list