diff --git a/tools/version.sh b/tools/version.sh index 813c97a106..cf7027045e 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -88,9 +88,12 @@ OUTFILE=$1 if [ -z ${VERSION} ] ; then VERSION=`git -C ${WD} describe 2>/dev/null | tail -1 | cut -d'-' -f2` - if [[ ! ${VERSION} =~ ([0-9]+).([0-9]+).([0-9]+) ]] ; then - VERSION=`git -C ${WD} tag --sort=v:refname | tail -1 | cut -d'-' -f2` + # If the VERSION does not match X.Y.Z, retrieve version from the tag + + if [[ ! ${VERSION} =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]] ; then + VERSION=`git -C ${WD} tag --sort=v:refname | grep -E "[0-9]+\.[0-9]+\.[0-9]+" | tail -1 | cut -d'-' -f2` fi + fi # Make sure we know what is going on