mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-02 18:06:16 +00:00
fix(arch-package): depend on libxkbcommon-x11, without which the window can't open
The apps build winit's X11 backend, and the Craft apps' winit (storytold/winit a517b38)
loads libxkbcommon-x11 when it sets up the keyboard on X11 or XWayland: without it the app
panics at start ("Library libxkbcommon-x11.so could not be loaded"). Arch ships it as its own
package, apart from libxkbcommon, and the package only depended on libxkbcommon, so on a
system without it (a fresh install, a minimal or Wayland-first desktop) every Craft app's
Arch package started and couldn't open its window. PhotoCraft hit the same panic on its deb
(photocraft#201) and fixed its own nfpm.yaml; the shared Arch package never got it.
libxkbcommon-x11 is now in depends. A test checks the generated PKGBUILD.
Checked on a clean archlinux container with a Craft app's release tarball, under Xvfb: the
package built by main installs without libxkbcommon-x11 and the window fails with that error;
the one built with this change pulls in libxkbcommon-x11 1.13.2 and the window runs. The
unit tests pass on Ubuntu 24.04 as in test-freebsd.yml (155, 28 skipped), and test_arch
passes on Arch with makepkg, end-to-end build included; shellcheck is clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -181,6 +181,9 @@ COMPRESSZST=(zstd -c -T0 --ultra -20 -)
|
||||
EOF
|
||||
|
||||
# Write PKGBUILD
|
||||
# libxkbcommon-x11 is a hard dependency next to libxkbcommon: the apps build winit's X11 backend,
|
||||
# which loads it at startup on X11 and XWayland, and panics without it ("Library
|
||||
# libxkbcommon-x11.so could not be loaded"; photocraft#201). Arch packages it separately.
|
||||
cat > "$work/PKGBUILD" <<EOF
|
||||
# Maintainer: Storyteller Authors
|
||||
pkgname=$(printf '%q' "$pkgname")
|
||||
@@ -190,7 +193,7 @@ pkgdesc=$(printf '%q' "$pkgdesc")
|
||||
arch=($(printf '%q' "$arch"))
|
||||
url=$(printf '%q' "$url")
|
||||
license=($license_str)
|
||||
depends=('glibc' 'gcc-libs' 'hicolor-icon-theme' 'libxkbcommon' 'vulkan-icd-loader')
|
||||
depends=('glibc' 'gcc-libs' 'hicolor-icon-theme' 'libxkbcommon' 'libxkbcommon-x11' 'vulkan-icd-loader')
|
||||
optdepends=(
|
||||
'alsa-lib: sound support'
|
||||
'pipewire-alsa: audio playback and recording via PipeWire'
|
||||
|
||||
@@ -210,6 +210,29 @@ exit 0
|
||||
)
|
||||
self.assertIn("provides=(myapp=1.2.3-2)", pkgbuild)
|
||||
|
||||
def test_pkgbuild_depends_on_the_x11_keyboard_library(self):
|
||||
# winit's X11 backend loads libxkbcommon-x11 at startup and panics without it, and Arch
|
||||
# ships it apart from libxkbcommon: a package without it could not open its window on
|
||||
# X11 or XWayland.
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir)
|
||||
tarball = self._create_fixture_tarball(tmp_path)
|
||||
tools = self._setup_mock_tools(tmp_path)
|
||||
capture = tmp_path / "capture"
|
||||
capture.mkdir()
|
||||
res = subprocess.run(
|
||||
[str(ARCH_SCRIPT), str(tarball), "x86_64", str(tmp_path / "out")],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env={**os.environ, "PATH": f"{tools}:{os.environ['PATH']}", "MOCK_CAPTURE": str(capture)},
|
||||
)
|
||||
self.assertEqual(res.returncode, 0, f"{res.stderr}\n{res.stdout}")
|
||||
depends = next(
|
||||
line for line in (capture / "PKGBUILD").read_text().splitlines() if line.startswith("depends=(")
|
||||
)
|
||||
for package in ("'libxkbcommon'", "'libxkbcommon-x11'"):
|
||||
self.assertIn(package, depends)
|
||||
|
||||
def test_package_function_rejects_symlinked_license_dir(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir)
|
||||
|
||||
Reference in New Issue
Block a user