From 8a859ad6b9db3275101444316efbb9c9f6457805 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Mon, 28 Sep 2026 18:52:39 -0400 Subject: [PATCH] build: add kde plasma shell package script and smoke test --- tools/plasma/build.sh | 50 ++++++++++++++++++++++++++++++++++ tools/plasma/release.env | 9 ++++++ tools/plasma/seeds.txt | 15 ++++++++++ tools/plasma/smoke-test.sh | 56 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100755 tools/plasma/build.sh create mode 100644 tools/plasma/release.env create mode 100644 tools/plasma/seeds.txt create mode 100755 tools/plasma/smoke-test.sh diff --git a/tools/plasma/build.sh b/tools/plasma/build.sh new file mode 100755 index 0000000000..7a09a1449a --- /dev/null +++ b/tools/plasma/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Builds the KDE Plasma shell package: the closure of seeds.txt over Arch Linux ARM, as a zstd +# tarball that extracts over the rootfs, with the desktop package (LXQt) already in it. +# +# The closure and extraction are winlator-contents' own desktop/build-pkg.sh, pinned below, so this +# package is made exactly like the desktop one. What it leaves out is the runtime's packages (as the +# desktop does) plus the desktop package's - except Qt and the KDE libraries, which are shipped +# again: KWin and plasmashell use Qt's private API and must match the Qt they were built against. +# +# tools/plasma/build.sh +# +# Needs curl, git, tar, zstd, python3. +set -euo pipefail +out=${1:?out dir} +here=$(cd "$(dirname "$0")" && pwd) +. "$here/release.env" +work=$(mktemp -d) +mkdir -p "$out" + +git init -q "$work/contents" +git -C "$work/contents" fetch -q --depth 1 https://github.com/The412Banner/winlator-contents.git "$CONTENTS_REF" +git -C "$work/contents" checkout -q FETCH_HEAD + +curl -fsSL --retry 6 --retry-delay 5 --retry-all-errors -o "$work/desktop.packages.txt" "$DESKTOP_PACKAGES_URL" + +# Package names from the desktop's file list (name-pkgver-pkgrel-arch.pkg.tar.xz); the ones Plasma +# must bring in its own build are not counted as present. +python3 - "$work/desktop.packages.txt" > "$work/desktop-names.txt" <<'PY' +import re, sys +keep = re.compile(r"^(qt6-|layer-shell-qt|kf6-|kwayland|plasma|breeze|kde|libplasma|kirigami|kpipewire|kscreenlocker|kglobalacc)") +for line in open(sys.argv[1]): + line = line.strip() + if not line: continue + name = line.rsplit("-", 3)[0] + if not keep.match(name): print(name) +PY +cat "$work/contents/desktop/base-packages.txt" "$work/desktop-names.txt" | sort -u > "$work/present.txt" +echo "== plasma: $(wc -l < "$work/present.txt") packages counted as present (runtime + desktop, less Qt/KDE)" + +bash "$work/contents/desktop/build-pkg.sh" plasma "$here/seeds.txt" "$work/present.txt" "$out" + +# What this package replaces from the desktop's: printed so a Qt bump is never a surprise. +python3 - "$work/desktop.packages.txt" "$out/plasma.packages.txt" <<'PY' +import sys +def names(p): return {l.strip().rsplit("-", 3)[0]: l.strip() for l in open(p) if l.strip()} +d, p = names(sys.argv[1]), names(sys.argv[2]) +for n in sorted(set(d) & set(p)): + if d[n] != p[n]: print("== replaces", d[n], "->", p[n]) +PY +rm -rf "$work" diff --git a/tools/plasma/release.env b/tools/plasma/release.env new file mode 100644 index 0000000000..f3560fb7b9 --- /dev/null +++ b/tools/plasma/release.env @@ -0,0 +1,9 @@ +# What the Plasma package is built on and tested against. +# winlator-contents at the commit whose desktop/build-pkg.sh and base-packages.txt are used. +CONTENTS_REF=843e9c7dcdf52260993ee9f23c33a2e17acb5e20 +DESKTOP_PACKAGES_URL=https://github.com/The412Banner/winlator-contents/releases/download/steamdeck-desktop-r1/desktop.packages.txt +# The runtime and desktop package the smoke test installs it over (linuxfs.json, desktop.json). +RUNTIME_URL=https://github.com/The412Banner/winlator-contents/releases/download/linuxfs-r9/linuxfs.tar.zst +RUNTIME_SHA256=d3240c1531531615b0dd06b6ad56e92db9015a8641eb18c3a613835ae45992e7 +DESKTOP_URL=https://github.com/The412Banner/winlator-contents/releases/download/steamdeck-desktop-r1/desktop.tar.zst +DESKTOP_SHA256=c2bb860b3b1688287451e2495be5db313ec07f8c8af501dfac2768a9f417bc86 diff --git a/tools/plasma/seeds.txt b/tools/plasma/seeds.txt new file mode 100644 index 0000000000..21e972304d --- /dev/null +++ b/tools/plasma/seeds.txt @@ -0,0 +1,15 @@ +# KDE Plasma as a second desktop shell: KWin nested as a client of the app's compositor, with +# plasmashell's panel and desktop on it. Installed over the desktop package (LXQt), which keeps +# Xwayland, Firefox, mpv and the launchers; this only adds the shell and its everyday apps. +# One package name per line; the closure over Arch Linux ARM is taken at build time. +kwin +plasma-workspace +plasma-desktop +plasma-pa +breeze +breeze-icons +kde-cli-tools +xdg-desktop-portal-kde +systemsettings +dolphin +konsole diff --git a/tools/plasma/smoke-test.sh b/tools/plasma/smoke-test.sh new file mode 100755 index 0000000000..14081ec981 --- /dev/null +++ b/tools/plasma/smoke-test.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Installs the Plasma package the way the app does - runtime, then the desktop package, then this +# one, each extracted over the last - and checks that its programs load in that rootfs: every +# library they link resolves (with the runtime's glibc), and KWin and plasmashell start far enough +# to print their versions. Runs on an arm64 host; needs sudo for chroot. +# +# tools/plasma/smoke-test.sh +set -euo pipefail +pkg=$(realpath "${1:?plasma.tar.zst}") +here=$(cd "$(dirname "$0")" && pwd) +. "$here/release.env" +work=$(mktemp -d) +root=$work/root +mkdir -p "$root" + +fetch() { # url sha256 out + curl -fsSL --retry 6 --retry-delay 5 --retry-all-errors -o "$3" "$1" + echo "$2 $3" | sha256sum -c - +} +fetch "$RUNTIME_URL" "$RUNTIME_SHA256" "$work/runtime.tar.zst" +fetch "$DESKTOP_URL" "$DESKTOP_SHA256" "$work/desktop.tar.zst" +for t in "$work/runtime.tar.zst" "$work/desktop.tar.zst" "$pkg"; do + sudo tar --zstd -xf "$t" -C "$root" +done +rm -f "$work/runtime.tar.zst" "$work/desktop.tar.zst" + +fail=0 +for bin in usr/bin/kwin_wayland usr/bin/plasmashell usr/bin/dolphin usr/bin/konsole usr/bin/systemsettings; do + [ -e "$root/$bin" ] || { echo "MISSING /$bin"; fail=1; } +done +ls "$root"/usr/lib/startplasma-waylandsession "$root"/usr/lib*/libexec/startplasma-waylandsession 2>/dev/null \ + || echo "note: no startplasma-waylandsession; the launcher starts plasmashell itself" + +# Every ELF the package added, checked with the rootfs's own loader. +tar --zstd -tf "$pkg" | sed -n 's#^\./##; /^usr\/\(bin\|lib\)\/.*[^/]$/p' > "$work/files.txt" +: > "$work/unresolved.txt" +while read -r f; do + [ -f "$root/$f" ] && [ ! -L "$root/$f" ] || continue + head -c 4 "$root/$f" | grep -q $'\x7fELF' || continue + sudo chroot "$root" /usr/bin/ldd "/$f" 2>&1 | grep -E "not found" | sed "s#^#/$f: #" >> "$work/unresolved.txt" || true +done < "$work/files.txt" +if [ -s "$work/unresolved.txt" ]; then + echo "== unresolved libraries or symbol versions:" + sort -u "$work/unresolved.txt" | head -80 + fail=1 +else + echo "== every library in the package resolves in the runtime" +fi + +for prog in kwin_wayland plasmashell; do + if sudo chroot "$root" /usr/bin/env -i PATH=/usr/bin HOME=/root QT_QPA_PLATFORM=offscreen "/usr/bin/$prog" --version; then :; else + echo "FAILED: $prog --version"; fail=1 + fi +done +sudo rm -rf "$work" +exit $fail