version: calculate version info without using git tags.

This makes it easier to integrate this version math into a submodule-ful
world. We'll continue to have regular git tags that parallel the information
in VERSION, so that builds out of this repository behave the same.

Signed-off-by: David Anderson <[email protected]>
(cherry picked from commit 437142daa5)
(altered VERSION to reflect correct information for this release branch)
This commit is contained in:
David Anderson committed 2020-11-02 15:24:36 -08:00
1 parent bb058703ee
commit 4d5d5f89a3
4 files changed
+30 -6

No files matched your search

+1
View File
@@ -0,0 +1 @@
1.2.0 bb058703ee682490124a8a9f93919c4b3a3c991d
+2 -4
View File
@@ -11,10 +11,8 @@
set -euo pipefail
describe=$(git describe --long --abbrev=9)
# --abbrev=200 is an arbitrary large number to capture the entire git
# hash without trying to compact it.
commit=$(git describe --dirty --exclude "*" --always --abbrev=200)
describe=$(./version/describe.sh)
commit=$(git rev-parse --verify --quiet HEAD)
long=$(./version/mkversion.sh long "$describe" "")
short=$(./version/mkversion.sh short "$describe" "")
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
#
# Constructs a "git describe" compatible version number by using the
# information in the VERSION file, rather than git tags.
set -eu
dir="$(dirname $0)"
verfile="$dir/../VERSION"
read -r version hash <"$verfile"
if [ -z "$hash" ]; then
# If no explicit hash was given, use the last time the version
# file changed as the "origin" hash for this version.
hash="$(git rev-list --max-count=1 HEAD -- $verfile)"
fi
if [ -z "$hash" ]; then
echo "Couldn't find base git hash for version '$version'" >2
exit 1
fi
head="$(git rev-parse --short=9 HEAD)"
changecount="$(git rev-list ${hash}..HEAD | wc -l)"
echo "v${version}-${changecount}-g${head}"
+1 -2
View File
@@ -1,4 +1,3 @@
describe=$(git describe --long --abbrev=9)
echo "$describe" >$3
./describe.sh >$3
redo-always
redo-stamp <$3