diff --git a/version.sh b/version.sh index b905470139..bd8ca48741 100755 --- a/version.sh +++ b/version.sh @@ -21,13 +21,18 @@ done # Extract revision number from file used by daily tarball snapshots # or from "git describe" output git_revision=$(cat snapshot_version 2> /dev/null) -test $git_revision || test ! -e .git || git_revision=`git describe --match "v[0-9]*" --always --tags --long` -git_revision=$(expr "$git_revision" : v*'\(.*\)') -test $git_revision || git_revision=UNKNOWN +test $git_revision || test ! -e .git || git_revision=`git rev-parse --short HEAD` +test $git_revision && git_revision=git-$git_revision +version="$git_revision" # releases extract the version number from the VERSION file -version=$(cat VERSION 2> /dev/null) -test $version || version=$git_revision +releaseversion=$(cat VERSION 2> /dev/null) +if test $releaseversion ; then + test $version && version="-$version" + version="$releaseversion$version" +fi + +test $version || version=UNKNOWN VERSION="${version}${extra}"