packaging: derive Debian version from POSTIT_GIT_TAG via a changelog template

The .deb was hardcoded to 1.0.0-1 in debian/changelog regardless of
POSTIT_GIT_TAG, so 'make POSTIT_GIT_TAG=1.0.1-rc01' produced a
postit_1.0.0-1_amd64.deb (wrong name) and the trailing mv into
POSTIT_OUT_DIR silently fell back to the same wrong-name glob.

Move the version into a @VERSION@-bearing debian/changelog.in
template and render debian/changelog from it in the Makefile, before
dpkg-buildpackage runs (it reads debian/changelog during
dpkg-source --before-build, before any rule fires). debian/changelog
is .gitignored; the template is the source of truth.

debian/rules re-renders the changelog as a safety net for direct
dpkg-buildpackage invocations and adds it to override_dh_auto_clean
so partial builds leave no stale rendered file behind.
This commit is contained in:
Lum 2026-06-28 13:20:17 +01:00
commit 69ec916c4e
5 changed files with 47 additions and 13 deletions

13
debian/changelog.in vendored Normal file
View file

@ -0,0 +1,13 @@
postit (@VERSION@-1) trixie; urgency=medium
* Built from pazof/yavsc at tag @VERSION@.
* Packaged as a Debian binary package named `postit`, exposing the
`postit` command on PATH. Registers the postit:// URI scheme as
an XDG MIME handler so xdg-open postit://... launches the freshly
installed client.
* The Debian revision (`-1`) is fixed: postit-debian tracks the
packaging itself, the upstream semantic version is whatever tag
we point POSTIT_GIT_TAG at. Bump the template (or its rendered
form) only when the packaging actually changes.
-- Paul Schneider <paul@pschneider.fr> Sat, 28 Jun 2026 00:01:00 +0100