mirror of
https://github.com/storytold/effectcraft.git
synced 2026-12-04 04:53:32 -05:00
packaging(linux): start every Nightly format the flavor's way, and close the port's gaps
Second commit on top of Dylan Taylor's #4154; his commits, names and files stay his. The Nightly build refuses EFFECTCRAFT_CONFIG_DIR (its state root comes from the Launcher), so his wrappers, which export that variable, would have been refused at startup. Every one of them now passes the protocol instead - `--launch-profile nightly-v1 --profile-root <dir> --`: - the deb/rpm GUI wrapper in packaging/linux/package.sh, plus a wrapper for its headless CLI; - the AppImage AppRun (a script, not the stable symlink), and its CLI; - the Flatpak wrapper in packaging/linux/flatpak-bundle.sh; - the Arch launcher, with its test updated; - and a new launcher inside the flat Nightly tar (packaging/linux/nightly-launch.sh), which stages the GUI as `effectcraft-bin`; the archive helper allows and requires exactly that one extra member. The profile folder is `${XDG_DATA_HOME:-$HOME/.local/share}/effectcraft-nightly` everywhere: outside every stable boundary and inside the Nightly Flatpak's own sandbox home. Each launcher passes a first-argument --version/-V, and an already-supplied --launch-profile, through unchanged, because after the injected `--` both would be file names. build.rs now reads EFFECTCRAFT_VERSION and falls back to EFFECTCRAFT_OVERRIDE_VERSION, which is what this repo's packaging scripts export, so the binary reports the prepared identity and nightly-common.sh's exact `EffectCraft <version> (nightly-v1)` check can pass. profile_root accepts exactly the Nightly's own Flatpak instance (ai.storyteller.effectcraft.nightly) and refuses every other, with a test; before, any FLATPAK_ID was refused and the Nightly Flatpak could not start inside its own sandbox. Cargo.lock's effectcraft entry names thiserror and winsafe, which the flavor added to the manifest, so `cargo check --locked` resolves again. With his enabled callers kept whole, the flavor's `.github/actionlint.yaml` (a suppression for a `queue:` key his signer no longer sets) and its `packaging-lint.yml` path entry are gone; nothing in the tree names `queue:` or the `macos-release` label. Already right here: the window class matches the Nightly desktop entry's StartupWMClass, the metainfo declares no mediatypes, the Nightly build needs no extra features, and sonar.coverage.exclusions already covers packaging/**. The flavor itself had three compile errors that only a real `cargo check` finds, fixed here: the user-preset folder asked `effectcraft_host` for the profile root from a crate that does not depend on it (the UI now carries the profile's `Presets` folder through `channel::set_profile_presets`, set from `prepare_launch`), `channel::channel_label` was `const` while it reads a non-const atomic identity, and a test built `"--launch-profile="` with `+` on `&str`s. Tests: packaging/nightly-tests.py (71 suite tests plus the two Linux launcher argv tests), bash -n over every changed script, rustfmt --edition 2024 --check on the changed Rust, and `cargo check --locked -p effectcraft --tests` / `-p effectcraft-cli --tests`, both green locally (with a check-only alsa.pc, because this host has no libasound outside the Nix dev shell). package.sh was also rendered with stub binaries and a stub nfpm, and the installed deb tree read back. Co-authored-by: dylanmtaylor <[email protected]> Co-authored-by: skylartaylor <[email protected]>
This commit is contained in:
1 parent
3a50341d0a
commit
0ce27fe728
20 files changed
+244
-52
No files matched your search
@@ -1,11 +0,0 @@
|
||||
# Custom runner labels actionlint can't know about.
|
||||
self-hosted-runner:
|
||||
labels:
|
||||
- macos-release # org larger runner (M2 Pro), used by release.yml
|
||||
|
||||
# actionlint 1.7.12 predates GitHub's queue key. Only this exact false positive is
|
||||
# suppressed; Packaging lint's independent source-contract job enforces the values.
|
||||
paths:
|
||||
.github/workflows/nightly-sign.yml:
|
||||
ignore:
|
||||
- '^unexpected key "queue" for "concurrency" section\. expected one of "cancel-in-progress", "group"$'
|
||||
@@ -6,9 +6,9 @@ name: Packaging lint
|
||||
on:
|
||||
push:
|
||||
branches: [main, release]
|
||||
paths: [".github/workflows/**", ".github/actionlint.yaml", "packaging/**", "assets/app-icon/**", "docs/nightly-signing-policy.example.json", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"]
|
||||
paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**", "docs/nightly-signing-policy.example.json", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"]
|
||||
pull_request:
|
||||
paths: [".github/workflows/**", ".github/actionlint.yaml", "packaging/**", "assets/app-icon/**", "docs/nightly-signing-policy.example.json", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"]
|
||||
paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**", "docs/nightly-signing-policy.example.json", ".github/nightly-signing-policy.json", ".github/nightly-linux-signing-key.asc", "sonar-project.properties"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
||||
Generated
+2
@@ -1951,8 +1951,10 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sysinfo",
|
||||
"tempfile",
|
||||
"thiserror 2.0.21",
|
||||
"winit",
|
||||
"winresource",
|
||||
"winsafe",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
|
||||
@@ -29,16 +29,21 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed=../../assets/app-icon/effectcraft-nightly.ico");
|
||||
println!("cargo:rerun-if-env-changed=EFFECTCRAFT_REQUIRE_WINRES");
|
||||
println!("cargo:rerun-if-env-changed=EFFECTCRAFT_VERSION");
|
||||
println!("cargo:rerun-if-env-changed=EFFECTCRAFT_OVERRIDE_VERSION");
|
||||
println!("cargo:rerun-if-env-changed=EFFECTCRAFT_BUILD_SHA");
|
||||
println!("cargo:rerun-if-env-changed=EFFECTCRAFT_BUILD_DATE");
|
||||
// A nightly build refuses a version the feed would not have produced: the same identity the
|
||||
// Linux, macOS and Windows packaging checks require. Stable keeps its Cargo version.
|
||||
let cargo_version = std::env::var("CARGO_PKG_VERSION").unwrap_or_default();
|
||||
let built_version = if nightly {
|
||||
let version = match std::env::var("EFFECTCRAFT_VERSION") {
|
||||
// `EFFECTCRAFT_VERSION` is the feed identity the shared workflow passes;
|
||||
// `EFFECTCRAFT_OVERRIDE_VERSION` is what this repo's own Linux packaging scripts pass. Accept
|
||||
// either, or a nightly built by package.sh would print the Cargo version and fail the
|
||||
// version check in nightly-common.sh.
|
||||
let version = match std::env::var("EFFECTCRAFT_VERSION").or_else(|_| std::env::var("EFFECTCRAFT_OVERRIDE_VERSION")) {
|
||||
Ok(version) if build_channel::is_nightly_version(&version) => version,
|
||||
_ => {
|
||||
eprintln!("nightly-v1 requires an explicit EFFECTCRAFT_VERSION feed identity");
|
||||
eprintln!("nightly-v1 requires an explicit EFFECTCRAFT_VERSION (or EFFECTCRAFT_OVERRIDE_VERSION) feed identity");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -159,7 +159,7 @@ mod tests {
|
||||
args(&["--launch-profile", VERSION, "--profile-root", "", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--control", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute()]),
|
||||
args(&["--launch-profile=" + VERSION, "--profile-root", absolute(), "--"]),
|
||||
args(&[&format!("--launch-profile={VERSION}"), "--profile-root", absolute(), "--"]),
|
||||
] {
|
||||
assert!(parse(argv).is_err());
|
||||
}
|
||||
|
||||
@@ -142,7 +142,11 @@ fn prepare_launch() -> Option<Vec<std::ffi::OsString>> {
|
||||
let root = root.to_path_buf();
|
||||
effectcraft_host::app_dirs::set_profile_root(root.clone()).map_err(str::to_owned)?;
|
||||
// And the caches, which otherwise live in the platform cache folder.
|
||||
effectcraft_engine::render::disk_cache::set_profile_root(root).map_err(str::to_owned)
|
||||
effectcraft_engine::render::disk_cache::set_profile_root(root.clone()).map_err(str::to_owned)?;
|
||||
// The UI keeps the user's animation presets in the profile too (not Documents, and
|
||||
// not an inherited EC_PRESETS_DIR).
|
||||
effectcraft_ui_egui::channel::set_profile_presets(root.join("Presets"));
|
||||
Ok(())
|
||||
}
|
||||
});
|
||||
if let Err(error) = installed {
|
||||
|
||||
@@ -5,6 +5,11 @@ use std::path::{Component, Path, PathBuf};
|
||||
|
||||
use effectcraft_host::app_dirs::{PORTABLE_DATA_DIR, portable_marker};
|
||||
|
||||
/// The bundle id of EffectCraft's own Nightly Flatpak (`packaging/linux/flatpak-bundle.sh`). Its
|
||||
/// sandbox is a separate installation; every other Flatpak instance (the stable app's included)
|
||||
/// would point the profile at another install's state.
|
||||
pub const NIGHTLY_FLATPAK_ID: &str = "ai.storyteller.effectcraft.nightly";
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum Platform {
|
||||
Windows,
|
||||
@@ -199,10 +204,12 @@ fn validate_for(
|
||||
if env("EFFECTCRAFT_CONFIG_DIR").is_some_and(|v| !v.is_empty()) {
|
||||
return Err("nightly-v1 cannot be combined with EFFECTCRAFT_CONFIG_DIR".into());
|
||||
}
|
||||
if platform != Platform::Windows && env("FLATPAK_ID").is_some_and(|v| !v.is_empty()) {
|
||||
// These rows are native tar/app-bundle launches, not a Flatpak package. Inheriting its
|
||||
// runtime socket namespace could point another profile at the stable app's state.
|
||||
return Err("nightly-v1 native packages cannot inherit a Flatpak instance; launch through the native Launcher".into());
|
||||
// The Nightly ships its own Flatpak, so that one sandbox may carry a profile. Any other
|
||||
// instance (the stable app's, or a foreign one) names another installation's state.
|
||||
if let Some(instance) = env("FLATPAK_ID").filter(|value| !value.is_empty())
|
||||
&& instance.to_string_lossy() != NIGHTLY_FLATPAK_ID
|
||||
{
|
||||
return Err(format!("nightly-v1 accepts only the {NIGHTLY_FLATPAK_ID} Flatpak instance; launch the Nightly from its own package"));
|
||||
}
|
||||
let chosen = canonical_future(root)?;
|
||||
if is_portable_layout(root, platform) || is_portable_layout(&chosen, platform) {
|
||||
@@ -522,6 +529,24 @@ mod tests {
|
||||
assert!(!candidate.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_the_nightly_s_own_flatpak_instance_may_carry_a_profile() {
|
||||
// Inside packaging/linux/flatpak-bundle.sh's sandbox, $HOME is this app id's own folder, so
|
||||
// the launcher's profile is the Nightly's state and nothing else is reachable through it.
|
||||
let mut fixture = Fixture::new();
|
||||
fixture.env.insert("FLATPAK_ID".into(), NIGHTLY_FLATPAK_ID.into());
|
||||
let candidate = fixture.home().join(".local/share/effectcraft-nightly");
|
||||
assert_eq!(fixture.check(Platform::Linux, &candidate).unwrap(), std::fs::canonicalize(&candidate).unwrap());
|
||||
fixture.env.remove("FLATPAK_ID");
|
||||
for refused in ["ai.storyteller.effectcraft", "ai.storyteller.effectcraft.nightly-v1", "org.example.other"] {
|
||||
let mut other = Fixture::new();
|
||||
other.env.insert("FLATPAK_ID".into(), refused.into());
|
||||
let refused_root = other.home().join(".local/share/effectcraft-nightly");
|
||||
assert!(other.check(Platform::Linux, &refused_root).unwrap_err().contains("Flatpak"), "{refused}");
|
||||
assert!(!refused_root.exists());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_directory_and_failed_write_probe_never_fall_back_to_stable() {
|
||||
let fixture = Fixture::new();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! The launch channel: stable EffectCraft, or the isolated Nightly flavor the ArtCraft Launcher
|
||||
//! starts from its own profile. Selected once at startup, before any window or saved state.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::OnceLock;
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
|
||||
@@ -62,6 +63,18 @@ pub fn stable_services_allowed() -> bool {
|
||||
stable_services_for(identity())
|
||||
}
|
||||
|
||||
/// The Nightly profile's own user-preset folder, installed once by the desktop host before the UI
|
||||
/// exists. A stable session installs nothing, so its `EC_PRESETS_DIR`/Documents rule is unchanged.
|
||||
static PROFILE_PRESETS: OnceLock<PathBuf> = OnceLock::new();
|
||||
|
||||
pub fn set_profile_presets(dir: PathBuf) {
|
||||
let _ = PROFILE_PRESETS.set(dir);
|
||||
}
|
||||
|
||||
pub fn profile_presets() -> Option<&'static Path> {
|
||||
PROFILE_PRESETS.get().map(PathBuf::as_path)
|
||||
}
|
||||
|
||||
/// A builder for the window, carrying the channel's app id.
|
||||
pub fn builder() -> egui::ViewportBuilder {
|
||||
egui::ViewportBuilder::default().with_app_id(app_id())
|
||||
@@ -91,7 +104,7 @@ pub fn commit() -> Option<&'static str> {
|
||||
}
|
||||
|
||||
/// The channel label a Nightly build appends to its version line.
|
||||
pub const fn channel_label() -> Option<&'static str> {
|
||||
pub fn channel_label() -> Option<&'static str> {
|
||||
match identity() {
|
||||
LaunchIdentity::Stable => None,
|
||||
LaunchIdentity::NightlyV1 => Some("nightly-v1"),
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct PresetFile {
|
||||
pub fn presets_dir() -> Option<std::path::PathBuf> {
|
||||
let env_presets = std::env::var("EC_PRESETS_DIR").ok().map(std::path::PathBuf::from);
|
||||
let home = std::env::var("HOME").or_else(|_| std::env::var("USERPROFILE")).ok().map(std::path::PathBuf::from);
|
||||
presets_dir_for(effectcraft_host::app_dirs::profile_root(), env_presets, home.as_deref())
|
||||
presets_dir_for(crate::channel::profile_presets(), env_presets, home.as_deref())
|
||||
}
|
||||
|
||||
fn presets_dir_for(profile: Option<&std::path::Path>, env_presets: Option<std::path::PathBuf>, home: Option<&std::path::Path>) -> Option<std::path::PathBuf> {
|
||||
|
||||
+15
-5
@@ -50,11 +50,21 @@ jobs are refused by the environment's branch rule, and no draft release is made.
|
||||
|
||||
## Release-ref nightly preparation
|
||||
|
||||
The Windows, Linux and macOS source preparation for the isolated `EffectCraft Nightly` channel is
|
||||
documented in [`nightly-release-preparation.md`](nightly-release-preparation.md). It is **not** an
|
||||
activated signing or publication pipeline: every nightly workflow job is registered literally off
|
||||
(`false && …`), there is no schedule, and no nightly policy file exists. Stable `release.yml`, its
|
||||
schedule, tags, concurrency, environment values and environment rules are unchanged.
|
||||
The Windows, Linux and macOS preparation for the isolated `EffectCraft Nightly` channel is
|
||||
documented in [`nightly-release-preparation.md`](nightly-release-preparation.md). The producer
|
||||
(`nightly.yml`, default branch) and the signer (`nightly-sign.yml`, `release`) keep only their exact
|
||||
context guards: they run when one of the reviewed manual actors dispatches them, never on a schedule,
|
||||
and the v3 policy is installed at [`.github/nightly-signing-policy.json`](../.github/nightly-signing-policy.json).
|
||||
Stable `release.yml`, its schedule, tags, concurrency, environment values and environment rules are
|
||||
unchanged.
|
||||
|
||||
Every Linux Nightly format starts the GUI through the Nightly profile
|
||||
(`--launch-profile nightly-v1 --profile-root <dir> --`), so its settings, logs, plug-ins, recovery
|
||||
and caches are its own: the deb/rpm wrapper, the AppImage `AppRun`, the Flatpak wrapper, the Arch
|
||||
launcher and the `effectcraft` launcher inside the flat Nightly tar (the GUI beside it is
|
||||
`effectcraft-bin`). A wrapper answers `--version`/`-V` first, and passes an already-selected profile
|
||||
through, because after the injected `--` either would be a file name. The Nightly Flatpak is the one
|
||||
sandbox whose own instance id (`ai.storyteller.effectcraft.nightly`) may carry a profile.
|
||||
|
||||
Initial installation **and later signer/policy updates** ride an already-intended reviewed stable
|
||||
release sync, with an appropriate version/build state. Every release-branch push may rebuild or
|
||||
|
||||
@@ -60,10 +60,17 @@ tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
|
||||
[[ -x "$WORK/stage/bin/effectcraft" ]] || { echo "error: $TARBALL has no bin/effectcraft" >&2; exit 1; }
|
||||
if [[ "$FLATPAK_ID" != "$APP_ID" ]]; then
|
||||
mv "$WORK/stage/bin/effectcraft" "$WORK/stage/bin/effectcraft-bin"
|
||||
# The Nightly build refuses EFFECTCRAFT_CONFIG_DIR, so the wrapper passes the profile protocol.
|
||||
# Inside the sandbox $HOME is this app id's own folder, so the profile is the Nightly's alone.
|
||||
cat >"$WORK/stage/bin/effectcraft" <<'WRAPPER'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
exec /app/libexec/effectcraft "$@"
|
||||
real_bin=/app/libexec/effectcraft
|
||||
case "${1:-}" in
|
||||
--version|-V|--launch-profile) exec "$real_bin" "$@" ;;
|
||||
esac
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@"
|
||||
WRAPPER
|
||||
chmod 755 "$WORK/stage/bin/effectcraft"
|
||||
sed -e "s|^Icon=$APP_ID$|Icon=$FLATPAK_ID|" \
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#!/bin/sh
|
||||
# EffectCraft Nightly handoff for the Arch packager: the hidden binary is the real GUI, and this
|
||||
# launcher gives it the Nightly profile. The Nightly build refuses EFFECTCRAFT_CONFIG_DIR, so the
|
||||
# profile is passed as the Launcher's own protocol; a version query (or an already selected
|
||||
# profile) passes through, because after `--` both would be file names.
|
||||
set -eu
|
||||
|
||||
if [ -z "${EFFECTCRAFT_CONFIG_DIR:-}" ]; then
|
||||
export EFFECTCRAFT_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/effectcraft-nightly"
|
||||
fi
|
||||
real_bin="$(dirname "$0")/.effectcraft-nightly/effectcraft"
|
||||
exec "$real_bin" "$@"
|
||||
case "${1:-}" in
|
||||
--version|-V|--launch-profile) exec "$real_bin" "$@" ;;
|
||||
esac
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@"
|
||||
@@ -31,6 +31,12 @@ mv "$bin/effectcraft-cli" "$bin/effectcraft-nightly-cli"
|
||||
[[ ! -e "$stage/bin/.effectcraft-nightly" ]]
|
||||
cmp "$stage/bin/effectcraft" "$bin/.effectcraft-nightly/effectcraft"
|
||||
cmp "$stage/bin/effectcraft-cli" "$bin/effectcraft-nightly-cli"
|
||||
# The launcher must start the hidden GUI through the Nightly profile; the profile base is fixed
|
||||
# here so the recorded arguments are exactly comparable.
|
||||
export XDG_DATA_HOME="$work/xdg-data"
|
||||
profile() {
|
||||
printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/effectcraft-nightly" -- "$@"
|
||||
}
|
||||
expect() {
|
||||
expected="$1"
|
||||
shift
|
||||
@@ -40,10 +46,13 @@ expect() {
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
expect '<>'
|
||||
expect "$(printf '<%s>\n' 'project with spaces.ec' '--other-name.ec')" \
|
||||
expect "$(profile)"
|
||||
expect "$(profile 'project with spaces.ec' '--other-name.ec')" \
|
||||
'project with spaces.ec' '--other-name.ec'
|
||||
# A version query and an already selected profile pass through unchanged: after `--` both are files.
|
||||
expect '<--version>' --version
|
||||
expect '<-V>' -V
|
||||
expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/launcher-root" --version)" \
|
||||
--launch-profile nightly-v1 --profile-root "$work/launcher-root" --version
|
||||
|
||||
echo "PASS: Arch Nightly handoff stages the hidden binary and preserves launch arguments"
|
||||
echo "PASS: Arch Nightly handoff starts the hidden GUI through the Nightly launch profile"
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate the launcher inside the flat Nightly tar without building or opening EffectCraft.
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
stage="$work/unpacked"
|
||||
mkdir -p "$stage"
|
||||
|
||||
# A local argv recorder stands in for the compiled GUI, which the launcher starts as `effectcraft-bin`.
|
||||
cat >"$stage/effectcraft-bin" <<'RECORDER'
|
||||
#!/bin/sh
|
||||
printf '<%s>\n' "$@"
|
||||
RECORDER
|
||||
chmod 755 "$stage/effectcraft-bin"
|
||||
cp "$HERE/nightly-launch.sh" "$stage/effectcraft"
|
||||
chmod 755 "$stage/effectcraft"
|
||||
|
||||
# A fixed profile base keeps the recorded arguments exactly comparable.
|
||||
export XDG_DATA_HOME="$work/xdg-data"
|
||||
profile() {
|
||||
printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/effectcraft-nightly" -- "$@"
|
||||
}
|
||||
expect() {
|
||||
expected="$1"
|
||||
shift
|
||||
actual=$("$stage/effectcraft" "$@")
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
expect "$(profile)"
|
||||
expect "$(profile 'project with spaces.ec' '--other-name.ec')" 'project with spaces.ec' '--other-name.ec'
|
||||
# A version query and an already selected profile pass through: after `--` both would be files.
|
||||
expect '<--version>' --version
|
||||
expect '<-V>' -V
|
||||
expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/launcher-root" --version)" \
|
||||
--launch-profile nightly-v1 --profile-root "$work/launcher-root" --version
|
||||
# HOME is the only other base, and the profile root is never optional.
|
||||
home_run=$(env -u XDG_DATA_HOME HOME="$work/home" "$stage/effectcraft")
|
||||
expected_home=$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/home/.local/share/effectcraft-nightly" --)
|
||||
if [[ "$home_run" != "$expected_home" ]]; then
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected_home" "$home_run" >&2
|
||||
exit 1
|
||||
fi
|
||||
if env -u XDG_DATA_HOME -u HOME "$stage/effectcraft" >/dev/null 2>&1; then
|
||||
echo 'a launcher without HOME must refuse rather than start with the stable profile' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PASS: the flat Nightly tar's launcher starts the GUI through the Nightly launch profile"
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# The launcher inside EffectCraft Nightly's flat tar: an unpacked copy is isolated like the
|
||||
# packages, so it never falls back to the stable settings folder. The GUI itself is `effectcraft-bin`;
|
||||
# `effectcraft` is the name people run, and the version query still answers from it.
|
||||
set -eu
|
||||
|
||||
here="$(dirname "$0")"
|
||||
real_bin="$here/effectcraft-bin"
|
||||
case "${1:-}" in
|
||||
--version|-V|--launch-profile) exec "$real_bin" "$@" ;;
|
||||
esac
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@"
|
||||
@@ -18,7 +18,11 @@ OUTPUT="$DIST/effectcraft-$VERSION-linux-x86_64-nightly.tar.gz"
|
||||
nightly_build_gui
|
||||
STAGE="$NIGHTLY_WORK/stage"
|
||||
mkdir -p "$STAGE"
|
||||
cp "$NIGHTLY_GUI" "$STAGE/effectcraft"
|
||||
# An unpacked tar is isolated too: the GUI is `effectcraft-bin` and the launcher people run is
|
||||
# `effectcraft`, which starts it through this channel's own profile.
|
||||
cp "$NIGHTLY_GUI" "$STAGE/effectcraft-bin"
|
||||
chmod 755 "$STAGE/effectcraft-bin"
|
||||
cp "$ROOT/packaging/linux/nightly-launch.sh" "$STAGE/effectcraft"
|
||||
chmod 755 "$STAGE/effectcraft"
|
||||
cp "$ROOT/assets/app-icon/effectcraft-nightly.png" "$STAGE/effectcraft-nightly.png"
|
||||
nightly_copy_notices "$STAGE"
|
||||
|
||||
@@ -152,17 +152,35 @@ if has deb || has rpm; then
|
||||
rm -rf "$NFPM_STAGE"
|
||||
cp -R "$STAGE" "$NFPM_STAGE"
|
||||
install -Dm755 "$NFPM_STAGE/usr/bin/effectcraft" "$NFPM_STAGE/usr/lib/effectcraft-nightly/effectcraft"
|
||||
# The Nightly build refuses EFFECTCRAFT_CONFIG_DIR: every launcher passes the Launcher's own
|
||||
# profile protocol instead, so settings, logs, plug-ins and caches are the Nightly's own.
|
||||
# A version query and an already-selected profile pass through, because after `--` they are
|
||||
# file names (the shared smoke test asks the Launcher form of the unpacked binary).
|
||||
cat >"$NFPM_STAGE/usr/bin/$NFPM_BIN" <<'WRAPPER'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
if [ -z "${EFFECTCRAFT_CONFIG_DIR:-}" ]; then
|
||||
export EFFECTCRAFT_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/effectcraft-nightly"
|
||||
fi
|
||||
exec /usr/lib/effectcraft-nightly/effectcraft "$@"
|
||||
real_bin=/usr/lib/effectcraft-nightly/effectcraft
|
||||
case "${1:-}" in
|
||||
--version|-V|--launch-profile) exec "$real_bin" "$@" ;;
|
||||
esac
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@"
|
||||
WRAPPER
|
||||
chmod 755 "$NFPM_STAGE/usr/bin/$NFPM_BIN"
|
||||
rm -f "$NFPM_STAGE/usr/bin/effectcraft"
|
||||
mv "$NFPM_STAGE/usr/bin/effectcraft-cli" "$NFPM_STAGE/usr/bin/$NFPM_CLI"
|
||||
# The headless CLI has no launch profile; it keeps the settings-folder variable it honours.
|
||||
install -Dm755 "$NFPM_STAGE/usr/bin/effectcraft-cli" "$NFPM_STAGE/usr/lib/effectcraft-nightly/effectcraft-cli"
|
||||
rm -f "$NFPM_STAGE/usr/bin/effectcraft-cli"
|
||||
cat >"$NFPM_STAGE/usr/bin/$NFPM_CLI" <<'CLI_WRAPPER'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
if [ -z "${EFFECTCRAFT_CONFIG_DIR:-}" ]; then
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
export EFFECTCRAFT_CONFIG_DIR="$profile_base/effectcraft-nightly"
|
||||
fi
|
||||
exec /usr/lib/effectcraft-nightly/effectcraft-cli "$@"
|
||||
CLI_WRAPPER
|
||||
chmod 755 "$NFPM_STAGE/usr/bin/$NFPM_CLI"
|
||||
mv "$NFPM_STAGE/usr/share/doc/effectcraft" "$NFPM_STAGE/usr/share/doc/$NFPM_NAME"
|
||||
sed -e "s#^Exec=effectcraft\([[:space:]]\|$\)#Exec=$NFPM_BIN\1#" \
|
||||
-e "s|^TryExec=effectcraft$|TryExec=$NFPM_BIN|" \
|
||||
@@ -220,15 +238,31 @@ if has appimage; then
|
||||
# Keep sctk-adwaita's MIT notice in the AppImage.
|
||||
install -Dm644 "$ROOT/NOTICE" "$APPDIR/usr/share/doc/effectcraft/NOTICE"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then
|
||||
# A script, not the stable symlink: the AppImage starts the GUI through the Nightly profile.
|
||||
cat >"$APPDIR/AppRun" <<'APPRUN'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
if [ -z "${EFFECTCRAFT_CONFIG_DIR:-}" ]; then
|
||||
export EFFECTCRAFT_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/effectcraft-nightly"
|
||||
fi
|
||||
exec "$(dirname "$0")/usr/bin/effectcraft" "$@"
|
||||
here="$(dirname "$0")"
|
||||
real_bin="$here/usr/bin/effectcraft"
|
||||
case "${1:-}" in
|
||||
--version|-V|--launch-profile) exec "$real_bin" "$@" ;;
|
||||
esac
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@"
|
||||
APPRUN
|
||||
chmod 755 "$APPDIR/AppRun"
|
||||
# The headless CLI keeps the settings-folder variable, which is the only profile it honours.
|
||||
install -Dm755 "$APPDIR/usr/bin/effectcraft-cli" "$APPDIR/usr/lib/effectcraft-nightly/effectcraft-cli"
|
||||
cat >"$APPDIR/usr/bin/effectcraft-cli" <<'APPRUN_CLI'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
if [ -z "${EFFECTCRAFT_CONFIG_DIR:-}" ]; then
|
||||
profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}"
|
||||
export EFFECTCRAFT_CONFIG_DIR="$profile_base/effectcraft-nightly"
|
||||
fi
|
||||
exec "$(dirname "$0")/../lib/effectcraft-nightly/effectcraft-cli" "$@"
|
||||
APPRUN_CLI
|
||||
chmod 755 "$APPDIR/usr/bin/effectcraft-cli"
|
||||
APPIMAGE_ID="$APP_ID.nightly-v1"
|
||||
sed -e "s|^Icon=$APP_ID$|Icon=$APPIMAGE_ID|" \
|
||||
-e "s|^Name=EffectCraft$|Name=EffectCraft Nightly|" \
|
||||
|
||||
@@ -29,10 +29,20 @@ class ArchivePolicy(unittest.TestCase):
|
||||
self.stage = self.root / "stage"
|
||||
self.stage.mkdir()
|
||||
self.output = self.root / "nightly.tar.gz"
|
||||
self.required = {"effectcraft", "effectcraft-nightly.png", "README.md", "LICENSE-MIT", "LICENSE-APACHE", "NOTICE", "ATTRIBUTION.md"}
|
||||
self.required = {
|
||||
"effectcraft",
|
||||
"effectcraft-bin",
|
||||
"effectcraft-nightly.png",
|
||||
"README.md",
|
||||
"LICENSE-MIT",
|
||||
"LICENSE-APACHE",
|
||||
"NOTICE",
|
||||
"ATTRIBUTION.md",
|
||||
}
|
||||
for name in self.required:
|
||||
(self.stage / name).write_bytes(b"generated fixture: " + name.encode())
|
||||
(self.stage / "effectcraft").chmod(0o755)
|
||||
for name in ("effectcraft", "effectcraft-bin"):
|
||||
(self.stage / name).chmod(0o755)
|
||||
|
||||
def test_flat_regular_ustar_with_all_notices(self):
|
||||
(self.stage / "OFL-Font.txt").write_text("generated fixture license", encoding="utf-8")
|
||||
@@ -41,6 +51,7 @@ class ArchivePolicy(unittest.TestCase):
|
||||
self.assertEqual({m.name for m in archive}, self.required | {"OFL-Font.txt"})
|
||||
self.assertTrue(all(m.isfile() and not m.pax_headers for m in archive))
|
||||
self.assertEqual(archive.extractfile("effectcraft").read(), (self.stage / "effectcraft").read_bytes())
|
||||
self.assertEqual(archive.extractfile("effectcraft-bin").read(), (self.stage / "effectcraft-bin").read_bytes())
|
||||
with gzip.open(self.output, "rb") as stream:
|
||||
while (header := stream.read(512)) != bytes(512):
|
||||
self.assertEqual(len(header), 512)
|
||||
|
||||
@@ -33,7 +33,7 @@ def checked_entries(root, stage):
|
||||
total = 0
|
||||
for entry in entries:
|
||||
name = entry.name
|
||||
if name not in {"effectcraft", "effectcraft-nightly.png"} and not notice(name):
|
||||
if name not in {"effectcraft", "effectcraft-bin", "effectcraft-nightly.png"} and not notice(name):
|
||||
raise ValueError(f"unexpected nightly member: {name}")
|
||||
if len(name.encode("utf-8")) > 100:
|
||||
raise ValueError(f"nightly member must be a short regular file: {name}")
|
||||
@@ -44,7 +44,9 @@ def checked_entries(root, stage):
|
||||
if name.casefold() in folded:
|
||||
raise ValueError(f"case-colliding nightly member: {name}")
|
||||
folded.add(name.casefold())
|
||||
required = {"effectcraft", "effectcraft-nightly.png", "README.md", "LICENSE-MIT", "LICENSE-APACHE", "NOTICE", "ATTRIBUTION.md"}
|
||||
# `effectcraft` is the launcher people run and `effectcraft-bin` the GUI it starts: a flat tar
|
||||
# holding only the bare binary would start with the stable settings folder.
|
||||
required = {"effectcraft", "effectcraft-bin", "effectcraft-nightly.png", "README.md", "LICENSE-MIT", "LICENSE-APACHE", "NOTICE", "ATTRIBUTION.md"}
|
||||
if not required.issubset({item.name for item in entries}):
|
||||
raise ValueError("required GUI/icon/notices missing")
|
||||
return entries
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run the existing synthetic packaging suites together; no app build or signing."""
|
||||
"""Run the synthetic packaging suites and the Linux launcher argv tests; no app build or signing."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -18,7 +19,12 @@ def main() -> int:
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module))
|
||||
return 0 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() else 1
|
||||
result = 0 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() else 1
|
||||
# The Linux launchers are shell scripts: each runs an argv recorder as the GUI and compares what
|
||||
# it would start, so a wrapper that stops passing the launch profile fails here.
|
||||
for script in ("linux/nightly-arch-tar-test.sh", "linux/nightly-launch-test.sh"):
|
||||
result |= subprocess.run(["bash", str(here / script)], check=False).returncode
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user