[JAMMY][UNSTABLE][LRM][PATCH 3/3] UBUNTU: [Packaging] Validate dkms-versions package.config arch settings
Dimitri John Ledkov
dimitri.ledkov at canonical.com
Mon Mar 21 10:59:48 UTC 2022
dkms-versions lines and package.config lines must specify unique sets
of architectures to build packages on. Enforce that with explicit
validation at source package preparation time.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
debian/scripts/gen-rules.lrg | 12 ++++++++++++
debian/scripts/gen-rules.lrm | 12 ++++++++++++
debian/scripts/gen-rules.lrs | 11 +++++++++++
3 files changed, 35 insertions(+)
diff --git a/debian/scripts/gen-rules.lrg b/debian/scripts/gen-rules.lrg
index 264b21429d..db613272ae 100755
--- a/debian/scripts/gen-rules.lrg
+++ b/debian/scripts/gen-rules.lrg
@@ -1,6 +1,16 @@
#!/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
src_package=$(LC_ALL=C dpkg-parsechangelog -SSource)
@@ -59,6 +69,7 @@ do
*) continue ;;
esac
+ validate_unique "archs" "$archs"
for arch in $archs
do
case " $build_archs " in
@@ -102,6 +113,7 @@ do
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
diff --git a/debian/scripts/gen-rules.lrm b/debian/scripts/gen-rules.lrm
index dc414efe2b..223918f50a 100755
--- a/debian/scripts/gen-rules.lrm
+++ b/debian/scripts/gen-rules.lrm
@@ -1,6 +1,16 @@
#!/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
src_package=$(LC_ALL=C dpkg-parsechangelog -SSource)
@@ -71,6 +81,7 @@ do
*) continue ;;
esac
+ validate_unique "archs" "$archs"
cat - >>"debian/control.interlock-up" <<EOL
linux-headers-${src_abi}-${flavour} (>= @VERSION@) [${archs}],
EOL
@@ -110,6 +121,7 @@ EOL
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
diff --git a/debian/scripts/gen-rules.lrs b/debian/scripts/gen-rules.lrs
index b3813365da..e2ab3a1493 100755
--- a/debian/scripts/gen-rules.lrs
+++ b/debian/scripts/gen-rules.lrs
@@ -1,6 +1,16 @@
#!/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
src_package=$(LC_ALL=C dpkg-parsechangelog -SSource)
@@ -58,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}"
--
2.32.0
More information about the kernel-team
mailing list