From a4e9add535bbeaf442e4c09abde9c9ff9f41c0d3 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 3 Apr 2015 18:04:10 +0200 Subject: [PATCH] Set the source version number in a clean fashion 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 | 4 +++- Makefile.am | 2 ++ build-aux/gen-version | 20 ++++++++++++++++++++ configure.ac | 5 +---- pdns/build-recursor | 14 ++++++-------- pdns/dist-recursor | 1 + pdns/secpoll-auth.cc | 5 ++++- pdns/secpoll-recursor.cc | 5 ++++- pdns/sysdeps-recursor/Linux.inc | 4 ++-- 9 files changed, 43 insertions(+), 17 deletions(-) create mode 100755 build-aux/gen-version diff --git a/.gitignore b/.gitignore index 9fe812cee..4c79ab640 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile.am b/Makefile.am index 1a1b7aae1..d36ebdfb2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 000000000..d761c566a --- /dev/null +++ b/build-aux/gen-version @@ -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 diff --git a/configure.ac b/configure.ac index 4b81411c5..80f1cf65d 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/pdns/build-recursor b/pdns/build-recursor index 380b0c06d..80888cb0c 100755 --- a/pdns/build-recursor +++ b/pdns/build-recursor @@ -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 diff --git a/pdns/dist-recursor b/pdns/dist-recursor index 4cd08e206..6e085bbf3 100755 --- a/pdns/dist-recursor +++ b/pdns/dist-recursor @@ -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/*~ diff --git a/pdns/secpoll-auth.cc b/pdns/secpoll-auth.cc index fb27bf622..a2f2c7237 100644 --- a/pdns/secpoll-auth.cc +++ b/pdns/secpoll-auth.cc @@ -167,8 +167,11 @@ void doSecPoll(bool first) } else { string pkgv(PACKAGEVERSION); - if(pkgv.find("git")) + if(pkgv.find("0.0.")) L<