Skip to content

Commit

Permalink
Set the source version number in a clean fashion
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
pieterlexis committed Jun 10, 2015
1 parent ee89aae commit a4e9add
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -2,7 +2,8 @@
/Makefile.in
/aclocal.m4
/autom4te.cache
/build-aux/
/build-aux/*
!/build-aux/gen-version
/config.cache
/config.guess
/config.h
Expand All @@ -25,6 +26,7 @@
.deps
.libs
.dirstamp
.version
codedocs/Makefile
codedocs/Makefile.in
/config.log
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Expand Up @@ -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 \
Expand Down
20 changes: 20 additions & 0 deletions 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
5 changes: 1 addition & 4 deletions 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])
Expand Down
14 changes: 6 additions & 8 deletions pdns/build-recursor
Expand Up @@ -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
1 change: 1 addition & 0 deletions pdns/dist-recursor
Expand Up @@ -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/*~
Expand Down
5 changes: 4 additions & 1 deletion pdns/secpoll-auth.cc
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion pdns/secpoll-recursor.cc
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pdns/sysdeps-recursor/Linux.inc
Expand Up @@ -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
Expand Down

0 comments on commit a4e9add

Please sign in to comment.