mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 15:21:17 -05:00
20c9bebb47
Closes every finding in the batch-1 review of our two commits: - main.rs: the version log line passed a call as an inline format argument (a compile error); it is now a positional argument. Same for the joined-flag test in launch_profile.rs. - profile_root.rs: the accepted Windows + FLATPAK_ID case creates the root, so the "a refused launch creates nothing" assertion could not hold; it is now made per refused case, and the accepted case cleans up after itself. - The updater is off in a Nightly: the runtime keeps no Updater unless os_window::stable_services_allowed(), tick/pump/start_pending_update return early without one, and Help > Check for Updates says ArtCraft Launcher manages the Nightly's updates instead of offering a stable release (whose records live in the stable app's folders the profile fence refuses). New test. - AppInfo.id stays "vectorcraft" in both channels (it is the craft-settings id a theme's [apps.<id>] pins key on); only name and version vary. New test. - A caught panic no longer clears the session record: nightly_session::release() drops the lease and keeps the record. New test. - The Nightly window title and drawn title bar carry "VectorCraft Nightly". New test. - .gitignore gains __pycache__/ (the producer checks for a clean tree). - nightly-signing-tests.ps1 names the real HEAD and run date, so Assert-NightlySource passes and the mocked compiler boundary is what stops the run. - eframe's persistence_path is a folder of its own (<profile>/eframe), not craft's window.json file; the docs stop claiming an app.ron is written today. Standard Nightly layout: `<app>` is the launcher and `<app>-bin` the GUI it starts, in every Linux format, through one launcher (packaging/linux/nightly-launch.sh, replacing the per-format heredocs and nightly-arch-launch.sh): tar vectorcraft/vectorcraft-bin, deb+rpm /usr/bin/vectorcraft-nightly + /usr/lib/vectorcraft-nightly/vectorcraft-bin, AppImage AppRun + usr/bin/vectorcraft-bin, Arch bin/vectorcraft + bin/.vectorcraft-nightly/vectorcraft-bin, Flatpak /app/bin/vectorcraft + /app/libexec/vectorcraft-bin. It finds the GUI from its own directory, adds --launch-profile nightly-v1 --profile-root ... --, and passes a version/help query, the Launcher's own invocation or a caller-written -- through untouched. New suite packaging/linux/nightly-launch-tests.py drives all five placements; the archive policy, its tests, the arch test and the docs follow the layout. The nightly deb/rpm tree also stops shipping stable's /usr/bin/vectorcraft-cli beside the nightly CLI. The Nightly tar ships the Nightly art instead of stable's icon. Deviation recorded in RESULT.md: the refusal message still goes to standard error rather than a native dialog (workspace denies unsafe_code, winsafe is wgpu-only, a dialog crate would change Cargo.lock; a modal box also risks hanging a headless run).
118 lines
5.7 KiB
Bash
Executable File
118 lines
5.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Repackage a VectorCraft Linux tarball as a single-file Flatpak bundle:
|
|
#
|
|
# $DIST/vectorcraft-<version>-linux-<arch>.flatpak
|
|
#
|
|
# Usage: packaging/linux/flatpak-bundle.sh [--no-test] [TARBALL]
|
|
#
|
|
# TARBALL defaults to $DIST/vectorcraft-<version>-linux-<arch>.tar.gz from package.sh. The bundle
|
|
# is built for the host architecture (x86_64 or aarch64), which must match the tarball's.
|
|
# Needs flatpak, flatpak-builder and the SVG pixbuf loader (librsvg2-common) for the host's
|
|
# `appstreamcli compose`; the freedesktop runtime and SDK named in the manifest are
|
|
# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and
|
|
# `vectorcraft-cli --version` is run inside the sandbox as a smoke test.
|
|
# Manifest: packaging/linux/flatpak/ai.storyteller.vectorcraft.bundle.yml.
|
|
set -euo pipefail
|
|
# shellcheck source=../env.sh
|
|
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
|
|
HERE="$ROOT/packaging/linux"
|
|
APP_ID=ai.storyteller.vectorcraft
|
|
FLATPAK_ID="$APP_ID"
|
|
# The remote indexes both app IDs on the stable ref branch; IDs isolate installations.
|
|
FLATPAK_BRANCH=stable
|
|
if [[ "${VECTORCRAFT_BUILD_CHANNEL:-}" == nightly-v1 || "$VERSION" == *-nightly* ]]; then
|
|
FLATPAK_ID="$APP_ID.nightly"
|
|
fi
|
|
FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
|
|
|
|
TEST=1
|
|
OCI=0
|
|
TARBALL=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--no-test) TEST=0; shift ;;
|
|
--oci) OCI=1; shift ;;
|
|
-h | --help) sed -n '2,14p' "$0"; exit 0 ;;
|
|
-*) echo "unknown argument: $1" >&2; exit 2 ;;
|
|
*) TARBALL="$1"; shift ;;
|
|
esac
|
|
done
|
|
|
|
ARCH="$(uname -m)"
|
|
case "$ARCH" in
|
|
x86_64) ;;
|
|
aarch64 | arm64) ARCH=aarch64 ;;
|
|
*) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
|
|
esac
|
|
if [[ "$FLATPAK_ID" != "$APP_ID" && "$VERSION" != *-nightly* ]]; then
|
|
BASENAME="vectorcraft-$VERSION-nightly-linux-$ARCH"
|
|
else
|
|
BASENAME="vectorcraft-$VERSION-linux-$ARCH"
|
|
fi
|
|
TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}"
|
|
[[ -f "$TARBALL" ]] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; }
|
|
for tool in flatpak flatpak-builder; do
|
|
command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder librsvg2-common)" >&2; exit 1; }
|
|
done
|
|
|
|
echo "==> VectorCraft $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL")"
|
|
|
|
WORK="$CARGO_TARGET_DIR/flatpak-bundle"
|
|
rm -rf "$WORK"
|
|
mkdir -p "$WORK/stage"
|
|
tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
|
|
[[ -x "$WORK/stage/bin/vectorcraft" ]] || { echo "error: $TARBALL has no bin/vectorcraft" >&2; exit 1; }
|
|
if [[ "$FLATPAK_ID" != "$APP_ID" ]]; then
|
|
# The Nightly tar already carries the standard layout: `bin/vectorcraft` is the launcher and
|
|
# `bin/vectorcraft-bin` the GUI it starts. The sandbox's own HOME is the profile's base.
|
|
[[ -x "$WORK/stage/bin/vectorcraft-bin" ]] || { echo "error: $TARBALL is not a Nightly tar (no bin/vectorcraft-bin)" >&2; exit 1; }
|
|
sed -e "s|^Icon=$APP_ID$|Icon=$FLATPAK_ID|" \
|
|
-e "s|^Name=VectorCraft$|Name=VectorCraft Nightly|" \
|
|
-e 's|^StartupWMClass=.*|StartupWMClass=ai.storyteller.vectorcraft.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|<id>$APP_ID</id>|<id>$FLATPAK_ID</id>|g" \
|
|
-e "s|<name>VectorCraft</name>|<name>VectorCraft Nightly</name>|g" \
|
|
-e "s|<launchable type=\"desktop-id\">$APP_ID.desktop</launchable>|<launchable type=\"desktop-id\">$FLATPAK_ID.desktop</launchable>|g" \
|
|
-e "s|<icon type=\"stock\">$APP_ID</icon>|<icon type=\"stock\">$FLATPAK_ID</icon>|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"
|
|
mv "$WORK/stage/share/mime/packages/$APP_ID.xml" "$WORK/stage/share/mime/packages/$FLATPAK_ID.xml"
|
|
rm -rf "$WORK/stage/share/icons/hicolor"
|
|
NIGHTLY_ICON="$ROOT/assets/app-icon/vectorcraft-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"
|
|
sed -e "s|ai\.storyteller\.vectorcraft|$FLATPAK_ID|g" \
|
|
-e 's|- install -Dm755 bin/vectorcraft /app/bin/vectorcraft|- install -Dm755 bin/vectorcraft-bin /app/libexec/vectorcraft-bin\n - install -Dm755 bin/vectorcraft /app/bin/vectorcraft|' \
|
|
"$HERE/flatpak/$APP_ID.bundle.yml" >"$WORK/$FLATPAK_ID.yml"
|
|
else
|
|
cp "$HERE/flatpak/$APP_ID.bundle.yml" "$WORK/$FLATPAK_ID.yml"
|
|
fi
|
|
|
|
flatpak remote-add --user --if-not-exists flathub "$FLATHUB"
|
|
# --disable-rofiles-fuse: no FUSE in containers and CI runners.
|
|
flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \
|
|
--default-branch="$FLATPAK_BRANCH" --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$FLATPAK_ID.yml"
|
|
|
|
OUT="$DIST/$BASENAME.flatpak"
|
|
# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing.
|
|
flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$FLATPAK_ID" "$FLATPAK_BRANCH"
|
|
echo "wrote $OUT"
|
|
if [[ "$OCI" = 1 ]]; then
|
|
OUT_OCI="$DIST/$BASENAME-oci"
|
|
rm -rf "$OUT_OCI"
|
|
flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$FLATPAK_ID" "$FLATPAK_BRANCH"
|
|
echo "wrote OCI layout to $OUT_OCI"
|
|
fi
|
|
|
|
if [[ "$TEST" = 1 ]]; then
|
|
flatpak install --user -y --noninteractive --reinstall "$OUT"
|
|
flatpak info --user "$FLATPAK_ID"
|
|
flatpak run --command=vectorcraft-cli "$FLATPAK_ID" --version
|
|
flatpak run --command=sh "$FLATPAK_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/*/apps'
|
|
fi
|
|
echo "==> done"
|
|
ls -lh "$OUT"
|