From e1bcb5d479944139de416e8b08ae8f1691850dc7 Mon Sep 17 00:00:00 2001 From: abrown38 Date: Fri, 9 Oct 2026 15:28:18 +0000 Subject: [PATCH] Give development builds their own Debian package version make deb versions a build that isn't a release after the last tag: 0.2.0~rc.1+git3.gca0f148, plus the build time (.m) with uncommitted changes. apt sorts it after that RC and before the next, so installing it over the RC or an older build is an upgrade and needs no --reinstall. mkdeb.sh removes older packages of the same architecture from dist/ so the install globs match one package. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++++ Makefile | 13 +++++++++++-- docs/development.md | 9 +++++++++ scripts/mkdeb.sh | 3 +++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4519acf..8efa788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,11 @@ All notable changes to Jarl are documented here. The format follows development builds and how far past the last tag they are: `dev ca0f148b78b6 (3 commits after v0.2.0-rc.1)`. In 0.2.0-rc.1 they still printed `0.2.0-rc.1 (ca0f148b78b6)`. +- `make deb` gives development builds their own package version after + the last tag (`0.2.0~rc.1+git3.gca0f148`, plus the build time with + uncommitted changes). Installing one over the RC or an older build is + an upgrade: no more `apt install --reinstall`. It also removes older + packages from `dist/` (docs/development.md). - The view in the zone list, and on the zone page, links to that view, and the views page highlights it. It used to be plain text, and the zone page linked to the views page as a whole. diff --git a/Makefile b/Makefile index 503a921..419dbf8 100644 --- a/Makefile +++ b/Makefile @@ -41,9 +41,18 @@ DESTDIR ?= JARLD_BIN ?= bin/jarld JARL_BIN ?= bin/jarl -# make deb: the package's architecture (Debian name) and version. +# make deb: the package's architecture (Debian name) and version. A +# release is VERSION with ~ for - (0.2.0-rc.1 -> 0.2.0~rc.1, which apt +# sorts before 0.2.0). A development build is versioned after the last +# tag: 3 commits past v0.2.0-rc.1 is 0.2.0~rc.1+git3.gca0f148, which apt +# sorts after that RC and before 0.2.0, so installing it upgrades without +# --reinstall. Uncommitted changes add the build time (.m20261009153000), +# so each such build is newer than the last. DEB_ARCH ?= $(shell dpkg --print-architecture 2>/dev/null || go env GOARCH) -DEB_VERSION ?= $(subst -,~,$(VERSION)) +DEB_DEV_VERSION := $(shell [ -n '$(DESCRIBE)' ] || exit 0; \ + m=; git diff --quiet HEAD 2>/dev/null || m=.m$$(date -u +%Y%m%d%H%M%S); \ + echo '$(DESCRIBE)' | sed -E 's/^v(.*)-([0-9]+)-g([0-9a-f]{7})[0-9a-f]*$$/\1+git\2.g\3/' | tr - '~' | sed "s/$$/$$m/") +DEB_VERSION ?= $(if $(RELEASE_TAG),$(subst -,~,$(VERSION)),$(or $(DEB_DEV_VERSION),$(subst -,~,$(VERSION)))) .PHONY: all build completion test vet e2e install install-files uninstall deb dist cli-dist clean diff --git a/docs/development.md b/docs/development.md index 69c2a66..a2d00a7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -252,6 +252,15 @@ it on Gitea). Only a release build reports a version number: `RELEASE_TAG=v0.2.0 make` forces the first case. +`make deb` versions the packages the same way. A release gets `VERSION` +with `~` for `-` (`0.2.0~rc.1`). A development build gets a version after +the last tag: 3 commits past `v0.2.0-rc.1` is `0.2.0~rc.1+git3.gca0f148`, +and uncommitted changes add the build time (`.m20261009153000`). apt sorts +these after that RC and before the next one or `0.2.0`. So installing a +newer build over an older one, or over the RC, is an upgrade: plain +`apt install ./dist/…` works, without `--reinstall`. `make deb` removes +older packages of the same architecture from `dist/` first. + Pushing the same tag again (`git tag -f`, `git push -f`) re-runs it, and the script replaces the attachments and packages, so a failed release can simply be retried. diff --git a/scripts/mkdeb.sh b/scripts/mkdeb.sh index fe266cf..23f0df6 100755 --- a/scripts/mkdeb.sh +++ b/scripts/mkdeb.sh @@ -54,6 +54,9 @@ fi work=dist/deb/${DEB_VERSION}_${DEB_ARCH} stage=$work/stage rm -rf "$work" +# Older packages of this architecture (every development build has its +# own version), so 'apt install ./dist/jarl_*_amd64.deb' finds just one. +rm -f dist/jarl_*_"$DEB_ARCH".deb dist/jarl-cli_*_"$DEB_ARCH".deb mkdir -p "$stage" # Binaries for the package's architecture (bin/ holds the host's, which