diff --git a/.gitignore b/.gitignore index 9fe812cee905..4c79ab6406fe 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 1a1b7aae1e10..d36ebdfb22a0 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 000000000000..d761c566ab59 --- /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 4b81411c51d4..80f1cf65df24 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 380b0c06da92..80888cb0c249 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 4cd08e206906..6e085bbf3416 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 fb27bf622ab2..a2f2c7237c70 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<