build_all --ram: move flatpak state dir to tmpfs too (same-fs requirement)
flatpak-builder hardlinks between its state dir and the build dir, so they must
share a filesystem. With only the build dir on tmpfs it errored ('state dir not
on the same filesystem as the target dir'). Move .flatpak-builder to tmpfs as
well via FLATPAK_STATEDIR; its download cache no longer persists across --ram
runs, which is the accepted trade for the tmpfs speedup.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
17
build_all.sh
17
build_all.sh
@@ -83,19 +83,22 @@ source "$SCRIPT_DIR/scripts/set_env.sh"
|
|||||||
|
|
||||||
# ---------- RAM mode: put build scratch on tmpfs (--ram) ----------------------
|
# ---------- RAM mode: put build scratch on tmpfs (--ram) ----------------------
|
||||||
# On slow storage (USB stick, SD card) the per-channel build dirs and temp
|
# On slow storage (USB stick, SD card) the per-channel build dirs and temp
|
||||||
# churn dominate. --ram redirects them to /dev/shm and skips UPX. The
|
# churn dominate. --ram redirects them to /dev/shm and skips UPX. The whole
|
||||||
# .flatpak-builder cache stays on disk so source downloads persist. The tmpfs
|
# Flatpak working set (build dir + .flatpak-builder + repo) goes to tmpfs
|
||||||
# scratch is freed on exit.
|
# because flatpak-builder requires its state dir on the same filesystem as the
|
||||||
|
# build dir — so its download cache doesn't persist across --ram runs. The
|
||||||
|
# tmpfs scratch is freed on exit.
|
||||||
if [ "$RAM" -eq 1 ]; then
|
if [ "$RAM" -eq 1 ]; then
|
||||||
RAMROOT="/dev/shm/testium-build-${VERSION}"
|
RAMROOT="/dev/shm/testium-build-${VERSION}"
|
||||||
echo "-- RAM mode: build scratch under $RAMROOT (tmpfs), freed on exit"
|
echo "-- RAM mode: build scratch under $RAMROOT (tmpfs), freed on exit"
|
||||||
rm -rf "$RAMROOT"
|
rm -rf "$RAMROOT"
|
||||||
mkdir -p "$RAMROOT"/{tmp,pip,pyi-work,flatpak-build,flatpak-repo,appdir}
|
mkdir -p "$RAMROOT"/{tmp,pip,pyi-work,flatpak-build,flatpak-state,flatpak-repo,appdir}
|
||||||
export TMPDIR="$RAMROOT/tmp"
|
export TMPDIR="$RAMROOT/tmp"
|
||||||
export PIP_CACHE_DIR="$RAMROOT/pip"
|
export PIP_CACHE_DIR="$RAMROOT/pip"
|
||||||
export PYI_WORKPATH="$RAMROOT/pyi-work" # pyinstaller --workpath
|
export PYI_WORKPATH="$RAMROOT/pyi-work" # pyinstaller --workpath
|
||||||
export FLATPAK_BUILDDIR="$RAMROOT/flatpak-build" # flatpak-builder build dir
|
export FLATPAK_BUILDDIR="$RAMROOT/flatpak-build" # flatpak-builder build dir
|
||||||
export FLATPAK_REPODIR="$RAMROOT/flatpak-repo" # ostree repo
|
export FLATPAK_STATEDIR="$RAMROOT/flatpak-state" # .flatpak-builder (same fs as build dir, required)
|
||||||
|
export FLATPAK_REPODIR="$RAMROOT/flatpak-repo" # ostree repo
|
||||||
export APPIMAGE_APPDIR_TMPFS="$RAMROOT/appdir" # AppDir bind-mount
|
export APPIMAGE_APPDIR_TMPFS="$RAMROOT/appdir" # AppDir bind-mount
|
||||||
export TESTIUM_NO_UPX=1 # skip slow UPX in the spec
|
export TESTIUM_NO_UPX=1 # skip slow UPX in the spec
|
||||||
trap 'rm -rf "$RAMROOT"' EXIT
|
trap 'rm -rf "$RAMROOT"' EXIT
|
||||||
|
|||||||
@@ -7,12 +7,16 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Build + install local. FLATPAK_BUILDDIR / FLATPAK_REPODIR (set by build_all
|
# Build + install local. FLATPAK_BUILDDIR / FLATPAK_STATEDIR / FLATPAK_REPODIR
|
||||||
# --ram) redirect the build dir and the ostree repo to tmpfs. The
|
# (set by build_all --ram) redirect the build dir, the state dir
|
||||||
# .flatpak-builder cache stays local so source downloads persist between runs.
|
# (.flatpak-builder) and the ostree repo to tmpfs. flatpak-builder hardlinks
|
||||||
|
# between the state dir and the build dir, so they MUST be on the same
|
||||||
|
# filesystem — hence the state dir moves to tmpfs too (its download cache then
|
||||||
|
# doesn't persist across --ram runs).
|
||||||
BUILDDIR="${FLATPAK_BUILDDIR:-build}"
|
BUILDDIR="${FLATPAK_BUILDDIR:-build}"
|
||||||
|
STATEDIR="${FLATPAK_STATEDIR:-.flatpak-builder}"
|
||||||
REPODIR="${FLATPAK_REPODIR:-repo}"
|
REPODIR="${FLATPAK_REPODIR:-repo}"
|
||||||
flatpak-builder --user --verbose --force-clean --install --repo="$REPODIR" "$BUILDDIR" org.testium.Testium.yaml
|
flatpak-builder --user --verbose --force-clean --install --state-dir="$STATEDIR" --repo="$REPODIR" "$BUILDDIR" org.testium.Testium.yaml
|
||||||
|
|
||||||
# Génère le bundle distribuable
|
# Génère le bundle distribuable
|
||||||
flatpak build-bundle "$REPODIR" testium.flatpak org.testium.Testium
|
flatpak build-bundle "$REPODIR" testium.flatpak org.testium.Testium
|
||||||
|
|||||||
Reference in New Issue
Block a user