Makefile: escape $(...) so make doesn't pre-evaluate it
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 2m7s

The previous version had $(dpkg-architecture $DPKG_ARCH_ARGS).
make expands $(...) at parse time, BEFORE any bash command runs.
So make called 'dpkg-architecture' (no -a flag, because
$DPKG_ARCH_ARGS is empty at parse time) and substituted the
amd64 DEB_* vars into the recipe line. Bash then ran with the
amd64 vars baked in, regardless of what the runtime DPKG_ARCH_ARGS
ended up being.

Escape both dollars: $$ -> $, so make sees '$$' and passes
'$$' to bash, which sees '$(...)' and evaluates it at runtime
after DPKG_ARCH_ARGS is set on the previous command.
This commit is contained in:
Paul Schneider 2026-08-17 18:25:28 +01:00
commit 99bdf0923f
No known key found for this signature in database
GPG key ID: 1E66C65EE2B46F1B

View file

@ -54,7 +54,7 @@ deb:
# vars set by dpkg-architecture are visible to dpkg-buildpackage. # vars set by dpkg-architecture are visible to dpkg-buildpackage.
# make runs each recipe line in its own shell, so we use # make runs each recipe line in its own shell, so we use
# backslash continuation to glue everything together. # backslash continuation to glue everything together.
DPKG_ARCH_ARGS=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo "-aarm64" ;; linux-x64) echo "-aamd64" ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac); eval $(dpkg-architecture $$DPKG_ARCH_ARGS); POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b DPKG_ARCH_ARGS=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo "-aarm64" ;; linux-x64) echo "-aamd64" ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac); eval $$(dpkg-architecture $$DPKG_ARCH_ARGS); POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b
# dpkg-buildpackage already writes the produced .deb to # dpkg-buildpackage already writes the produced .deb to
# /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no # /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
# flag to change it). So no 'mv' is needed. The old 'mv' # flag to change it). So no 'mv' is needed. The old 'mv'