DESC="${DESC} (${PDNS_TAG})"
fi
java -jar /shared/jenkins-cli.jar set-build-display-name ${JOB_NAME} ${BUILD_NUMBER} "${DESC}"
-fi
\ No newline at end of file
+fi
-#!/bin/bash
+#!/bin/bash
VERSION=$1
DEB_VERSION=$2
RPM_VERSION=$3
[ -z "$VERSION" -o -z "$DEB_VERSION" -o -z "$RPM_VERSION" ] && exit 1
+DIST_HOST="$(id -u -n)@$(hostname -f)"
+
ssed -r "s/Version: (.*)/Version: $RPM_VERSION/" -i pdns.spec
-ssed -r "s/AC_INIT\\(\\[pdns\\],\\[(.*)\\]\\)/AC_INIT\([pdns],[$VERSION\])/" -i configure.ac
+ssed -r "s/AC_INIT\(\[pdns\],(.*)/AC_INIT([pdns], [$VERSION])/" -i configure.ac
+ssed -r "s/^(.*)AC_SUBST\(\[DIST_HOST\],(.*)/AC_SUBST([DIST_HOST], [$DIST_HOST])/" -i configure.ac
ssed -r "1 s/^pdns \\(([^)]*)-([0-9.])\\)/pdns \\($DEB_VERSION-\\2\\)/" -i debian-pdns/changelog
RPM_VERSION=$3
[ -z "$VERSION" -o -z "$DEB_VERSION" -o -z "$RPM_VERSION" ] && exit 1
+DIST_HOST="$(id -u -n)@$(hostname -f)"
+
ssed -r "s/^VERSION=(.*)/VERSION=$VERSION/" -i pdns/dist-recursor
+ssed -r "s/^DIST_HOST=(.*)/DIST_HOST=$DIST_HOST/" -i pdns/dist-recursor
ssed -r "s/Version: (.*)/Version: $RPM_VERSION/" -i pdns/pdns-recursor.spec
dnl intro
-AC_INIT([pdns],[3.2])
+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_CONFIG_SRCDIR([pdns/receiver.cc])
-AM_INIT_AUTOMAKE([tar-ustar])
+AM_INIT_AUTOMAKE([tar-ustar -Wno-portability])
AC_CANONICAL_HOST
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LIBTOOL
AC_LANG_CPLUSPLUS
+AM_CONDITIONAL([RELEASE_BUILD], [test "$PACKAGE_VERSION" != "git"])
+
BOOST_REQUIRE([1.34])
BOOST_FOREACH
#BOOST_FILESYSTEM([mt])
/speedtest
/toysdig
/tsig-tests
+version_generated.h
rec_channel.o rec_channel_rec.o selectmplexer.o sillyrecords.o \
dns_random.o aescrypt.o aeskey.o aes_modes.o aestab.o dnslabeltext.o \
lua-pdns.o lua-recursor.o randomhelper.o recpacketcache.o dns.o \
-reczones.o base32.o nsecrecords.o json.o json_ws.o
+reczones.o base32.o nsecrecords.o json.o json_ws.o version.o
REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o misc.o \
unix_utility.o logger.o qtype.o
# what we need
-all: message pdns_recursor rec_control
+all: message version_generated.h pdns_recursor rec_control
+
+# Version
+build_date=$(shell LC_TIME=C date '+%Y%m%d%H%M%S')
+build_host=$(shell id -u -n)@$(shell hostname -f)
+.PHONY: version_generated.h
+version_generated.h:
+ echo '#ifndef VERSION_GENERATED_H' > $@
+ echo '#define VERSION_GENERATED_H' >> $@
+ echo '#include "config.h"' >> $@
+ echo '#define PDNS_VERSION VERSION' >> $@
+ echo '#define BUILD_DATE "$(build_date)"' >> $@
+ echo '#define BUILD_HOST "$(build_host)"' >> $@
+ echo '#endif //!VERSION_GENERATED_H' >> $@
# OS specific instructions
-include sysdeps/$(shell uname).inc
binclean:
-rm -f *.o pdns_recursor rec_control optional/*.o
-
+
dep:
$(CXX) $(CXXFLAGS) -MM -MG *.cc *.c *.hh > $@
SUBDIRS= ext/polarssl-1.1.2 backends
endif
-BUILT_SOURCES=bind-dnssec.schema.sqlite3.sql.h
+BUILT_SOURCES=bind-dnssec.schema.sqlite3.sql.h version_generated.h
noinst_SCRIPTS = pdns
sysconf_DATA = pdns.conf-dist
randomhelper.cc namespaces.hh nsecrecords.cc base32.cc dbdnsseckeeper.cc dnssecinfra.cc \
dnsseckeeper.hh dnssecinfra.hh base32.hh dns.cc dnssecsigner.cc polarrsakeyinfra.cc md5.cc \
md5.hh signingpipe.cc signingpipe.hh dnslabeltext.cc lua-pdns.cc lua-auth.cc lua-auth.hh serialtweaker.cc \
-ednssubnet.cc ednssubnet.hh cachecleaner.hh json.cc json.hh
+ednssubnet.cc ednssubnet.hh cachecleaner.hh json.cc json.hh \
+version.hh version.cc
#
pdns_server_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@ $(BOOST_SERIALIZATION_LDFLAGS) -rdynamic
if ORACLE
pdns_server_LDADD += $(ORACLE_LIBS)
endif
-
+
pdnssec_SOURCES=pdnssec.cc dbdnsseckeeper.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnswriter.hh \
misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
logger.cc statbag.cc qtype.cc sillyrecords.cc nsecrecords.cc dnssecinfra.cc dnssecinfra.hh \
aes/dns_random.cc aes/aescrypt.c aes/aeskey.c aes/aestab.c aes/aes_modes.c \
lua-pdns.cc lua-pdns.hh lua-recursor.cc lua-recursor.hh randomhelper.cc \
recpacketcache.cc recpacketcache.hh dns.cc nsecrecords.cc base32.cc cachecleaner.hh json_ws.cc json_ws.hh \
-json.cc json.hh
+json.cc json.hh version.hh version.cc
pdns_recursor_LDFLAGS= $(LUA_LIBS)
pdns_recursor_LDADD=
backends/bind/bindparser.cc:
make -C backends/bind bindparser.cc
+
+
+build_date=$(shell LC_TIME=C date '+%Y%m%d%H%M%S')
+build_host=$(shell id -u -n)@$(shell hostname -f)
+if RELEASE_BUILD
+pdns_version=$(PACKAGE_VERSION)
+dist_host=$(DIST_HOST)
+else
+git_version=$(shell git describe --always --dirty=+ 2>/dev/null)
+# Do the test in shell, so we don't confuse automake with ifeq/ifneq.
+pdns_version=$(shell test -z "$(git_version)" && echo UNKNOWN || echo "git-$(git_version)")
+dist_host=$(build_host)
+endif
+
+.PHONY: version_generated.h
+version_generated.h:
+ echo '#ifndef VERSION_GENERATED_H' > $@
+ echo '#define VERSION_GENERATED_H' >> $@
+ echo '#define PDNS_VERSION "$(pdns_version)"' >> $@
+ echo '#define DIST_HOST "$(dist_host)"' >> $@
+ echo '#define BUILD_DATE "$(build_date)"' >> $@
+ echo '#define BUILD_HOST "$(build_host)"' >> $@
+ echo '#endif //!VERSION_GENERATED_H' >> $@
#define SYSCONFDIR "/etc/powerdns/"
#define LOCALSTATEDIR "/var/run/"
-#define VERSION "3.5.1"
#define RECURSOR
ragel dnslabeltext.rl -o dnslabeltext.cc
-VERSION=3.5.1
+## The following lines will be patched by set-version-recursor.
+VERSION=""
+DIST_HOST=""
+## End patch area.
+
+if [ -z "$VERSION" ]; then
+ VERSION=$(git describe --always --dirty=+ 2>/dev/null)
+ if [ -z "$VERSION" ]; then
+ VERSION="UNKNOWN"
+ else
+ VERSION="git-"$VERSION
+ fi
+ DIST_HOST="$(id -u -n)@$(hostname -f)"
+fi
INCLUDES="iputils.hh arguments.hh base64.hh zoneparser-tng.hh \
rcpgenerator.hh lock.hh dnswriter.hh dnsrecords.hh dnsparser.hh utility.hh \
sstuff.hh mtasker.hh mtasker.cc lwres.hh logger.hh ahuexception.hh \
mplexer.hh win32_mtasker.hh win32_utility.cc ntservice.hh singleton.hh \
recursorservice.hh dns_random.hh lua-pdns.hh lua-recursor.hh namespaces.hh \
-recpacketcache.hh base32.hh cachecleaner.hh json.hh"
+recpacketcache.hh base32.hh cachecleaner.hh json.hh version.hh"
CFILES="syncres.cc misc.cc unix_utility.cc qtype.cc \
logger.cc arguments.cc lwres.cc pdns_recursor.cc \
win32_mtasker.cc win32_rec_channel.cc win32_logger.cc ntservice.cc \
recursorservice.cc sillyrecords.cc lua-pdns.cc lua-recursor.cc randomhelper.cc \
devpollmplexer.cc recpacketcache.cc dns.cc reczones.cc base32.cc nsecrecords.cc \
-dnslabeltext.cc json.cc json_ws.cc json_ws.hh"
+dnslabeltext.cc json.cc json_ws.cc json_ws.hh version.cc"
cd docs
make pdns_recursor.1 rec_control.1
cp README-recursor $DIRNAME/README
cp ../COPYING $DIRNAME/
cp config-recursor.h $DIRNAME/config.h
+cat >>$DIRNAME/config.h <<EOF
+#define VERSION "$VERSION"
+#define DIST_HOST "$DIST_HOST"
+EOF
mkdir -p $DIRNAME/ext/rapidjson/include/rapidjson/internal
cp -a ext/rapidjson/include/rapidjson/*.h $DIRNAME/ext/rapidjson/include/rapidjson/
cp -a ext/rapidjson/include/rapidjson/internal/*.h $DIRNAME/ext/rapidjson/include/rapidjson/internal
#include <sys/types.h>
#include "utility.hh"
#include <boost/algorithm/string.hpp>
+#include "logger.hh"
bool g_singleThreaded;
#include "resolver.hh"
#include "communicator.hh"
#include "dnsproxy.hh"
+#include "version.hh"
#if 0
#undef DLOG
const static string mode=::arg()["version-string"];
if(mode.empty() || mode=="full")
- rr.content="Served by POWERDNS "VERSION" $Id$";
+ rr.content=fullVersionString();
else if(mode=="anonymous") {
r->setRcode(RCode::ServFail);
return 1;
#include "mplexer.hh"
#include "config.h"
#include "lua-recursor.hh"
+#include "version.hh"
#ifndef RECURSOR
#include "statbag.hh"
L<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
}
- L<<Logger::Warning<<"PowerDNS recursor "<<VERSION<<" (C) 2001-2013 PowerDNS.COM BV ("<<__DATE__", "__TIME__;
-#ifdef __GNUC__
- L<<", gcc "__VERSION__;
-#endif // add other compilers here
-#ifdef _MSC_VER
- L<<", MSVC "<<_MSC_VER;
-#endif
- L<<") starting up"<<endl;
-
- L<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
- "This is free software, and you are welcome to redistribute it "
- "according to the terms of the GPL version 2."<<endl;
-
- L<<Logger::Warning<<"Operating in "<<(sizeof(unsigned long)*8) <<" bits mode"<<endl;
+ showProductVersion();
#if 0
unsigned int maxFDs, curFDs;
g_argc = argc;
g_argv = argv;
g_stats.startupTime=time(0);
+ versionSetProduct("Recursor");
reportBasicTypes();
reportOtherTypes();
::arg().set("packetcache-servfail-ttl", "maximum number of seconds to keep a cached servfail entry in packetcache")="60";
::arg().set("server-id", "Returned when queried for 'server.id' TXT or NSID, defaults to hostname")="";
::arg().set("remotes-ringbuffer-entries", "maximum number of packets to store statistics for")="0";
- ::arg().set("version-string", "string reported on version.pdns or version.bind")="PowerDNS Recursor "VERSION" $Id$";
+ ::arg().set("version-string", "string reported on version.pdns or version.bind")=fullVersionString();
::arg().set("allow-from", "If set, only allow these comma separated netmasks to recurse")=LOCAL_NETS;
::arg().set("allow-from-file", "If set, load allowed netmasks from this file")="";
::arg().set("entropy-source", "If set, read entropy from this file")="/dev/urandom";
::arg().setCmd("help","Provide a helpful message");
- ::arg().setCmd("version","Print version string ("VERSION")");
+ ::arg().setCmd("version","Print version string");
::arg().setCmd("config","Output blank configuration");
L.toConsole(Logger::Info);
::arg().laxParse(argc,argv); // do a lax parse
exit(99);
}
if(::arg().mustDo("version")) {
- cerr<<"version: "VERSION<<endl;
+ showProductVersion();
exit(99);
}
#include "utility.hh"
#include "common_startup.hh"
#include "dnsrecords.hh"
+#include "version.hh"
time_t s_starttime;
}
}
-
-
#ifdef __linux__
#include <execinfo.h>
static void tbhandler(int num)
//! The main function of pdns, the pdns process
int main(int argc, char **argv)
-{
+{
+ versionSetProduct("Authoritative Server");
reportAllTypes(); // init MOADNSParser
s_programname="pdns";
::arg().laxParse(argc,argv); // do a lax parse
if(::arg().mustDo("version")) {
- cerr<<"Version: "VERSION", compiled on "<<__DATE__", "__TIME__;
-#ifdef __GNUC__
- cerr<<" with gcc version "<<__VERSION__;
-#endif
- cout<<endl;
+ showProductVersion();
exit(99);
}
declareStats();
DLOG(L<<Logger::Warning<<"Verbose logging in effect"<<endl);
-
- L<<Logger::Warning<<"PowerDNS "<<VERSION<<" (C) 2001-2013 PowerDNS.COM BV ("<<__DATE__", "__TIME__;
-#ifdef __GNUC__
- L<<", gcc "__VERSION__;
-#endif // add other compilers here
- L<<") starting up"<<endl;
-
- L<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
- "This is free software, and you are welcome to redistribute it "
- "according to the terms of the GPL version 2."<<endl;
+ showProductVersion();
try {
--- /dev/null
+/*
+ PowerDNS Versatile Database Driven Nameserver
+ Copyright (C) 2002 - 2013 PowerDNS.COM BV
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "logger.hh"
+#include "version.hh"
+#include "version_generated.h"
+
+using namespace std;
+
+static string productName("");
+
+string compilerVersion()
+{
+#if defined(__clang__)
+ // clang defines __GNUC__ as well, so put it first.
+ return string("clang "__clang__version);
+#elif defined(__GNUC__)
+ return string("gcc "__VERSION__);
+#elif defined(_MSC_VER)
+ return string("MSVC "<<_MSC_VER);
+#endif // add other compilers here
+ return string("Unknown compiler");
+}
+
+void showProductVersion()
+{
+ theL()<<Logger::Warning<<"PowerDNS "<<productName<<" "<<PDNS_VERSION<<" ("DIST_HOST") "
+ "(C) 2001-2013 PowerDNS.COM BV" << endl;
+ theL()<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
+ "Built on "BUILD_DATE" by "BUILD_HOST", "<<compilerVersion()<<"."<<endl;
+ theL()<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
+ "This is free software, and you are welcome to redistribute it "
+ "according to the terms of the GPL version 2." << endl;
+}
+
+string fullVersionString()
+{
+ stringstream s;
+ s << "PowerDNS "<<productName<<" "PDNS_VERSION" ("DIST_HOST" built "BUILD_DATE" "BUILD_HOST")";
+ return s.str();
+}
+
+void versionSetProduct(string product)
+{
+ productName = product;
+}
--- /dev/null
+/*
+ PowerDNS Versatile Database Driven Nameserver
+ Copyright (C) 2002-2013 PowerDNS.COM BV
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#ifndef VERSION_HH
+#define VERSION_HH
+
+#include <string>
+#include <sstream>
+
+std::string compilerVersion();
+void showProductVersion();
+std::string fullVersionString();
+void versionSetProduct(std::string product);
+
+#endif //!VERSION_HH
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
+#include "version.hh"
using namespace rapidjson;
printtable(ret,rvarmap["ring"],S.getRingTitle(rvarmap["ring"]),100);
ret<<"</div></div>"<<endl;
- ret<<"<footer class=\"row\">PowerDNS Authoritative Server "VERSION". © 2013 <a href=\"http://www.powerdns.com/\">PowerDNS.COM BV</a>.</footer>"<<endl;
+ ret<<"<footer class=\"row\">"<<fullVersionString()<<"<br>© 2013 <a href=\"http://www.powerdns.com/\">PowerDNS.COM BV</a>.</footer>"<<endl;
ret<<"</body></html>"<<endl;
return ret.str();