]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use latest tag for version numbers 7822/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 15 May 2019 09:12:18 +0000 (11:12 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 20 May 2019 12:44:49 +0000 (14:44 +0200)
As Debian broke our 0.0.0 with a 'Breaks' in libstdc++, we now use the
last released version number (when building a single product) so users
can keep installing packages built from master on Debian.

Closes #7781

builder
builder-support/gen-version

diff --git a/builder b/builder
index 4f5ab935098ebacd6b55e89b405bd69e80ab2baf..6176c5f68354ca82814ef20a4c87327785157ff3 160000 (submodule)
--- a/builder
+++ b/builder
@@ -1 +1 @@
-Subproject commit 4f5ab935098ebacd6b55e89b405bd69e80ab2baf
+Subproject commit 6176c5f68354ca82814ef20a4c87327785157ff3
index a3eb581319eb1b4ad14b071ca3743dbd4273e6bb..4411794d7244775ea3ff958d686fabe49db21d1a 100755 (executable)
@@ -10,7 +10,7 @@ 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 consequenses 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
@@ -27,17 +27,26 @@ fi
 # Generate the version number based on the branch
 #
 if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
-  GIT_VERSION=""
-  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)"
-    GIT_VERSION="$(git describe --match=${REL_TYPE}-* --tags | cut -d- -f2-)"
+  if [ -n "${BUILDER_MODULES}" ]; then
+    match=${BUILDER_MODULES}
+    [ $match = "authoritative" ] && match='auth'
+    [ $match = "recursor" ] && match='rec'
+    GIT_VERSION="$(git describe --match=${match}-* --tags | cut -d- -f2-)"
+    if [ $(echo ${GIT_VERSION} | awk -F"-" '{print NF-1}') = '3' ]; then
+      # A prerelease happened before
+      LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1-2)"
+      COMMITS_SINCE_TAG="$(echo ${GIT_VERSION} | cut -d- -f3)"
+      GIT_HASH="$(echo ${GIT_VERSION} | cut -d- -f4)"
+    else
+      LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1)"
+      COMMITS_SINCE_TAG="$(echo ${GIT_VERSION} | cut -d- -f2)"
+      GIT_HASH="$(echo ${GIT_VERSION} | cut -d- -f3)"
+    fi
   fi
 
-  LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1)"
-  COMMITS_SINCE_TAG="$(echo ${GIT_VERSION} | cut -d- -f2)"
-  GIT_HASH="$(echo ${GIT_VERSION} | cut -d- -f3)"
-
   if [ -z "${GIT_VERSION}" ]; then
+    # BUILDER_SUPPORT has more than one product listed, fall back to the 0.0.0 logic
+
     # We used 0.0.XXXXgHASH for master in the previous incarnation of our build pipeline.
     # This now becomes 0.0.XXXX.0.gHASH, as 0.0.0.XXXX.gHASH (which is more correct)
     # would break upgrades for those running master
@@ -45,11 +54,10 @@ if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
     LAST_TAG=0.0
     COMMITS_SINCE_TAG="$(git rev-list --count 12c868770afc20b6cc0da439d881105151d557dd..HEAD 2> /dev/null).0"
     [ "${COMMITS_SINCE_TAG}" = ".0" ] && COMMITS_SINCE_TAG=0.0
-    GIT_HASH="$(git rev-parse HEAD | cut -c1-10 2> /dev/null)"
+    GIT_HASH="g$(git rev-parse HEAD | cut -c1-10 2> /dev/null)"
   fi
 
   BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')"
-  [ "${BRANCH}" = ".master" ] && BRANCH=''
 
   TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)"
   if [ -n "${TAG}" ]; then # We're exactly on a tag
@@ -60,7 +68,7 @@ if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
     fi
   fi
 
-  VERSION="${LAST_TAG}.${COMMITS_SINCE_TAG}${BRANCH}.g${GIT_HASH}${DIRTY}"
+  VERSION="${LAST_TAG}.${COMMITS_SINCE_TAG}${BRANCH}.${GIT_HASH}${DIRTY}"
 fi
 
 printf $VERSION