]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Generate version number based on git
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 22 Apr 2015 14:53:46 +0000 (16:53 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 22 Apr 2015 15:09:21 +0000 (17:09 +0200)
Distribute the generated .version file in the tarballs.
Gitignore some generated files

pdns/dnsdistdist/.gitignore [new file with mode: 0644]
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/build-aux/gen-version [new file with mode: 0755]
pdns/dnsdistdist/configure.ac

diff --git a/pdns/dnsdistdist/.gitignore b/pdns/dnsdistdist/.gitignore
new file mode 100644 (file)
index 0000000..4a1df65
--- /dev/null
@@ -0,0 +1,3 @@
+*.tar.gz
+*.tar.bz2
+.version
index 93a802db845463d078402c00c6225cb4d8bc373b..d6341f3faa6f197fb02a8e26b7dd0158034992e6 100644 (file)
@@ -16,7 +16,8 @@ EXTRA_DIST=dnslabeltext.rl \
           dnsdistconf.lua \
           README.md \
           html \
-          dnsdist.1
+          dnsdist.1\
+          .version
 
 bin_PROGRAMS = dnsdist
 dnsdist_SOURCES = \
diff --git a/pdns/dnsdistdist/build-aux/gen-version b/pdns/dnsdistdist/build-aux/gen-version
new file mode 100755 (executable)
index 0000000..a2a42a0
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+VERSION="unknown"
+
+if [ ! -z "$(git rev-parse --abbrev-ref HEAD)" ]; 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 )"
+  else
+    GIT_VERSION=$(git show --no-patch --format=format:%h HEAD)
+    BRANCH="$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/-//g')"
+    if [ "${BRANCH}" = "master" ]; then
+      VERSION="0.0.${PDNS_BUILD_NUMBER}g${GIT_VERSION}"
+    else
+      VERSION="0.0.${BRANCH}.${PDNS_BUILD_NUMBER}g${GIT_VERSION}"
+    fi
+  fi
+  echo "$VERSION" > .version
+elif [ -f .version ]; then
+  VERSION="$(cat .version)"
+fi
+
+echo $VERSION
index 1fb99480850ccdaf37c06ef870cb7997921966c9..fbe1953bc55aa95139dedda616cabc80ff4fd0d3 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([dnsdist], [0.1])
+AC_INIT([dnsdist], m4_esyscmd_s(build-aux/gen-version))
 AM_INIT_AUTOMAKE([foreign dist-bzip2 parallel-tests 1.11 subdir-objects])
 AM_SILENT_RULES([yes])
 AC_CONFIG_MACRO_DIR([m4])