Makefile: glue DPKG_ARCH_ARGS, eval, dpkg-buildpackage on one line
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 2m8s

The previous version put DPKG_ARCH_ARGS on its own logical line
and 'eval ... && dpkg-buildpackage' on the next, but each make
recipe line runs in its own shell. So when 'eval' ran, the
$DPKG_ARCH_ARGS variable from the previous shell was already
gone — 'eval' saw an empty argument and produced no DEB_HOST_ARCH
override, which made dpkg-buildpackage default to amd64.

Collapse everything onto one logical line (one shell invocation),
joining with '&&' so a failure in 'case' or 'dpkg-architecture'
short-circuits before dpkg-buildpackage runs.
This commit is contained in:
Paul Schneider 2026-08-17 18:12:09 +01:00
commit 543f68c7b9
No known key found for this signature in database
GPG key ID: 1E66C65EE2B46F1B

View file

@ -49,18 +49,12 @@ deb:
# For linux-x64, it sets the host arch to amd64 explicitly
# (which matches the runner — no-op, but keeps the call site
# uniform). Other RIDs are rejected.
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)
# dpkg-architecture with no -t/-a flags just prints the arch
# info; with -aarm64, it exports the variables needed for a
# cross-build targeting arm64. Use 'eval' to put those vars
# in the environment of the next command.
# Chain 'eval' and 'dpkg-buildpackage' on a single shell line
# so the exported vars from dpkg-architecture are visible
# to dpkg-buildpackage. Each recipe line runs in its own
# shell, so an 'eval' on one line wouldn't affect the next.
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
# Compute DPKG_ARCH_ARGS, eval dpkg-architecture, then call
# dpkg-buildpackage — all in ONE shell invocation so the
# vars set by dpkg-architecture are visible to dpkg-buildpackage.
# make runs each recipe line in its own shell, so we use
# 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-buildpackage already writes the produced .deb to
# /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
# flag to change it). So no 'mv' is needed. The old 'mv'