Control: tags -1 + patch

On Wed, 23 Apr 2025 at 15:59:00 +0100, Simon McVittie wrote:
I think the "option 2" that I proposed is entirely feasible for trixie,
actually. I'm testing an implementation now.

https://salsa.debian.org/xorg-team/lib/mesa/-/merge_requests/55 works successfully on my Intel system. I haven't verified that it results in co-installable Mesa for armel + armhf, but it should (it makes each pair of architectures essentially equivalent to any other pair).

Patch attached here for convenience; if I see a maintainer response on the MR, I will assume that the MR is canonical and stop sending updated patches to the bug.

Or if the mesa maintainers think the change I'm proposing is too intrusive at this stage of the release process, the other possibilities I see here would be:

- drop the severity, with the justification that this is a Policy violation, but maybe not a bad enough Policy violation to qualify as a "serious" one, since dpkg correctly detects the conflict and prevents file loss, and multiarch armel + armhf systems are presumably rare in
  practice

- or ask the release team for a trixie-ignore tag

For forky, it might be a good idea to talk to Mesa upstream about whether Mesa's Vulkan drivers can be made to behave more like its Vulkan layers and EGL driver, generating JSON manifests that have simple names like `virtio_icd.json` and contain a simple basename like `"library_path": "libvulkan_virtio.so"`. But I think that's out of scope for trixie.

Thanks,
    smcv
>From 82eed41b2456c20eac16f86456a8c583753a94f2 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 23 Apr 2025 15:27:11 +0100
Subject: [PATCH] Share a single JSON manifest per Vulkan driver between all
 architectures

Because our Vulkan driver libraries are installed to a directory in the
dynamic linker's search path, we can list them in their JSON manifest
by the library's basename rather than its absolute path. This makes the
content of the JSON manifest the same for each architecture, so it can
be a single file shared between architectures via dpkg's multiarch file
reference-counting.

This avoids multiarch file collisions between pairs of architectures
that have the same Meson CPU name but a different library directory,
such as armel and armhf.

The JSON manifests for Mesa's EGL driver and Vulkan layers, and for the
Nvidia proprietary driver's Vulkan driver, are already implemented
this way.

Closes: #980148
Signed-off-by: Simon McVittie <s...@debian.org>
---
 debian/merge-vulkan-driver-manifests.sh | 37 +++++++++++++++++++++++++
 debian/rules                            |  1 +
 2 files changed, 38 insertions(+)
 create mode 100755 debian/merge-vulkan-driver-manifests.sh

diff --git a/debian/merge-vulkan-driver-manifests.sh b/debian/merge-vulkan-driver-manifests.sh
new file mode 100755
index 00000000000..199867ccc05
--- /dev/null
+++ b/debian/merge-vulkan-driver-manifests.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright 2025 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+# Usage: debian/merge-vulkan-driver-manifests.sh debian/tmp
+# DEB_HOST_MULTIARCH must be set in the environment.
+#
+# If the JSON manifest describing a Vulkan driver contains for example
+# "library_path": "/usr/lib/x86_64-linux-gnu/libvulkan_lvp.so"
+# then replace it with
+# "library_path": "libvulkan_lvp.so"
+# to get the same content for each architecture, and rename from for example
+# "lvp_icd.x86_64.json"
+# to
+# "lvp_icd.json"
+# so that the same JSON manifest will be shared between all multiarch
+# architectures.
+#
+# This avoids multiarch collisions on pairs of architectures where the
+# Meson CPU name is the same but the library path is different, notably
+# armel/armhf. https://bugs.debian.org/980148
+
+set -eu
+
+DESTDIR="$1"
+
+for file in "$DESTDIR"/usr/share/vulkan/icd.d/*.*.json; do
+	if grep -q 'library_path.*/usr/lib/'"${DEB_HOST_MULTIARCH}"'/lib[^/"]*\.so' "${file}"; then
+		replacement="${file%.*.json}.json"
+		sed -E -e '/library_path/ s,/usr/lib/'"${DEB_HOST_MULTIARCH}"'/(lib[^/"]*\.so),\1,' \
+			< "${file}" > "${replacement}"
+		diff -s -u "${file}" "${replacement}" || true
+		rm "${file}"
+	else
+		echo "multiarch library path not found in $file, leaving it as-is"
+	fi
+done
diff --git a/debian/rules b/debian/rules
index d3b86c8d8bb..0bf26148ec4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -233,6 +233,7 @@ override_dh_auto_configure: rewrite_wrap_files
 
 override_dh_auto_install:
 	dh_auto_install
+	debian/merge-vulkan-driver-manifests.sh debian/tmp
 	for file in debian/*.links.in; \
 	do \
 		sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
-- 
2.49.0

Reply via email to