lt~obsolete.m4
pdns-*.tar.gz
.*DS_Store
+VERSION
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
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 "1 s/^pdns \\(([^)]*)-([0-9.])\\)/pdns \\($DEB_VERSION-\\2\\)/" -i debian-pdns/changelog
+
+cat >VERSION <<EOF
+# This file is automatically generated by set-version-auth, DO NOT EDIT.
+VERSION="$VERSION"
+DIST_HOST="$DIST_HOST"
+EOF
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])
+AC_INIT([pdns], m4_esyscmd_s([test -f ./VERSION && (. ./VERSION; echo $VERSION) || (git describe --always 2>/dev/null || echo "exported")]))
AC_CONFIG_SRCDIR([pdns/receiver.cc])
AM_INIT_AUTOMAKE([tar-ustar])
AC_CANONICAL_HOST
AC_PROG_LIBTOOL
AC_LANG_CPLUSPLUS
+AC_DEFINE([DIST_HOST], m4_esyscmd_s([test -f ./VERSION && (. ./VERSION; echo \"$DIST_HOST\") || (echo \"$(id -u -n)@$(hostname -f)\")]), [Where sources were built.])
+
+build_date=$(LC_TIME=C date '+%Y%m%d%H%M%S')
+AC_DEFINE_UNQUOTED([BUILD_DATE], ["$build_date"], [When binaries were built.])
+build_host=$(id -u -n)@$(hostname -f)
+AC_DEFINE_UNQUOTED([BUILD_HOST], ["$build_host"], [Where binaries were built.])
+
BOOST_REQUIRE([1.34])
BOOST_FOREACH
#BOOST_FILESYSTEM([mt])
# Lua 5.1 settings
+BUILD_DATE=$(shell LC_TIME=C date '+%Y%m%d%H%M%S')
+BUILD_HOST=$(shell id -u -n)@$(shell hostname -f)
+CFLAGS:=$(CFLAGS) -DBUILD_HOST=\"$(BUILD_HOST)\" -DBUILD_DATE=\"$(BUILD_DATE)\"
+CXXFLAGS:=$(CXXFLAGS) -DBUILD_HOST=\"$(BUILD_HOST)\" -DBUILD_DATE=\"$(BUILD_DATE)\"
+
# static dependencies
PDNS_RECURSOR_OBJECTS=syncres.o misc.o unix_utility.o qtype.o logger.o \
#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 rev-parse HEAD 2>/dev/null)
+ if [ -z "$VERSION" ]; then
+ VERSION="exported"
+ 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 \
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;
if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
throw AhuException("Regular expression did not compile");
}
+
+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(string product)
+{
+ L<<Logger::Warning<<"PowerDNS "<<product<<" "<<VERSION<<" ("DIST_HOST") "
+ "(C) 2001-2013 PowerDNS.COM BV" << endl;
+ L<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
+ "Built on "BUILD_DATE" by "BUILD_HOST", "<<compilerVersion()<<"."<<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;
+}
uint32_t getLong(const unsigned char *p);
uint32_t getLong(const char *p);
int logFacilityToLOG(unsigned int facility);
+string compilerVersion();
+void showProductVersion(string product);
struct ServiceTuple
{
const static string mode=::arg()["version-string"];
if(mode.empty() || mode=="full")
- rr.content="Served by POWERDNS "VERSION" $Id$";
+ rr.content="Served by PowerDNS "VERSION" "DIST_HOST" built "BUILD_DATE" "BUILD_HOST;
else if(mode=="anonymous") {
r->setRcode(RCode::ServFail);
return 1;
l_initialized = true;
}
+static void showServiceVersion()
+{
+ showProductVersion("Recursor");
+}
+
int serviceMain(int argc, char*argv[])
{
L.setName("pdns_recursor");
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;
+ showServiceVersion();
#if 0
unsigned int maxFDs, curFDs;
::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")="PowerDNS Recursor "VERSION" "DIST_HOST" built "BUILD_DATE" "BUILD_HOST;
::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;
+ showServiceVersion();
exit(99);
}
}
}
-
+static void showServiceVersion()
+{
+ showProductVersion("Authoritative Server");
+}
#ifdef __linux__
#include <execinfo.h>
::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;
+ showServiceVersion();
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;
+ showServiceVersion();
try {
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\">PowerDNS Authoritative Server "VERSION" ("DIST_HOST" built "BUILD_DATE" by "BUILD_HOST"). © 2013 <a href=\"http://www.powerdns.com/\">PowerDNS.COM BV</a>.</footer>"<<endl;
ret<<"</body></html>"<<endl;
return ret.str();