]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Have a flag to enable reproducible builds
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 7 May 2015 12:14:10 +0000 (14:14 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 10 Jun 2015 07:44:02 +0000 (09:44 +0200)
 * Add Date and Time back to the modules

21 files changed:
configure.ac
m4/pdns_enable_reproducible.m4 [new file with mode: 0644]
modules/bindbackend/bindbackend2.cc
modules/geobackend/geobackend.hh
modules/geoipbackend/geoipbackend.cc
modules/gmysqlbackend/gmysqlbackend.cc
modules/goraclebackend/goraclebackend.cc
modules/gpgsqlbackend/gpgsqlbackend.cc
modules/gsqlite3backend/gsqlite3backend.cc
modules/ldapbackend/ldapbackend.cc
modules/lmdbbackend/lmdbbackend.cc
modules/luabackend/luabackend.cc
modules/mydnsbackend/mydnsbackend.cc
modules/opendbxbackend/odbxbackend.hh
modules/oraclebackend/oraclebackend.cc
modules/pipebackend/pipebackend.cc
modules/randombackend/randombackend.cc
modules/remotebackend/remotebackend.cc
modules/tinydnsbackend/tinydnsbackend.cc
pdns/configure-recursor
pdns/version.cc

index 4c05ab5e95aaa4c2fc4d0e007d64bffc926c3bd5..2093bb7997ad9dccfcf81496ecb1dac6d658eccd 100644 (file)
@@ -27,7 +27,6 @@ PDNS_CHECK_FLEX
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 
-
 AC_PROG_CXX
 AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
   AC_MSG_ERROR([no C++ compiler found])
@@ -119,6 +118,7 @@ BOOST_PROGRAM_OPTIONS([mt])
 BOOST_SERIALIZATION([mt])
 
 PDNS_ENABLE_UNIT_TESTS
+PDNS_ENABLE_REPRODUCIBLE
 
 PDNS_WITH_SQLITE3
 
diff --git a/m4/pdns_enable_reproducible.m4 b/m4/pdns_enable_reproducible.m4
new file mode 100644 (file)
index 0000000..53c13a1
--- /dev/null
@@ -0,0 +1,18 @@
+AC_DEFUN([PDNS_ENABLE_REPRODUCIBLE], [
+  AC_MSG_CHECKING([whether to enable reproducible builds.])
+  AC_ARG_ENABLE([reproducible],
+    AS_HELP_STRING([--enable-reproducible],
+      [Create reproducible builds. Use this only if you are a distribution maintainer and need reproducible builds. If you compile PowerDNS yourself, leave this disabled, as it might make debugging harder. @<:@default=no@:>@]),
+    [enable_reproducible=$enableval],
+    [enable_reproducible=no])
+
+  AC_MSG_RESULT($enable_reproducible)
+
+  AS_IF([test x"$enable_reproducible" = "xyes"],[
+    AC_DEFINE([REPRODUCIBLE], [1], [Define to 1 for reproducible builds])
+  ],[
+    build_user=m4_esyscmd_s(id -u -n)
+    build_host=m4_esyscmd_s(hostname -f || hostname)
+    AC_DEFINE_UNQUOTED([BUILD_HOST], ["$build_user@$build_host"], [Set to the user and host that builds PowerDNS])
+  ])
+])
index fd7456ef50951a6fce913a8c470d921f1aef70ca..555c5f5fc94c3ea2c4e822250e6e1b04a3c081d1 100644 (file)
@@ -1350,7 +1350,11 @@ public:
   Bind2Loader()
   {
     BackendMakers().report(new Bind2Factory);
-    L << Logger::Info << "[bind2backend] This is the bind backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[bind2backend] This is the bind backend version " << VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 static Bind2Loader bind2loader;
index 370f1b1fc5d0f75f7d96270c11d71d3319236e9f..e5bbf9c6c7198e5c0711f1a6b10a06d3f770be8c 100644 (file)
@@ -106,7 +106,11 @@ class GeoLoader {
 public:
         GeoLoader() {
                BackendMakers().report(new GeoFactory);
-               L << Logger::Info << "[geobackend] This is the geo backend version " VERSION " reporting" << endl;
+               L << Logger::Info << "[geobackend] This is the geo backend version " VERSION
+#ifndef REPRODUCIBLE
+                 << " (" __DATE__ " " __TIME__ ")"
+#endif
+                 << " reporting" << endl;
         }
 };
 
index 78e66baff71487ba9d9bdbfa8fe6dd7e6ab1b1bd..e83b3683223b1c1fa081580d7aa92cfaf6215c1a 100644 (file)
@@ -638,7 +638,11 @@ class GeoIPLoader {
 public:
   GeoIPLoader() {
     BackendMakers().report(new GeoIPFactory);
-    L << Logger::Info << "[geobackend] This is the geo backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[geobackend] This is the geo backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 
index bd012959194d7b92064bff916104f58a10ed45e7..7b3f4a514c75f5bf820f9d5b8cc3977fa86b6270 100644 (file)
@@ -146,7 +146,11 @@ public:
   gMySQLLoader()
   {
     BackendMakers().report(new gMySQLFactory("gmysql"));
-    L << Logger::Info << "[gmysqlbackend] This is the gmysql backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[gmysqlbackend] This is the gmysql backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 static gMySQLLoader gmysqlloader;
index 06cf4a32829c1bd0a3037bd84ad5cf60357740da..ff6c90ce693463e45d40997110db8fecbcbc2d9c 100644 (file)
@@ -159,7 +159,11 @@ public:
   //! This reports us to the main UeberBackend class
   gOracleLoader() {
     BackendMakers().report(new gOracleFactory("goracle"));
-    L << Logger::Info << "[goraclebackend] This is the goracle backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[goraclebackend] This is the goracle backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 
index 98b1aedf056781d4daeeb94d839ca2cfc1ee8320..f48a4c9b3b54d955fdb592e635ea80d83b83c5c6 100644 (file)
@@ -141,7 +141,11 @@ public:
   gPgSQLLoader()
   {
     BackendMakers().report(new gPgSQLFactory("gpgsql"));
-    L << Logger::Info << "[gpgsqlbackend] This is the gpgsql backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[gpgsqlbackend] This is the gpgsql backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 static gPgSQLLoader gpgsqlloader;
index 707833e32c0c5c5e0a46be8e4c42befa86218138..ddd68b1b32e0ae6562296567ea836dd577011667 100644 (file)
@@ -159,7 +159,11 @@ public:
   gSQLite3Loader()
   {
     BackendMakers().report( new gSQLite3Factory( "gsqlite3" ));
-    L << Logger::Info << "[gsqlite3] This is the gsqlite3 backend version " VERSION " reporting" << std::endl;
+    L << Logger::Info << "[gsqlite3] This is the gsqlite3 backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 
index 28b7deaec41afd5bde68053080567018dcc78b94..44d366bdb9636654b24f0fb845fbcedefc63f7dd 100644 (file)
@@ -541,7 +541,11 @@ public:
         LdapLoader()
         {
                BackendMakers().report( &factory );
-               L << Logger::Info << "[ldapbackend] This is the ldap backend version " VERSION " reporting" << endl;
+               L << Logger::Info << "[ldapbackend] This is the ldap backend version " VERSION
+#ifndef REPRODUCIBLE
+                 << " (" __DATE__ " " __TIME__ ")"
+#endif
+                 << " reporting" << endl;
         }
 };
 
index fbd62a5b5633d4629cd8c73041f489194b93ce72..b21407452db5e47764eac3a92933f05248134904 100644 (file)
@@ -562,7 +562,11 @@ public:
   LMDBLoader()
   {
     BackendMakers().report(new LMDBFactory);
-    L << Logger::Info << "[lmdbbackend] This is the lmdb backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[lmdbbackend] This is the lmdb backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 
index 1c65a0ed281fd78d41c2d696a66ff600f1faa633..1c062479f80bd0c2862569f70beeb0cdb4285205 100644 (file)
@@ -52,7 +52,11 @@ public:
   {
     BackendMakers().report(new LUAFactory);
     
-    L << Logger::Info << "[luabackend] This is the lua backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[luabackend] This is the lua backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }  
 };
 
index 96451d82809fcb89681f12f62768fc19602f0c09..c06e2d884ca0f2699c2441a5b37d1e5b6b82523d 100644 (file)
@@ -462,7 +462,11 @@ class MyDNSLoader {
 public:
   MyDNSLoader() {
     BackendMakers().report(new MyDNSFactory());
-    L << Logger::Info << "[mydnsbackend] This is the mydns backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[mydnsbackend] This is the mydns backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 };
 
index ee6b4f8cf4c35a9378ed1725c2455d394a6affdb..4801a29312246065fd6dd8ce5a2fceccae4b2af2 100644 (file)
@@ -164,7 +164,11 @@ public:
         OdbxLoader()
         {
                BackendMakers().report( &factory );
-               L.log( "[opendbxbackend] This is the opendbx backend version " VERSION " reporting", Logger::Info );
+               L<< Logger::Info << "[opendbxbackend] This is the opendbx backend version " VERSION
+#ifndef REPRODUCIBLE
+                 << " (" __DATE__ " " __TIME__ ")"
+#endif
+                 << " reporting" << endl;
         }
 };
 
index ab46114bea63866076cd5ee3ef93c7306e5a28b4..f486c900e69897acb04941e6e19fe17735e1416e 100644 (file)
@@ -2268,7 +2268,11 @@ public:
   OracleLoader()
   {
     BackendMakers().report(new OracleFactory);
-    L << Logger::Info << "[oraclebackend] This is the oracle backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[oraclebackend] This is the oracle backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }
 
 };
index 219521272889073557905058fac2047995a50f4c..2d6e9b78f55ff8453485522f62e3102aaf20b47f 100644 (file)
@@ -292,7 +292,11 @@ class PipeLoader
       PipeLoader()
       {
          BackendMakers().report(new PipeFactory);
-         L << Logger::Info << kBackendId <<" This is the pipe backend version " VERSION " reporting" << endl;
+         L << Logger::Info << kBackendId <<" This is the pipe backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
       }  
 };
 
index 8dde8343b730cfdcf3dc15916ead73ea2f9bf957..fdfacaf3f67f306e964390e95d01f02d105a8028 100644 (file)
@@ -103,7 +103,11 @@ public:
   RandomLoader()
   {
     BackendMakers().report(new RandomFactory);
-    L << Logger::Info << "[randombackend] This is the random backend version " VERSION " reporting" << endl;
+    L << Logger::Info << "[randombackend] This is the random backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
   }  
 };
 
index 1b353c99667f14fa5535a8c7cd231162a6054e69..fd4e37f1a93cba19ff22f502583a6eb7eedab257 100644 (file)
@@ -1068,7 +1068,11 @@ public:
 
 RemoteLoader::RemoteLoader() {
     BackendMakers().report(new RemoteBackendFactory);
-    L << Logger::Info << kBackendId << " This is the remote backend version " VERSION " reporting" << endl;
+    L << Logger::Info << kBackendId << " This is the remote backend version " VERSION
+#ifndef REPRODUCIBLE
+      << " (" __DATE__ " " __TIME__ ")"
+#endif
+      << " reporting" << endl;
 }
 
 static RemoteLoader remoteloader;
index 0b16c7dc4158cba0a9879d4e49c0510090de595c..b04dd5b2231a81ccc8d6d2bd3ed9d3f7c6a2e424 100644 (file)
@@ -329,7 +329,11 @@ class TinyDNSLoader
 public:
        TinyDNSLoader() {
                BackendMakers().report(new TinyDNSFactory);
-               L << Logger::Info << "[tinydnsbackend] This is the tinydns backend version " VERSION " reporting" << endl;
+               L << Logger::Info << "[tinydnsbackend] This is the tinydns backend version " VERSION
+#ifndef REPRODUCIBLE
+                 << " (" __DATE__ " " __TIME__ ")"
+#endif
+                 << " reporting" << endl;
        }
 };
 
index f88b5a1c3a3bd8f2292f4056cd67debdcbf82e0f..802f3b9ede5458cdb42fd83a84433889c231b921 100755 (executable)
@@ -13,6 +13,12 @@ if [ "$STATIC" = "" ]; then
   STATIC="no"
 fi
 
+if [ "$REPRODUCIBLE" = "1" ]; then
+  cat >> config.h << EOF
+#define REPRODUCIBLE 1
+EOF
+fi
+
 set -u
 
 LD_RELRO=""
index 2ef0e812c9b31e666c6077a50af365042f913779..58053114fb8f5e9707e063e1455d037d6c14fbe4 100644 (file)
@@ -72,7 +72,11 @@ void showProductVersion()
   theL()<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2015 "
     "PowerDNS.COM BV" << endl;
   theL()<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
-    "Built using " << compilerVersion() << endl;
+    "Built using " << compilerVersion()
+#ifndef REPRODUCIBLE
+    <<" on " __DATE__ " " __TIME__ " by " BUILD_HOST
+#endif
+    <<"."<< 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;
@@ -126,6 +130,9 @@ string fullVersionString()
 {
   ostringstream s;
   s<<productName()<<" " VERSION;
+#ifndef REPRODUCIBLE
+  s<<" (built " __DATE__ " " __TIME__ " by " BUILD_HOST ")";
+#endif
   return s.str();
 }