Skip to content

Commit f25a3d1

Browse files
committed
fix handling of new semver-style version
Move version extraction to a script, anfs-version. Change-Id: I52e61c1341e57104060b4b7681b770855f50e17d Reviewed-on: https://gerrit.franz.com:9080/c/nfs/+/17448 Tested-by: Kevin Layer <layer@franz.com> Reviewed-by: Kevin Layer <layer@franz.com>
1 parent 8090ef5 commit f25a3d1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ MAKENSIS ?= "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe"
5050
# The variable VER_SUFFIX specifies a modifier appended to the
5151
# name of the installer and to the name of the installed application.
5252

53-
version := $(shell grep 'defvar .nfsd-version' nfs-common.cl | sed -e 's,.*"\([a-z0-9.]*\)".*,\1,')
54-
major-version := $(shell echo $(version) | sed -e 's/\(.*\)\.[0-9]*/\1/')
53+
version := $(shell ./anfs-version)
5554

5655
default: build
5756

anfs-version

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
# print the version in nfs-common.cl to stdout
3+
4+
set -eu
5+
6+
string="$(grep 'defvar .nfsd-version' nfs-common.cl)"
7+
8+
if [[ $string =~ nfsd-version..\"([0-9]+)\.([0-9]+)\.([0-9]+)(-(beta[0-9]+))?\" ]]
9+
then
10+
if [ "${BASH_REMATCH[5]-}" ]; then
11+
echo ${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}-${BASH_REMATCH[5]}
12+
else
13+
echo ${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}
14+
fi
15+
else
16+
echo $0: could not extract version from $* 1>&2
17+
fi
18+

0 commit comments

Comments
 (0)