From e4b673581877f4e9492424025b1f6f2d68f91c50 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 28 Nov 2026 22:51:50 -0500 Subject: [PATCH] fix(packaging): align Linux nightly tarball and Arch handoff and re-enable all 6 Linux formats (#4888) --- .github/nightly-signing-policy.json | 8 ++++ .github/workflows/nightly.yml | 1 + docs/nightly-signing-policy.example.json | 8 ++++ packaging/linux/flatpak-bundle.sh | 54 +++++++++--------------- packaging/linux/nightly-arch-tar-test.sh | 27 ++++-------- packaging/linux/nightly-arch-tar.sh | 31 +++----------- packaging/linux/package.sh | 8 ++-- 7 files changed, 56 insertions(+), 81 deletions(-) diff --git a/.github/nightly-signing-policy.json b/.github/nightly-signing-policy.json index 2b550683c7..b667644f60 100644 --- a/.github/nightly-signing-policy.json +++ b/.github/nightly-signing-policy.json @@ -93,6 +93,14 @@ }, "linux-x86_64": { "unsigned_artifact_name": "nightly-unsigned-linux-x86_64", + "package_formats": [ + "appimage", + "arch", + "deb", + "flatpak", + "oci", + "rpm" + ], "trust": { "fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED" } diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ccc5e512da..6df7c3ebc6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -32,3 +32,4 @@ jobs: # craft-common-actions main commit that merged the exact-analysis admission (#371, after #370, # #369 and #364). platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]' + linux-package-formats: '["deb","rpm","appimage","flatpak","oci","arch"]' diff --git a/docs/nightly-signing-policy.example.json b/docs/nightly-signing-policy.example.json index ab36aa308a..650cb1de71 100644 --- a/docs/nightly-signing-policy.example.json +++ b/docs/nightly-signing-policy.example.json @@ -40,6 +40,14 @@ }, "linux-x86_64": { "unsigned_artifact_name": "nightly-unsigned-linux-x86_64", + "package_formats": [ + "appimage", + "arch", + "deb", + "flatpak", + "oci", + "rpm" + ], "trust": { "fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED" } diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh index 30a7d91819..8e9315e0a4 100755 --- a/packaging/linux/flatpak-bundle.sh +++ b/packaging/linux/flatpak-bundle.sh @@ -57,20 +57,13 @@ WORK="$CARGO_TARGET_DIR/flatpak-bundle" rm -rf "$WORK" mkdir -p "$WORK/stage" tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1 -# Stable ships bin/lightcraft; a Nightly tar ships its launchers in bin/ and the real binaries in -# lib/lightcraft-nightly (packaging/linux/package.sh stage_nightly). -[[ -x "$WORK/stage/bin/lightcraft" || -x "$WORK/stage/lib/lightcraft-nightly/lightcraft" ]] \ - || { echo "error: $TARBALL has no LightCraft binary" >&2; exit 1; } +[[ -x "$WORK/stage/bin/lightcraft" && -x "$WORK/stage/bin/lightcraft-cli" ]] \ + || { echo "error: $TARBALL has no bin/lightcraft or bin/lightcraft-cli" >&2; exit 1; } if [[ "$FLATPAK_ID" != "$APP_ID" ]]; then - gui="$WORK/stage/lib/lightcraft-nightly/lightcraft" - cli="$WORK/stage/lib/lightcraft-nightly/lightcraft-cli" - [[ -x "$gui" && -x "$cli" ]] \ - || { echo "error: $TARBALL is not a Nightly tar (no lib/lightcraft-nightly binaries); pass the -nightly- tarball from package.sh" >&2; exit 1; } # The bundle installs the real binaries in /app/libexec and its own wrappers in /app/bin: inside # the sandbox the Nightly Flatpak id isolates the data, and the profile keeps it explicit. - mv "$gui" "$WORK/stage/bin/lightcraft-bin" - mv "$cli" "$WORK/stage/bin/lightcraft-cli-bin" - rm -rf "$WORK/stage/lib" "$WORK/stage/bin/lightcraft-nightly" "$WORK/stage/bin/lightcraft-nightly-cli" + mv "$WORK/stage/bin/lightcraft" "$WORK/stage/bin/lightcraft-bin" + mv "$WORK/stage/bin/lightcraft-cli" "$WORK/stage/bin/lightcraft-cli-bin" cat >"$WORK/stage/bin/lightcraft" <<'WRAPPER' #!/bin/sh set -eu @@ -92,31 +85,26 @@ if [ -z "${LIGHTCRAFT_LIBRARY+x}" ]; then export LIGHTCRAFT_LIBRARY="$profile/Li exec /app/libexec/lightcraft-cli "$@" WRAPPER chmod 755 "$WORK/stage/bin/lightcraft" "$WORK/stage/bin/lightcraft-cli" - # The tar names the desktop entry, the metainfo, the icon and the doc folder for the *window* id - # (…nightly-v1). The Flatpak id (…nightly) is the artifact id and owns them inside the sandbox; - # StartupWMClass stays on the window id the app really sets. - nightly_id="$APP_ID.nightly-v1" - sed -e "s#^Exec=lightcraft-nightly\([[:space:]]\|$\)#Exec=lightcraft\1#" \ - -e "s|^TryExec=lightcraft-nightly$|TryExec=lightcraft|" \ - -e "s|^Icon=.*|Icon=$FLATPAK_ID|" \ - "$WORK/stage/share/applications/$nightly_id.desktop" >"$WORK/stage/share/applications/$FLATPAK_ID.desktop" - rm -f "$WORK/stage/share/applications/$nightly_id.desktop" - sed -e "s|$nightly_id|$FLATPAK_ID|g" \ - -e "s|$nightly_id.desktop|$FLATPAK_ID.desktop|g" \ - -e "s|$nightly_id|$FLATPAK_ID|g" \ - "$WORK/stage/share/metainfo/$nightly_id.metainfo.xml" >"$WORK/stage/share/metainfo/$FLATPAK_ID.metainfo.xml" - rm -f "$WORK/stage/share/metainfo/$nightly_id.metainfo.xml" - # Nightly opens no files from the file manager: no MIME database, as in the tar. + # The Flatpak id (…nightly) is the artifact id and owns desktop, metainfo and icon inside the + # sandbox; StartupWMClass stays on the window id (…nightly-v1) the app really sets. + sed -e "s|^Icon=$APP_ID$|Icon=$FLATPAK_ID|" \ + -e "s|^Name=LightCraft$|Name=LightCraft Nightly|" \ + -e "s|^StartupWMClass=.*|StartupWMClass=$APP_ID.nightly-v1|" \ + -e '/^MimeType=/d' \ + "$WORK/stage/share/applications/$APP_ID.desktop" >"$WORK/stage/share/applications/$FLATPAK_ID.desktop" + rm -f "$WORK/stage/share/applications/$APP_ID.desktop" + sed -e "s|$APP_ID|$FLATPAK_ID|g" \ + -e "s|LightCraft|LightCraft Nightly|g" \ + -e "s|$APP_ID.desktop|$FLATPAK_ID.desktop|g" \ + -e "s|$APP_ID|$FLATPAK_ID|g" \ + "$WORK/stage/share/metainfo/$APP_ID.metainfo.xml" >"$WORK/stage/share/metainfo/$FLATPAK_ID.metainfo.xml" + rm -f "$WORK/stage/share/metainfo/$APP_ID.metainfo.xml" + # Nightly opens no files from the file manager: no MIME database. rm -rf "$WORK/stage/share/mime" - nightly_icon="$WORK/stage/share/icons/hicolor/256x256/apps/$nightly_id.png" - [[ -f "$nightly_icon" ]] || nightly_icon="$ROOT/assets/app-icon/lightcraft-nightly.png" + rm -rf "$WORK/stage/share/icons/hicolor" + nightly_icon="$ROOT/assets/app-icon/lightcraft-nightly.png" [[ -f "$nightly_icon" ]] || nightly_icon="$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png" install -Dm644 "$nightly_icon" "$WORK/stage/share/icons/hicolor/256x256/apps/$FLATPAK_ID.png" - rm -f "$WORK/stage/share/icons/hicolor/256x256/apps/$nightly_id.png" - if [[ -d "$WORK/stage/share/doc/lightcraft-nightly" ]]; then - # The manifest copies share/doc/lightcraft (the stable name). - mv "$WORK/stage/share/doc/lightcraft-nightly" "$WORK/stage/share/doc/lightcraft" - fi sed -e "s|ai\.storyteller\.lightcraft|$FLATPAK_ID|g" \ -e 's|- install -Dm755 bin/lightcraft /app/bin/lightcraft|- install -Dm755 bin/lightcraft-bin /app/libexec/lightcraft\n - install -Dm755 bin/lightcraft /app/bin/lightcraft|' \ -e 's|- install -Dm755 bin/lightcraft-cli /app/bin/lightcraft-cli|- install -Dm755 bin/lightcraft-cli-bin /app/libexec/lightcraft-cli\n - install -Dm755 bin/lightcraft-cli /app/bin/lightcraft-cli|' \ diff --git a/packaging/linux/nightly-arch-tar-test.sh b/packaging/linux/nightly-arch-tar-test.sh index 99501f1487..f7a84d6561 100755 --- a/packaging/linux/nightly-arch-tar-test.sh +++ b/packaging/linux/nightly-arch-tar-test.sh @@ -54,25 +54,16 @@ bin="$work/installed/bin" mv "$bin/lightcraft" "$bin/lightcraft-nightly" mv "$bin/lightcraft-cli" "$bin/lightcraft-nightly-cli" -# The packager installs the tree as it is: no stable id may be left to rename. -nightly_id=ai.storyteller.lightcraft.nightly-v1 +# Canonical ai.storyteller.lightcraft IDs stay intact so arch-package.sh performs the single +# nightly rename cleanly, while the hicolor icon payload is swapped to the Nightly badge icon. +app_id=ai.storyteller.lightcraft share="$work/extract/$base/share" -test -f "$share/applications/$nightly_id.desktop" -test ! -e "$share/applications/ai.storyteller.lightcraft.desktop" -grep -qx "StartupWMClass=$nightly_id" "$share/applications/$nightly_id.desktop" -grep -qx "Icon=$nightly_id" "$share/applications/$nightly_id.desktop" -# The installed command is lightcraft-nightly (the stable launcher is renamed by the packager): -# `Exec=lightcraft %F` would start the stable app from the Nightly menu entry, arguments intact. -grep -qx 'Exec=lightcraft-nightly %F' "$share/applications/$nightly_id.desktop" -# `! grep` is not a condition: errexit skips it, so a match would pass. Fail the assertion explicitly. -if grep -q '^MimeType=' "$share/applications/$nightly_id.desktop"; then - echo 'FAIL: the Nightly desktop file still declares MimeType' >&2 - exit 1 -fi -test -f "$share/metainfo/$nightly_id.metainfo.xml" -grep -q "$nightly_id" "$share/metainfo/$nightly_id.metainfo.xml" -grep -q "lightcraft-nightly" "$share/metainfo/$nightly_id.metainfo.xml" -test -f "$share/icons/hicolor/256x256/apps/$nightly_id.png" +test -f "$share/applications/$app_id.desktop" +test ! -e "$share/applications/$app_id.nightly-v1.desktop" +test -f "$share/metainfo/$app_id.metainfo.xml" +test ! -e "$share/metainfo/$app_id.nightly-v1.metainfo.xml" +test -f "$share/icons/hicolor/256x256/apps/$app_id.png" +cmp "$HERE/../../assets/app-icon/lightcraft-nightly.png" "$share/icons/hicolor/256x256/apps/$app_id.png" test ! -e "$stage/bin/.lightcraft-nightly" cmp "$stage/bin/lightcraft" "$bin/.lightcraft-nightly/lightcraft" diff --git a/packaging/linux/nightly-arch-tar.sh b/packaging/linux/nightly-arch-tar.sh index 4d317358a0..8240b51810 100755 --- a/packaging/linux/nightly-arch-tar.sh +++ b/packaging/linux/nightly-arch-tar.sh @@ -18,37 +18,16 @@ cp "$here/nightly-arch-launch.sh" "$stage/bin/lightcraft" cp "$here/nightly-arch-launch.sh" "$stage/bin/lightcraft-cli" chmod 755 "$stage/bin/lightcraft" "$stage/bin/lightcraft-cli" -# The packager installs this tree as it is, so the Nightly desktop entry, metainfo and icon are -# named for the Nightly channel here: leaving the stable ids would make them rename three files -# and would collide with a stable install's menu entry. +# Leave share/ at the canonical ai.storyteller.lightcraft IDs so arch-package.sh derives +# ai.storyteller.lightcraft.nightly and performs the nightly renames cleanly without double-suffixing. +# Swap the hicolor icon content to the Nightly badge under the canonical name so arch-package.sh +# renames it to ai.storyteller.lightcraft.nightly.png. app_id=ai.storyteller.lightcraft -nightly_id="$app_id.nightly-v1" -if [ -f "$stage/share/applications/$app_id.desktop" ]; then - # The packager renames the launchers to lightcraft-nightly(-cli) when it installs this tree, so the - # menu entry must name the installed command: `Exec=lightcraft` would start stable beside it. - sed -e 's#^Exec=lightcraft\([[:space:]]\|$\)#Exec=lightcraft-nightly\1#' \ - -e 's#^TryExec=lightcraft$#TryExec=lightcraft-nightly#' \ - -e "s|^Icon=$app_id$|Icon=$nightly_id|" \ - -e "s|^StartupWMClass=.*|StartupWMClass=$nightly_id|" \ - -e "s|^Name=LightCraft$|Name=LightCraft Nightly|" \ - -e '/^MimeType=/d' \ - "$stage/share/applications/$app_id.desktop" >"$stage/share/applications/$nightly_id.desktop" - rm -f "$stage/share/applications/$app_id.desktop" -fi -if [ -f "$stage/share/metainfo/$app_id.metainfo.xml" ]; then - sed -e "s|$app_id|$nightly_id|g" \ - -e "s|LightCraft|LightCraft Nightly|g" \ - -e "s|$app_id.desktop|$nightly_id.desktop|g" \ - -e "s|$app_id|$nightly_id|g" \ - -e "s|lightcraft|lightcraft-nightly|g" \ - "$stage/share/metainfo/$app_id.metainfo.xml" >"$stage/share/metainfo/$nightly_id.metainfo.xml" - rm -f "$stage/share/metainfo/$app_id.metainfo.xml" -fi if [ -d "$stage/share/icons/hicolor" ]; then nightly_icon="$here/../../assets/app-icon/lightcraft-nightly.png" if [ -f "$nightly_icon" ]; then rm -rf "$stage/share/icons/hicolor" - install -Dm644 "$nightly_icon" "$stage/share/icons/hicolor/256x256/apps/$nightly_id.png" + install -Dm644 "$nightly_icon" "$stage/share/icons/hicolor/256x256/apps/$app_id.png" fi fi tar -C "$work" -czf "$destination/$basename.tar.gz" "$basename" diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 30c1414f15..ccf4333a79 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -108,10 +108,11 @@ has() { case " $FORMATS " in *" $format "*) return 0 ;; *) return 1 ;; esac } -# ---- the Nightly FHS layout (the plain tar and the deb/rpm share it) ----------------------------- +# ---- the Nightly FHS layout (used by deb/rpm) --------------------------------------------------- # The real binaries move to usr/lib/lightcraft-nightly and usr/bin holds launchers: the GUI starts # through its launch profile, the headless CLI takes the same profile through its two host -# variables. One layout, so an unpacked tar, a .deb and a .rpm all behave the same. +# variables. The plain tar keeps the canonical $STAGE tree for CI's nightly smoke test, Arch +# side-by-side fixture, and Flatpak/OCI staging. stage_nightly() { local stage="$WORK/nightly-root" icon export NFPM_NAME="lightcraft-nightly" @@ -154,9 +155,8 @@ NIGHTLY_STAGE="" # ---- .tar.gz ------------------------------------------------------------------------------------ if has tar; then - TAR_SRC="${NIGHTLY_STAGE:-$STAGE}" mkdir -p "$WORK/tar" - cp -R "$TAR_SRC/usr" "$WORK/tar/$BASENAME" + cp -R "$STAGE/usr" "$WORK/tar/$BASENAME" tar -C "$WORK/tar" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME" echo "wrote $DIST/$BASENAME.tar.gz" fi