]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Be explicit about versions 768/head
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 6 May 2013 18:42:38 +0000 (20:42 +0200)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 6 May 2013 21:26:13 +0000 (23:26 +0200)
14 files changed:
.gitignore
build-scripts/jenkins-driver
build-scripts/set-version-auth
build-scripts/set-version-recursor
configure.ac
pdns/Makefile-recursor
pdns/config-recursor.h
pdns/dist-recursor
pdns/misc.cc
pdns/misc.hh
pdns/packethandler.cc
pdns/pdns_recursor.cc
pdns/receiver.cc
pdns/ws.cc

index 8dd3668efc9feba0ea0dd685a893b4efc9c3c04f..5a94d734fe6a743b352250c55d81b55ce846a09a 100644 (file)
@@ -37,3 +37,4 @@ ltversion.m4
 lt~obsolete.m4
 pdns-*.tar.gz
 .*DS_Store
+VERSION
index 019e80e90485cdd562c1fdd87b285928b047962f..5c56762f968bb1f098499e86156c61bf0a803c8e 100755 (executable)
@@ -25,4 +25,4 @@ then
         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
index 4786ce767ad918279808d1bb7cd83258d221e5cb..06163109a09813c7c6dabb734b4e730270c50b2b 100755 (executable)
@@ -4,6 +4,13 @@ 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 "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
index 358754016d11e14f6244e4326fa2c0e884f66b34..9593c9d7acad66e17ddcd868c3ab7d5f330360a6 100755 (executable)
@@ -4,5 +4,8 @@ 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=$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
index b7b4ae49f258e2496d372da373dff8bc182028b1..4899c9ba3366ff1f0ccd25616009c94ca5ca7dad 100644 (file)
@@ -1,5 +1,5 @@
 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
@@ -20,6 +20,13 @@ AC_PROG_MAKE_SET
 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])
index 6d87cdd40b6757b32cfcaa0f4c942ad71e0b5d9b..251694e12999b24e4b2000669ad6ac5ca733dfd6 100644 (file)
@@ -12,6 +12,11 @@ CC?=gcc
 
 # 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  \
index b895f743f4a63679aaa1178b07f402379002a716..491b46c653155e14b6ea1ddeb2a0633fbc36984d 100644 (file)
@@ -1,4 +1,3 @@
 #define SYSCONFDIR "/etc/powerdns/" 
 #define LOCALSTATEDIR "/var/run/" 
-#define VERSION "3.5.1"
 #define RECURSOR
index 5b7c6b0011f81b2b3fba6470ebec68d2c883ce3f..4d8fbb1e3d7677142a6f3b90ef93b58b2c575a0a 100755 (executable)
@@ -4,7 +4,20 @@ set -e
 
 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 \
@@ -37,6 +50,10 @@ cp Makefile-recursor.win32 $DIRNAME/Makefile.win32
 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
index 1032adaca91a6cb98593717c3082d447318201d7..fcde6da8dc5fb9c2086891f69755ecc666282b83 100644 (file)
@@ -43,6 +43,7 @@
 #include <sys/types.h>
 #include "utility.hh"
 #include <boost/algorithm/string.hpp>
+#include "logger.hh"
 
 bool g_singleThreaded;
 
@@ -783,3 +784,27 @@ Regex::Regex(const string &expr)
   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;
+}
index 7b1489aaac548fb2d156ddf639cc70e82c2298d4..b814c7419acedc0d7d728783368aa07323c3acdc 100644 (file)
@@ -89,6 +89,8 @@ uint16_t getShort(const char *p);
 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
 {
index 1fabbf49abb0c0c3ea901b8c09afe7e952561b93..7d5bef45c50d2dfaa44224f42d3c89c1b0b3be90 100644 (file)
@@ -265,7 +265,7 @@ int PacketHandler::doVersionRequest(DNSPacket *p, DNSPacket *r, string &target)
     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;
index 7d159675aaca20e45842c38daf0248320375e520..32db7c48dee01d59f6000e6806ed1bc2220acfc1 100644 (file)
@@ -1652,6 +1652,11 @@ void parseACLs()
   l_initialized = true;
 }
 
+static void showServiceVersion()
+{
+  showProductVersion("Recursor");
+}
+
 int serviceMain(int argc, char*argv[])
 {
   L.setName("pdns_recursor");
@@ -1666,20 +1671,7 @@ int serviceMain(int argc, char*argv[])
       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;
@@ -2060,7 +2052,7 @@ int main(int argc, char **argv)
     ::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";
@@ -2085,7 +2077,7 @@ int main(int argc, char **argv)
     
 
     ::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
@@ -2112,7 +2104,7 @@ int main(int argc, char **argv)
       exit(99);
     }
     if(::arg().mustDo("version")) {
-      cerr<<"version: "VERSION<<endl;
+      showServiceVersion();
       exit(99);
     }
 
index 2f9563d91b67fd39589f9e8f0a97216fdc003c49..0072882cfc8b12205ba573a9acf02aab3e1f4771 100644 (file)
@@ -369,7 +369,10 @@ static void loadModules()
   }
 }
 
-
+static void showServiceVersion()
+{
+  showProductVersion("Authoritative Server");
+}
 
 #ifdef __linux__
 #include <execinfo.h>
@@ -421,11 +424,7 @@ int main(int argc, char **argv)
     ::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);
     }
 
@@ -584,17 +583,8 @@ int main(int argc, char **argv)
   
   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 {
 
index 3050ccedb98700c09bfe0e686509b074492c34c0..20d14070228a521aaa809a3fc56cfdde831d3e30 100644 (file)
@@ -235,7 +235,7 @@ string StatWebServer::indexfunction(const string& method, const string& post, co
     printtable(ret,rvarmap["ring"],S.getRingTitle(rvarmap["ring"]),100);
 
   ret<<"</div></div>"<<endl;
-  ret<<"<footer class=\"row\">PowerDNS Authoritative Server "VERSION". &copy; 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"). &copy; 2013 <a href=\"http://www.powerdns.com/\">PowerDNS.COM BV</a>.</footer>"<<endl;
   ret<<"</body></html>"<<endl;
 
   return ret.str();