all: remove build_host and build_date to enable reproducible building
authorReiner Herrmann <reiner@reiner-h.de>
Sun, 15 Oct 2017 10:56:56 +0000 (12:56 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 30 Jan 2018 21:10:04 +0000 (22:10 +0100)
The hostname and date/time varies from system to system, so it is
not possible to reproduce the binary when this data is embedded.

Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/httpinfo/src/olsrd_httpinfo.c
lib/jsoninfo/src/olsrd_jsoninfo.c
lib/txtinfo/src/olsrd_txtinfo.c
make/hash_source.sh
src/builddata.h
src/cli.c
src/olsr.c

index c255275..e8e17ae 100644 (file)
@@ -822,7 +822,7 @@ build_config_body(struct autobuf *abuf)
   const struct plugin_param *pparam;
   struct ipaddr_str mainaddrbuf;
 
-  abuf_appendf(abuf, "Version: %s (built on %s on %s)\n<br>", olsrd_version, build_date, build_host);
+  abuf_appendf(abuf, "Version: %s\n<br>", olsrd_version);
   abuf_appendf(abuf, "OS: %s\n<br>", OS);
 
   {
@@ -1554,11 +1554,10 @@ build_about_body(struct autobuf *abuf)
 {
   abuf_appendf(abuf,
                   "<strong>" PLUGIN_NAME "</strong><br/><br/>\n"
-                  "Compiled "
 #ifdef ADMIN_INTERFACE
-                  "<em>with experimental admin interface</em> "
+                  "<em>Compiled with experimental admin interface</em>\n"
 #endif /* ADMIN_INTERFACE */
-                  "%s at %s<hr/>\n" "This plugin implements a HTTP server that supplies\n"
+                  "This plugin implements a HTTP server that supplies\n"
                   "the client with various dynamic web pages representing\n"
                   "the current olsrd status.<br/>The different pages include:\n"
                   "<ul>\n<li><strong>Configuration</strong> - This page displays information\n"
@@ -1586,8 +1585,7 @@ build_about_body(struct autobuf *abuf)
                   "<li><strong>About</strong> - this help page.</li>\n</ul>" "<hr/>\n" "Send questions or comments to\n"
                   "<a href=\"mailto:olsr-users@olsr.org\">olsr-users@olsr.org</a> or\n"
                   "<a href=\"mailto:andreto-at-olsr.org\">andreto-at-olsr.org</a><br/>\n"
-                  "Official olsrd homepage: <a href=\"http://www.olsr.org/\">http://www.olsr.org</a><br/>\n", build_date,
-                  build_host);
+                  "Official olsrd homepage: <a href=\"http://www.olsr.org/\">http://www.olsr.org</a><br/>\n");
 }
 
 static void
index bd3e96c..ec0e469 100644 (file)
@@ -1089,8 +1089,6 @@ void ipc_print_version(struct autobuf *abuf) {
 
   abuf_json_string(&json_session, abuf, "version", olsrd_version);
 
-  abuf_json_string(&json_session, abuf, "date", build_date);
-  abuf_json_string(&json_session, abuf, "host", build_host);
   abuf_json_string(&json_session, abuf, "gitDescriptor", git_descriptor);
   abuf_json_string(&json_session, abuf, "gitSha", git_sha);
   abuf_json_string(&json_session, abuf, "releaseVersion", release_version);
index 3814334..a75b47f 100644 (file)
@@ -562,7 +562,7 @@ void ipc_print_sgw(struct autobuf *abuf) {
 }
 
 void ipc_print_version(struct autobuf *abuf) {
-  abuf_appendf(abuf, "Version: %s (built on %s on %s)\n", olsrd_version, build_date, build_host);
+  abuf_appendf(abuf, "Version: %s\n", olsrd_version);
   abuf_puts(abuf, "\n");
 }
 
index acb2925..e40d894 100755 (executable)
@@ -75,15 +75,11 @@ fi
 gitDescriptor="$(git describe --dirty --always 2> /dev/null)"
 
 sourceHash="$(cat $(find . -name *.[ch] | grep -v -E '[/\\]?builddata.c$') | "$md5Command" | awk '{ print $1; }')"
-hostName="$(hostname)"
-buildDate="$(date +"%Y-%m-%d %H:%M:%S")"
 
 tmpBuildDataTxt="$(mktemp -t olsrd.hash_source.XXXXXXXXXX)"
 cat > "$tmpBuildDataTxt" << EOF
 const char olsrd_version[]   = "olsr.org - $version-git_$gitSha-hash_$sourceHash";
 
-const char build_date[]      = "$buildDate";
-const char build_host[]      = "$hostName";
 const char git_descriptor[]  = "$gitDescriptor";
 const char git_sha[]         = "$gitShaFull";
 const char release_version[] = "$version";
@@ -98,7 +94,7 @@ if [ ! -e "$buildDataTxt" ]; then
   else
     cp -p -v "$tmpBuildDataTxt" "$buildDataTxt"
   fi
-elif [ -n "$(diff -I "^const char build_date\[\].*\$" "$tmpBuildDataTxt" "$buildDataTxt" | sed 's/"/\\"/g')" ]; then
+elif [ -n "$(diff "$tmpBuildDataTxt" "$buildDataTxt" | sed 's/"/\\"/g')" ]; then
   echo "[UPDATE] $buildDataTxt"
   if [ "$verbose" = "0" ]; then
     cp -p "$tmpBuildDataTxt" "$buildDataTxt"
index f96672a..dc2eaba 100644 (file)
@@ -48,8 +48,6 @@
 
 extern const char olsrd_version[];
 
-extern const char build_date[];
-extern const char build_host[];
 extern const char git_descriptor[];
 extern const char git_sha[];
 extern const char release_version[];
index db46608..adf8c20 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -57,8 +57,7 @@ void ListInterfaces(void);
 #endif /* _WIN32 */
 
 void print_version(void) {
-  printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n",
-      olsrd_version, build_date, build_host);
+  printf("\n *** %s ***\n http://www.olsr.org\n\n", olsrd_version);
 }
 
 /**
index 4f751e2..6465dca 100644 (file)
@@ -200,7 +200,7 @@ olsr_process_changes(void)
 
   if (olsr_cnf->debug_level > 0 && olsr_cnf->clear_screen && isatty(1)) {
     clear_console();
-    printf("       *** %s (%s on %s) ***\n", olsrd_version, build_date, build_host);
+    printf("       *** %s ***\n", olsrd_version);
   }
 
   if (changes_neighborhood) {