diff options
| author | user <user@clank> | 2026-08-27 01:22:34 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-27 01:22:34 +0200 |
| commit | 276ea2610c783bd61789691b910b4be4dbeae890 (patch) | |
| tree | c88be298d15b4c8bd493229620f1c4ef27fe23dd /contrib | |
| parent | macos-remote-build: stop rsyncing 850M of caches to the builder (diff) | |
| download | slosh-276ea2610c783bd61789691b910b4be4dbeae890.tar.gz slosh-276ea2610c783bd61789691b910b4be4dbeae890.tar.xz slosh-276ea2610c783bd61789691b910b4be4dbeae890.zip | |
version: derive from git tags instead of a hand-bumped constant
VERSION was a constant in the Makefile that had to be bumped by hand and
could silently disagree with the git tag a release was cut from. Derive it
instead, with a committed ./VERSION as the floor and no-git fallback:
on a tag v0.2.0 -> 0.2.0
past a tag v0.2.0-5-gabc123 -> 0.2.0-5-gabc123 (sorts after 0.2.0)
before any tag 0.1.0-197-g2d1815 -> ./VERSION + commit count + short id
no .git at all 0.1.0 -> ./VERSION verbatim (cgit snapshot ->
Homebrew source build)
A dirty tree appends -dirty. The commit count keeps 'brew upgrade' ordering
monotonic before the first tag exists.
version.h now bakes just VERSION (dropping the redundant +GITDESC, which the
derived string already carries). contrib/brew-release reads the base from
./VERSION rather than grepping the Makefile's VERSION line, which is now a
$(shell ...) expression it could not parse.
Diffstat (limited to 'contrib')
| -rwxr-xr-x | contrib/brew-release | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/brew-release b/contrib/brew-release index d3eadda..dbaf526 100755 --- a/contrib/brew-release +++ b/contrib/brew-release @@ -84,8 +84,13 @@ esac # A tag must look like a version (digits with a dot); "1368b7f" starts with a # digit but is a commit, and calling it version 1368b7f would be a lie brew # could never climb down from. -mkver="$(sed -n 's/^VERSION *:*= *//p' "$root/Makefile" | head -1)" -[ -n "$mkver" ] || fail "no VERSION in $root/Makefile" +# The base/floor version. It lives in ./VERSION (one line, e.g. 0.1.0), which +# is also what the Makefile bakes into a source build that has no git and the +# floor it builds tag-less versions on top of. It used to be grepped out of the +# Makefile's `VERSION :=` line; that line is now a $(shell ...) derivation, so +# read the file both of them trust instead. +mkver="$(sed -n '1s/[[:space:]]*$//p' "$root/VERSION" 2>/dev/null | head -1)" +[ -n "$mkver" ] || fail "no base version in $root/VERSION" short="$(printf '%s' "$full" | cut -c1-7)" # The count must be a real count. Falling back to 0 when the commit is not in # this clone would mint "0.1.0-0-<short>", which brew reads as older than every |
