From 5fbdfc545f194e10cf1c9787614ada2e6902834b Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 18 May 2017 12:32:12 +0300 Subject: [PATCH] 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 --- src/lib/lib.c | 5 +++++ update-version.sh | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/lib/lib.c b/src/lib/lib.c index 04e577c54f..4c20163d36 100644 --- a/src/lib/lib.c +++ b/src/lib/lib.c @@ -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 #include +/* 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; diff --git a/update-version.sh b/update-version.sh index e610f2192b..0d2a388dc4 100644 --- a/update-version.sh +++ b/update-version.sh @@ -4,6 +4,7 @@ SRCDIR="${1:-`pwd`}" 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 @@ if true; then #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 @@ else #define DOVECOT_VERSION_H #define DOVECOT_VERSION_FULL VERSION +#define DOVECOT_BUILD_INFO ${DOVECOT_BUILD_INFO} #endif /* DOVECOT_VERSION_H */ EOF -- 2.47.3