Files
craft-launcher/packaging/linux/test-package-metadata.sh
T
David MannandClaude Opus 5.5 acbf667f49 fix: gateway copy keeps its execute bit; packaging test ships a gateway fixture
- install_gateway returned an identical copy before setting its mode, so a
  copy that had lost its execute bit was reused and clients couldn't start
  it. The mode is now checked on both paths (Unix). Test extended: a 0644
  copy with the right bytes comes back executable (fails without the fix;
  run in Linux).
- packaging/linux/test-package-metadata.sh builds packages from a fake
  release folder; it now has a craft-ai-mcp fixture too, since the packages
  install the gateway beside the launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:12:09 +01:00

57 lines
2.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Build fixture deb/rpm packages through the real Linux packager, without compiling the app.
# Needs Linux (GNU install), nfpm, dpkg-deb and rpm. Never installs a package or runs Rust.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
for tool in nfpm dpkg-deb rpm; do
command -v "$tool" >/dev/null || { echo "error: $tool is required" >&2; exit 1; }
done
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
check_packages() {
local arch="$1" target="$2" floor="$3" expected="$4" deb_arch="$5"
local work="$TMP/$arch-${floor:-default}" deb actual_arch deb_requires rpm_requires
mkdir -p "$work/target/$target/release"
printf '#!/bin/sh\necho "ArtCraft Launcher packaging fixture"\n' >"$work/target/$target/release/artcraft-launcher"
chmod +x "$work/target/$target/release/artcraft-launcher"
# The packages ship the craft-ai-mcp gateway beside the launcher (Settings › AI agents).
printf '#!/bin/sh\necho "craft-ai-mcp packaging fixture"\n' >"$work/target/$target/release/craft-ai-mcp"
chmod +x "$work/target/$target/release/craft-ai-mcp"
# A set cross target skips the version smoke execution; no target binary is run.
(
unset EMULATOR
if [[ "$floor" = unset ]]; then unset GLIBC_FLOOR; else export GLIBC_FLOOR="$floor"; fi
export CROSS_ARCH="$arch" CROSS_TARGET="$target" CROSS_COMPILE=fixture-
export CARGO_TARGET_DIR="$work/target" DIST="$work/dist"
export ARTCRAFT_LAUNCHER_VERSION=0.0.0 ARTCRAFT_LAUNCHER_BUILD_DATE=2026-01-01
bash "$ROOT/packaging/linux/package.sh" --skip-build --formats "deb rpm"
)
deb="$work/dist/artcraft-launcher-0.0.0-linux-$arch.deb"
actual_arch="$(dpkg-deb -f "$deb" Architecture)"
[[ "$actual_arch" = "$deb_arch" ]] || {
echo "error: $arch GLIBC_FLOOR=${floor:-empty}: expected deb architecture $deb_arch, got $actual_arch" >&2
return 1
}
deb_requires="$(dpkg-deb -f "$deb" Depends)"
tr ',' '\n' <<<"$deb_requires" | sed 's/^ *//' | grep -Fxq "libc6 (>= $expected)" || {
echo "error: $arch GLIBC_FLOOR=${floor:-empty}: expected libc6 >= $expected; deb Depends: $deb_requires" >&2
return 1
}
rpm_requires="$(rpm -qp --requires "$work/dist/artcraft-launcher-0.0.0-linux-$arch.rpm")"
grep -Fxq "glibc >= $expected" <<<"$rpm_requires" || {
echo "error: $arch GLIBC_FLOOR=${floor:-empty}: expected glibc >= $expected; rpm Requires: $rpm_requires" >&2
return 1
}
echo "ok: $arch GLIBC_FLOOR=${floor:-empty} -> deb/rpm >= $expected"
}
check_packages x86_64 x86_64-unknown-linux-gnu unset 2.35 amd64
check_packages aarch64 aarch64-unknown-linux-gnu unset 2.35 arm64
check_packages riscv64 riscv64gc-unknown-linux-gnu 2.39 2.39 riscv64
check_packages x86_64 x86_64-unknown-linux-gnu "" 2.35 amd64
check_packages x86_64 x86_64-unknown-linux-gnu 2.40 2.40 amd64
echo "All 5 glibc metadata cases passed (deb and rpm)."