]> granicus.if.org Git - icinga2/commitdiff
Include compiler name/version and build host name in --version
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 10 Aug 2016 06:03:54 +0000 (08:03 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 10 Aug 2016 06:09:44 +0000 (08:09 +0200)
fixes #12389

CMakeLists.txt
config.h.cmake
doc/18-language-reference.md
icinga-app/icinga.cpp
lib/base/application.cpp

index 09d6da84060503472715de53e165b2369be2896b..9fd1f7ae1e89fe6278e416be57c9a2f558834825 100644 (file)
@@ -55,6 +55,16 @@ set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe")
 set(ICINGA2_UNITY_BUILD ON CACHE BOOL "Whether to perform a unity build")
 set(ICINGA2_LTO_BUILD OFF CACHE BOOL "Whether to use LTO")
 
+site_name(ICINGA2_BUILD_HOST_NAME)
+set(ICINGA2_BUILD_COMPILER_NAME "${CMAKE_CXX_COMPILER_ID}")
+
+if(NOT CMAKE_CXX_COMPILER_VERSION)
+  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
+    OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
+endif()
+
+set(ICINGA2_BUILD_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
+
 file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL)
 file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS)
 set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
index 521fcb96f6bc15884f167ab0261d33a23558968a..7d67840b470a6f96fc6c936faa314ebef1d8b1e7 100644 (file)
@@ -22,4 +22,8 @@
 #define ICINGA_USER "${ICINGA2_USER}"
 #define ICINGA_GROUP "${ICINGA2_GROUP}"
 
+#define ICINGA_BUILD_HOST_NAME "${ICINGA2_BUILD_HOST_NAME}"
+#define ICINGA_BUILD_COMPILER_NAME "${ICINGA2_BUILD_COMPILER_NAME}"
+#define ICINGA_BUILD_COMPILER_VERSION "${ICINGA2_BUILD_COMPILER_VERSION}"
+
 #endif /* CONFIG_H */
index ec76cd6650f4ce2c2fbc4e49e4f6b9ded7b7d2bb..8ce5b72a0465d597e90c40186de6936f3ddc2dd5 100644 (file)
@@ -377,6 +377,9 @@ PlatformName        |**Read-only.** The name of the operating system, e.g. "Ubun
 PlatformVersion     |**Read-only.** The version of the operating system, e.g. "14.04.3 LTS".
 PlatformKernel      |**Read-only.** The name of the operating system kernel, e.g. "Linux".
 PlatformKernelVersion|**Read-only.** The version of the operating system kernel, e.g. "3.13.0-63-generic".
+BuildCompilerName   |**Read-only.** The name of the compiler Icinga was built with, e.g. "Clang".
+BuildCompilerVersion|**Read-only.** The version of the compiler Icinga was built with, e.g. "7.3.0.7030031".
+BuildHostName       |**Read-only.** The name of the host Icinga was built on, e.g. "acheron".
 
 ## <a id="apply"></a> Apply
 
index 75ef69578ec7d38e6fe465e493f6a4564d833cf2..f50450525e43415b157f3181d31153487584c120 100644 (file)
@@ -169,6 +169,10 @@ int Main(void)
        ScriptGlobal::Set("PlatformVersion", Utility::GetPlatformVersion());
        ScriptGlobal::Set("PlatformArchitecture", Utility::GetPlatformArchitecture());
 
+       ScriptGlobal::Set("BuildHostName", ICINGA_BUILD_HOST_NAME);
+       ScriptGlobal::Set("BuildCompilerName", ICINGA_BUILD_COMPILER_NAME);
+       ScriptGlobal::Set("BuildCompilerVersion", ICINGA_BUILD_COMPILER_VERSION);
+
        LogSeverity logLevel = Logger::GetConsoleLogSeverity();
        Logger::SetConsoleLogSeverity(LogWarning);
 
index 77c610216e63bbd54076d82653f7ff723c1130d2..36ea62365d9d42d91eba890ce4a487ca59fc5122 100644 (file)
@@ -512,6 +512,11 @@ void Application::DisplayInfoMessage(std::ostream& os, bool skipVersion)
           << "  Kernel: " << Utility::GetPlatformKernel() << "\n"
           << "  Kernel version: " << Utility::GetPlatformKernelVersion() << "\n"
           << "  Architecture: " << Utility::GetPlatformArchitecture() << "\n";
+
+       os << "\n"
+          << "Build information:" << "\n"
+          << "  Compiler: " << ScriptGlobal::Get("BuildCompilerName") << " " << ScriptGlobal::Get("BuildCompilerVersion") << "\n"
+          << "  Build host: " << ScriptGlobal::Get("BuildHostName") << "\n";
 }
 
 /**