Linux packaging: substitute the stage path into nfpm.yaml

nfpm expands env vars in version/arch but not in contents[].src, so
${STAGE}/usr/bin/photocraft never matched and both deb/rpm builds failed.
Verified locally with nfpm v2.47.0 (deb + rpm).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-01 14:23:35 -04:00
co-authored by Claude Opus 5.5
parent 08c6c08e2e
commit 4eb75d6370
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
# .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
# the file tree in $STAGE and exports VERSION, NFPM_ARCH and STAGE.
# the file tree, substitutes its path for ${STAGE} (nfpm doesn't expand env vars in `src`) and
# exports VERSION and NFPM_ARCH.
#
# nfpm package -f packaging/linux/nfpm.yaml -p deb -t dist/release/
name: photocraft
+4 -2
View File
@@ -81,10 +81,12 @@ fi
# ---- .deb / .rpm --------------------------------------------------------------------------------
if has deb || has rpm; then
command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
export STAGE VERSION
export VERSION
export NFPM_ARCH="$DEB_ARCH"
# nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src`.
sed "s|\${STAGE}|$STAGE|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
for fmt in deb rpm; do
if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$HERE/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
done
fi