Skip to content

Commit 685f1f1

Browse files
committed
build-aux: Update version scripts to support rolling releases
For ABI version, we do the following 2023.1 => 2023.ABIv1 2023.1-1 => 2023.ABIv1 2023.1-1+foo5 => 2023.ABIv1 2.4.0 => 2.4.ABIv0 2.4.0-1 => 2.4.ABIv0 2.4.0-1+foo5 => 2.4.ABIv0 Empty version produces 0.0.ABIv0
1 parent 41eba2d commit 685f1f1

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

build-aux/git-abi-version-gen

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
#!/bin/sh
22

3-
## serial 1
3+
set -eu
44

5-
if test "${VERSION}" != ""; then
6-
VN=`echo ${VERSION} | sed -e "s/^\([0-9]*\.[0-9]*\)\.\([0-9]*\).*/\1.ABIv\2(${VERSION})/"`
5+
# serial 2
6+
7+
# Converts version to ABI version (discards extra information)
8+
9+
mangle_version()
10+
{
11+
case "$1" in
12+
# Convert YYYY.nn-foo+bar (rolling release) to
13+
# YYYY.ABIvnn
14+
20*[[:digit:]].*[[:digit:]])
15+
echo \"`echo $1 | sed -e "s/^\(20[0-9]*\)\.\([0-9]*\).*/\1.ABIv\2/"`\"
16+
;;
17+
# Convert 2.x.x-foo+bar and 3.x.x-foo+bar to
18+
# MAJOR.MINOR.ABIvPATCH
19+
[23].*[[:digit:]].*[[:digit:]])
20+
echo \"`echo $1 | sed -e "s/^\([0-9]*\.[0-9]*\)\.\([0-9]*\).*/\1.ABIv\2/"`\"
21+
;;
22+
*)
23+
echo "\"0.0.ABIv0\""
24+
;;
25+
esac
26+
}
27+
28+
if test "${VERSION:-}" != ""; then
29+
:
730
elif test -f version; then
8-
VN=`cat version`
9-
VN=`echo $VN | sed -e "s/^\([0-9]*\.[0-9]*\)\.\([0-9]*\).*/\1.ABIv\2($VN)/"`
31+
VERSION="`cat version`"
1032
else test -d .git;
11-
VN="0.0.ABIv0(0.0.0)"
33+
VERSION="0.0.0"
1234
fi
1335

14-
echo \"$VN\"
36+
mangle_version $VERSION

build-aux/git-tarname-version-gen

-14
This file was deleted.

build-aux/git-version-gen

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
## serial 2
3+
# serial 2
44

55
if test "${VERSION}" != ""; then
66
VN="${VERSION}"

0 commit comments

Comments
 (0)