]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - build-aux/gen-version
Merge pull request #7825 from rgacogne/dnsdist-snirule
[thirdparty/pdns.git] / build-aux / gen-version
index a531f28ceab8ccb037576f844694b0f993906358..a2ff215567020ef5ef6597aa44c7c635cd093206 100755 (executable)
@@ -1,11 +1,18 @@
 #!/bin/sh
+
+if [ ! -z "$BUILDER_VERSION" ]; then
+  printf $BUILDER_VERSION
+  echo $BUILDER_VERSION > .version
+  exit 0
+fi
+
 VERSION="unknown"
 
 DIRTY=""
 git status | grep -q clean || DIRTY='.dirty'
 
 # Special environment variable to signal that we are building a release, as this
-# has condequenses for the version number.
+# has consequences for the version number.
 if [ "${IS_RELEASE}" = "YES" ]; then
   TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)"
   if [ -n "${TAG}" ]; then
@@ -24,7 +31,7 @@ fi
 if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
   if $(git rev-parse --abbrev-ref HEAD | grep -q 'rel/'); then
     REL_TYPE="$(git rev-parse --abbrev-ref HEAD | cut -d/ -f 2 | cut -d- -f 1)"
-    VERSION="$(git describe --match=${REL_TYPE}-* --dirty=.dirty | cut -d- -f 2-)"
+    VERSION="$(git describe --match=${REL_TYPE}-* --tags --dirty=.dirty | cut -d- -f 2-)"
   else
     GIT_VERSION=$(git show --no-patch --format=format:%h HEAD)
     BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')"