From 84a6848f10af80d847a9e75bd53970d5709d05c4 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 20 Feb 2017 13:41:51 +0200 Subject: [PATCH] Add build information to --version-full If the Jenkins build information is available, print it in the full version output. --- CMakeLists.txt | 7 +++++++ server/core/gateway.c | 12 ++++++++++++ server/include/version.h.in | 3 +++ 3 files changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f29db5dd3..fe46a7232 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,13 @@ if(${MAXSCALE_VERSION} MATCHES "-stable") endif() endif() +# Copy cmake_flags, JENKINS_BUILD_TAG, source and value evironmental variables +# into cmake variables. These are used by the build system to store information +# about the packages being built. +set(MAXSCALE_SOURCE "$ENV{source} $ENV{value}") +set(MAXSCALE_CMAKE_FLAGS "$ENV{cmake_flags}") +set(MAXSCALE_JENKINS_BUILD_TAG "$ENV{BUILD_TAG}") + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/server/include) configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_BINARY_DIR}/server/include/version.h @ONLY) configure_file(${CMAKE_SOURCE_DIR}/server/include/gwdirs.h.in ${CMAKE_BINARY_DIR}/server/include/gwdirs.h @ONLY) diff --git a/server/core/gateway.c b/server/core/gateway.c index a87fba03b..0177d2321 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -1341,6 +1341,18 @@ int main(int argc, char **argv) case 'V': rc = EXIT_SUCCESS; printf("MaxScale %s - %s\n", MAXSCALE_VERSION, maxscale_commit); + if (strcmp(MAXSCALE_SOURCE, " ") != 0) + { + printf("Source: %s\n", MAXSCALE_SOURCE); + } + if (strcmp(MAXSCALE_CMAKE_FLAGS, "") != 0) + { + printf("CMake flags: %s\n", MAXSCALE_CMAKE_FLAGS); + } + if (strcmp(MAXSCALE_JENKINS_BUILD_TAG, "") != 0) + { + printf("Jenkins build: %s\n", MAXSCALE_JENKINS_BUILD_TAG); + } goto return_main; case 'l': diff --git a/server/include/version.h.in b/server/include/version.h.in index c15fa862d..3e17ebe04 100644 --- a/server/include/version.h.in +++ b/server/include/version.h.in @@ -1,2 +1,5 @@ #define MAXSCALE_VERSION "@MAXSCALE_VERSION@" #define MAXSCALE_COMMIT "@MAXSCALE_COMMIT@" +#define MAXSCALE_SOURCE "@MAXSCALE_SOURCE@" +#define MAXSCALE_CMAKE_FLAGS "@MAXSCALE_CMAKE_FLAGS@" +#define MAXSCALE_JENKINS_BUILD_TAG "@MAXSCALE_JENKINS_BUILD_TAG@"