Include compiler name/version and build host name in --version

fixes #12389
This commit is contained in:
Gunnar Beutner 2016-08-10 08:03:54 +02:00
parent dc06209e4a
commit e8ae1dc4a6
5 changed files with 26 additions and 0 deletions

View 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_UNITY_BUILD ON CACHE BOOL "Whether to perform a unity build")
set(ICINGA2_LTO_BUILD OFF CACHE BOOL "Whether to use LTO") 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" ICINGA2_LICENSE_GPL)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS)
set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}") set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")

View File

@ -22,4 +22,8 @@
#define ICINGA_USER "${ICINGA2_USER}" #define ICINGA_USER "${ICINGA2_USER}"
#define ICINGA_GROUP "${ICINGA2_GROUP}" #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 */ #endif /* CONFIG_H */

View 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". 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". 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". 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 ## <a id="apply"></a> Apply

View File

@ -169,6 +169,10 @@ int Main(void)
ScriptGlobal::Set("PlatformVersion", Utility::GetPlatformVersion()); ScriptGlobal::Set("PlatformVersion", Utility::GetPlatformVersion());
ScriptGlobal::Set("PlatformArchitecture", Utility::GetPlatformArchitecture()); 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(); LogSeverity logLevel = Logger::GetConsoleLogSeverity();
Logger::SetConsoleLogSeverity(LogWarning); Logger::SetConsoleLogSeverity(LogWarning);

View File

@ -512,6 +512,11 @@ void Application::DisplayInfoMessage(std::ostream& os, bool skipVersion)
<< " Kernel: " << Utility::GetPlatformKernel() << "\n" << " Kernel: " << Utility::GetPlatformKernel() << "\n"
<< " Kernel version: " << Utility::GetPlatformKernelVersion() << "\n" << " Kernel version: " << Utility::GetPlatformKernelVersion() << "\n"
<< " Architecture: " << Utility::GetPlatformArchitecture() << "\n"; << " Architecture: " << Utility::GetPlatformArchitecture() << "\n";
os << "\n"
<< "Build information:" << "\n"
<< " Compiler: " << ScriptGlobal::Get("BuildCompilerName") << " " << ScriptGlobal::Get("BuildCompilerVersion") << "\n"
<< " Build host: " << ScriptGlobal::Get("BuildHostName") << "\n";
} }
/** /**