mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-12583 : Bake the git hash into the binaries.
Added version_source_revision server "variable", for the git revision. Also , mysql -V will show git revision. "make dist" will now pack source_revision.h into the source package.
This commit is contained in:
parent
f70865bc9e
commit
0f3735842f
5 changed files with 32 additions and 3 deletions
|
@ -432,6 +432,23 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
|
|||
${CMAKE_BINARY_DIR}/include/mysql_version.h )
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
|
||||
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
|
||||
|
||||
FIND_PACKAGE(Git)
|
||||
IF(GIT_EXECUTABLE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE OUT RESULT_VARIABLE RES)
|
||||
IF(RES EQUAL 0)
|
||||
STRING(REGEX REPLACE "\n$" "" SOURCE_REVISION "${OUT}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(SOURCE_REVISION OR
|
||||
(NOT EXISTS ${PROJECT_SOURCE_DIR}/include/source_revision.h))
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/include/source_revision.h.in
|
||||
${PROJECT_BINARY_DIR}/include/source_revision.h )
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
|
||||
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "my_readline.h"
|
||||
#include <signal.h>
|
||||
#include <violite.h>
|
||||
|
||||
#include <source_revision.h>
|
||||
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
@ -1721,8 +1721,8 @@ static void usage(int version)
|
|||
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
|
||||
readline, rl_library_version);
|
||||
#else
|
||||
printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER,
|
||||
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver %s Distrib %s, for %s (%s), source revision %s\n", my_progname, VER,
|
||||
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,SOURCE_REVISION);
|
||||
#endif
|
||||
|
||||
if (version)
|
||||
|
|
|
@ -52,6 +52,9 @@ IF(GIT_EXECUTABLE)
|
|||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
|
||||
${PACKAGE_DIR}/include/source_revision.h COPYONLY)
|
||||
|
||||
IF(NOT GIT_EXECUTABLE)
|
||||
MESSAGE(STATUS "git not found or source dir is not a repo, use CPack")
|
||||
|
||||
|
|
1
include/source_revision.h.in
Normal file
1
include/source_revision.h.in
Normal file
|
@ -0,0 +1 @@
|
|||
#cmakedefine SOURCE_REVISION "@SOURCE_REVISION@"
|
|
@ -3503,6 +3503,14 @@ static Sys_var_charptr Sys_version_compile_os(
|
|||
CMD_LINE_HELP_ONLY,
|
||||
IN_SYSTEM_CHARSET, DEFAULT(SYSTEM_TYPE));
|
||||
|
||||
#include <source_revision.h>
|
||||
static char *server_version_source_revision;
|
||||
static Sys_var_charptr Sys_version_source_revision(
|
||||
"version_source_revision", "´Revision of the MariaDB source code",
|
||||
READ_ONLY GLOBAL_VAR(server_version_source_revision),
|
||||
CMD_LINE_HELP_ONLY,
|
||||
IN_SYSTEM_CHARSET, DEFAULT(SOURCE_REVISION));
|
||||
|
||||
static char *guess_malloc_library()
|
||||
{
|
||||
if (strcmp(MALLOC_LIBRARY, "system") == 0)
|
||||
|
|
Loading…
Reference in a new issue