]> granicus.if.org Git - pdns/commitdiff
Set the source version number in a clean fashion
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 3 Apr 2015 16:04:10 +0000 (18:04 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 10 Jun 2015 07:44:01 +0000 (09:44 +0200)
This commit changes the version number of the tarball created by 'make
dist'. One can set PDNS_BUILD_NUMBER to create incremental version
numbers. This commit also adds a message to secpoll about PowerDNS being
from git and not a released version.

The version produced depends on the branch:

master: 0.0.${PDNS_BUILD_NUMBER}g${GIT_HASH}
rel/*: ${PREVIOUS_TAG}-${NUM_COMMITS_AFTER_TAG}-${GIT_HASH}
any other: 0.0.${BRANCH_NAME}.${PDNS_BUILD_NUM}g${GIT_HASH}

.gitignore
Makefile.am
build-aux/gen-version [new file with mode: 0755]
configure.ac
pdns/build-recursor
pdns/dist-recursor
pdns/secpoll-auth.cc
pdns/secpoll-recursor.cc
pdns/sysdeps-recursor/Linux.inc

index 9fe812cee905ffd990ac4b72302985fdad70cf43..4c79ab6406fed38a5b731cfd8aff17ca64f83b63 100644 (file)
@@ -2,7 +2,8 @@
 /Makefile.in
 /aclocal.m4
 /autom4te.cache
-/build-aux/
+/build-aux/*
+!/build-aux/gen-version
 /config.cache
 /config.guess
 /config.h
@@ -25,6 +26,7 @@
 .deps
 .libs
 .dirstamp
+.version
 codedocs/Makefile
 codedocs/Makefile.in
 /config.log
index 1a1b7aae1e10446aae3053009a514819d1173934..d36ebdfb22a0618b19da15efc67583bb34be4849 100644 (file)
@@ -8,6 +8,8 @@ EXTRA_DIST = \
        INSTALL \
        NOTICE \
        README \
+       .version \
+       build-aux/gen-version \
        build-scripts/redhat/pdns-server-test.spec \
        build-scripts/semistaticg++ \
        codedocs/doxygen.conf \
diff --git a/build-aux/gen-version b/build-aux/gen-version
new file mode 100755 (executable)
index 0000000..d761c56
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+VERSION="unknown"
+
+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-)"
+  else
+    GIT_VERSION=$(git show --no-patch --format=format:%h HEAD)
+    BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/-//g;')"
+    [ "${BRANCH}" = ".master" ] && BRANCH=''
+    git status | grep -q clean || DIRTY='.dirty'
+    VERSION="0.0${BRANCH}.${PDNS_BUILD_NUMBER}g${GIT_VERSION}${DIRTY}"
+  fi
+  echo "$VERSION" > .version
+elif [ -f .version ]; then
+  VERSION="$(cat .version)"
+fi
+
+echo $VERSION
index 4b81411c51d4794c392081f43e61986c15bb706f..80f1cf65df24c145580f97596b086ad987a2d55e 100644 (file)
@@ -1,9 +1,6 @@
 AC_PREREQ([2.61])
 
-dnl The following lines may be patched by set-version-auth.
-AC_INIT([pdns], [git])
-dnl AC_SUBST([DIST_HOST], [TO_BE_PATCHED])
-dnl End patch area.
+AC_INIT([pdns], m4_esyscmd_s(build-aux/gen-version))
 
 AC_CONFIG_SRCDIR([pdns/receiver.cc])
 AC_CONFIG_MACRO_DIR([m4])
index 380b0c06da921b6e831f5ab5b17027de9aa67026..80888cb0c24981d9ec5619bb2811ec0a024bc9c4 100755 (executable)
@@ -16,20 +16,18 @@ fi
 
 cd pdns-recursor-$VERSION
 export DEBFULLNAME="PowerDNS.COM BV"
-if echo $VERSION | grep -q ^git
-then
-       DEBPKGNAME=pdns-recursor_0.0-$VERSION
-else
-       DEBPKGNAME=pdns-recursor_$VERSION
-fi
+DEBPKGNAME=pdns-recursor_$VERSION
+
 dh_make -e powerdns.support@powerdns.com -s -f ../pdns-recursor-$VERSION.tar.bz2 -p $DEBPKGNAME < /dev/null
 cp pdns-recursor.init.d debian/init.d
 #[ -e debian/control ] || dh_make -e powerdns.support@powerdns.com -s -r cdbs  -f ../pdns-recursor-$VERSION.tar.bz2  < /dev/null
 perl -i -pe 's/Description: <.*>/Description: extremely powerful and versatile recursing nameserver/' debian/control
 # only to be nice to people usind the generated .dsc
-perl -i -pe 's/(Build-Depends: .*)/$1, libboost-dev, libboost-serialization-dev, liblua5.1-0-dev/' debian/control
+perl -i -pe 's/(Build-Depends: .*)/$1, libboost-dev, libboost-serialization-dev, liblua5.2-0-dev/' debian/control
+# Fix the rpm version number
+perl -i -pe "s/Version: .*/Version: ${VERSION}/" pdns-recursor.spec
 export LUA=1
 export STATIC=semi
 ./configure
 fakeroot debian/rules binary
-fakeroot rpmbuild -bb ../pdns-recursor.spec
+fakeroot rpmbuild -bb pdns-recursor.spec
index 4cd08e20690604fe693bbbc803e20e089a5ffb19..6e085bbf341689fe44eefce0a3e0dd71729f0669 100755 (executable)
@@ -78,6 +78,7 @@ mkdir -p $DIRNAME/contrib
 cp ../contrib/systemd-pdns-recursor.service $DIRNAME/contrib
 mkdir -p $DIRNAME/build-scripts/redhat
 cp ../build-scripts/redhat/pdns-recursor-test.spec $DIRNAME/build-scripts/redhat
+cp pdns-recursor.spec $DIRNAME
 
 mkdir -p $DIRNAME/sysdeps
 rm -f sysdeps-recursor/*~
index fb27bf622ab257348597df7048adae247df75bf2..a2f2c7237c703cb860027004465fba32507e0ab5 100644 (file)
@@ -167,8 +167,11 @@ void doSecPoll(bool first)
   }
   else {
     string pkgv(PACKAGEVERSION);
-    if(pkgv.find("git"))
+    if(pkgv.find("0.0."))
       L<<Logger::Warning<<"Could not retrieve security status update for '" + pkgv + "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
+    else
+      L<<Logger::Warning<<"Not validating response for security status update, this a non-release version."<<endl;
+
     if(security_status == 1) // it was ok, not it is unknown
       security_status = 0;
   }
index e70d896013dbe3a9fe8591b361b0c24e81c09c31..ba76bcd6ddd1d185f6fef37e454e86c67efcafba 100644 (file)
@@ -51,8 +51,11 @@ void doSecPoll(time_t* last_secpoll)
   }
   else {
     string pkgv(PACKAGEVERSION);
-    if(pkgv.find("git"))
+    if(pkgv.find("0.0."))
       L<<Logger::Warning<<"Could not retrieve security status update for '" +pkgv+ "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
+    else
+      L<<Logger::Warning<<"Not validating response for security status update, this a non-release version."<<endl;
+
     if(g_security_status == 1) // it was ok, not it is unknown
       g_security_status = 0;
     if(res == RCode::NXDomain) // if we had servfail, keep on trying more more frequently
index 4bb042f830e8f8c9b700fadd3f8e1895f4c601d8..f96a518d4fec3d71ce2e6b443afa91a5245aca05 100644 (file)
@@ -8,8 +8,8 @@ endif
 CXXFLAGS := $(CXXFLAGS) -D_GNU_SOURCE -DHAVE_STRCASESTR -std=gnu++11
 CFLAGS := $(CFLAGS) -D_GNU_SOURCE
 
-LUA_CPPFLAGS_CONFIG ?= -I/usr/include/lua5.1
-LUA_LIBS_CONFIG ?= -llua5.1 -rdynamic
+LUA_CPPFLAGS_CONFIG ?= -I/usr/include/lua5.2
+LUA_LIBS_CONFIG ?= -llua5.2 -rdynamic
 
 # Lua 5.0 settings
 #LUA_CPPFLAGS_CONFIG=-I/usr/include/lua50