changeset 22046:f4076be3efe9

lib: Add dovecot_build_info variable containing Dovecot build information. By default this includes the version, including the git hash. The idea is that this version information would be available in all the core dumps. The DOVECOT_BUILD_INFO can be overridden by compiling with: DOVECOT_BUILD_INFO='"build info"' make
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 18 May 2017 12:32:12 +0300
parents ba0cb10b2845
children ec84babd5727
files src/lib/lib.c update-version.sh
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/lib.c	Tue May 16 17:53:23 2017 +0300
+++ b/src/lib/lib.c	Thu May 18 12:32:12 2017 +0300
@@ -1,6 +1,7 @@
 /* Copyright (c) 2001-2017 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "dovecot-version.h"
 #include "array.h"
 #include "env-util.h"
 #include "hostpid.h"
@@ -13,6 +14,10 @@
 #include <unistd.h>
 #include <sys/time.h>
 
+/* Mainly for including the full version information in core dumps.
+   NOTE: Don't set this const - otherwise it won't end up in core dumps. */
+char dovecot_build_info[] = DOVECOT_BUILD_INFO;
+
 static bool lib_initialized = FALSE;
 int dev_null_fd = -1;
 
--- a/update-version.sh	Tue May 16 17:53:23 2017 +0300
+++ b/update-version.sh	Thu May 18 12:32:12 2017 +0300
@@ -4,6 +4,7 @@
 BUILDDIR="${2:-`pwd`}"
 VERSION_H="dovecot-version.h"
 VERSION_HT="dovecot-version.h.tmp"
+DOVECOT_BUILD_INFO=${DOVECOT_BUILD_INFO:-DOVECOT_VERSION_FULL}
 
 abspath()
 { #$1 the path
@@ -45,6 +46,7 @@
 #define DOVECOT_VERSION_H
 
 #define DOVECOT_VERSION_FULL VERSION" (${GITID})"
+#define DOVECOT_BUILD_INFO ${DOVECOT_BUILD_INFO}
 
 #endif /* DOVECOT_VERSION_H */
 EOF
@@ -54,6 +56,7 @@
 #define DOVECOT_VERSION_H
 
 #define DOVECOT_VERSION_FULL VERSION
+#define DOVECOT_BUILD_INFO ${DOVECOT_BUILD_INFO}
 
 #endif /* DOVECOT_VERSION_H */
 EOF