Makefile: drop the 'mv' step — it was always 'same file'
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 2m8s

dpkg-buildpackage -b writes the produced .deb to the parent of
the source directory (/src/_src/.. = /src/, which is
by default). The 'mv ../postit_*.deb $POSTIT_OUT_DIR/' step was
therefore trying to move a file onto itself — every build
exited with 'mv: ... are the same file' and make exited 1.

The earlier 'rm -f ../postit_*.deb' cleanup never had anything
to remove (dpkg-deb hadn't run yet), and even if it had, the
build step would have produced a new .deb at the same path
before the mv had a chance to act.

Drop the mv entirely. Just verify the .deb is there after
dpkg-buildpackage; fail loudly if not.
This commit is contained in:
Paul Schneider 2026-08-17 17:39:38 +01:00
commit f8718dfb8b
No known key found for this signature in database
GPG key ID: 1E66C65EE2B46F1B

View file

@ -39,25 +39,22 @@ deb:
# debian/changelog.in, regardless of POSTIT_GIT_TAG. # debian/changelog.in, regardless of POSTIT_GIT_TAG.
sed 's/@VERSION@/$(POSTIT_GIT_TAG)/g' debian/changelog.in > debian/changelog sed 's/@VERSION@/$(POSTIT_GIT_TAG)/g' debian/changelog.in > debian/changelog
# Remove any residual .deb from previous runs (same name # Remove any residual .deb from previous runs (same name
# pattern would otherwise make the final 'mv' complain # pattern would otherwise be re-used by dpkg-deb if the
# about source and destination being the same file). # previous run left it lying around).
rm -f ../postit_*$(POSTIT_GIT_TAG)-1*.deb ../postit_*.buildinfo ../postit_*.changes rm -f ../postit_*$(POSTIT_GIT_TAG)-1*.deb ../postit_*.buildinfo ../postit_*.changes
POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) \ POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) \
dpkg-buildpackage -us -uc -b dpkg-buildpackage -us -uc -b
# Move the produced .deb(s) into $POSTIT_OUT_DIR. The version # dpkg-buildpackage already writes the produced .deb to
# segment we match against is the rendered changelog version # /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
# (e.g. 1.0.1-rc01-1), not the bare tag. # flag to change it). So no 'mv' is needed. The old 'mv'
# # caused a 'same file' error when the destination was the
# Two-stage mv: try the specific version first (more reliable), # same as the source (which it always is). Just verify the
# fall back to any .deb if the glob doesn't expand (e.g. the # .deb was actually produced.
# version suffix differs). No final \`|| true\` — a silent if ! ls ../postit_*$(POSTIT_GIT_TAG)-1*.deb >/dev/null 2>&1; then \
# fallback was masking real dpkg-buildpackage failures (the echo " ERROR: dpkg-buildpackage produced no .deb for POSTIT_GIT_TAG=$(POSTIT_GIT_TAG)" >&2; \
# fallback was matching leftover .deb from previous runs and exit 1; \
# returning 0 even when the current build had produced nothing). fi
DEB_GLOB=$$(ls ../postit_*$(POSTIT_GIT_TAG)-1*.deb 2>/dev/null || ls ../postit_*.deb 2>/dev/null || true); \ @echo " ✓ artifacts in $(POSTIT_OUT_DIR)"
if [ -z "$$DEB_GLOB" ]; then echo " ERROR: dpkg-buildpackage produced no .deb for POSTIT_GIT_TAG=$(POSTIT_GIT_TAG)" >&2; exit 1; fi; \
mv $$DEB_GLOB $(POSTIT_OUT_DIR)/
@echo " ✓ artifacts moved to $(POSTIT_OUT_DIR)"
clean: clean:
rm -rf build debian/postit rm -rf build debian/postit