diff --git a/CMakeLists.txt b/CMakeLists.txt index 564ad7a43a..444d9cc04a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -835,11 +835,17 @@ IF (UNIX) OUTPUT_VARIABLE ER_BUILD_TIME) string(STRIP "${ER_BUILD_TIME}" ER_BUILD_TIME) + EXECUTE_PROCESS(COMMAND bash "-c" "git describe --tags `git rev-list --tags --max-count=1` |head -n 1 |awk -F'-' '{print $2}'" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE ER_TAG_NAME) + string(STRIP "${ER_TAG_NAME}" ER_TAG_NAME) + SET(STONEDB_REPO_ADDR "${ER_REPO_NAME}:${ER_BRANCH_NAME}") SET(STONEDB_BRANCH_NAME "${ER_BRANCH_NAME}") SET(STONEDB_COMMIT_ID "${ER_COMMIT_ID}") SET(STONEDB_COMMIT_TIME "${ER_COMMIT_TIME}") SET(STONEDB_BUILD_TIME "Date: ${ER_BUILD_TIME}") + SET(STONEDB_TAG_NAME "${ER_TAG_NAME}") ENDIF() CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h) diff --git a/mysql-test/suite/tianmu/r/issue1252.result b/mysql-test/suite/tianmu/r/issue1252.result new file mode 100644 index 0000000000..1b67157b86 --- /dev/null +++ b/mysql-test/suite/tianmu/r/issue1252.result @@ -0,0 +1,3 @@ +select (select version() regexp '^5.7.36-StoneDB-v[0-9]*\\.[0-9]*\\.[0-9]*$'); +(select version() regexp '^5.7.36-StoneDB-v[0-9]*\\.[0-9]*\\.[0-9]*$') +1 diff --git a/mysql-test/suite/tianmu/t/issue1252.test b/mysql-test/suite/tianmu/t/issue1252.test new file mode 100644 index 0000000000..1ddde793b3 --- /dev/null +++ b/mysql-test/suite/tianmu/t/issue1252.test @@ -0,0 +1,2 @@ +-- source include/have_tianmu.inc +select (select version() regexp '^5.7.36-StoneDB-v[0-9]*\\.[0-9]*\\.[0-9]*$'); \ No newline at end of file diff --git a/sql/build_info.h.ini b/sql/build_info.h.ini index 88e1f25a72..d89f04b3a6 100644 --- a/sql/build_info.h.ini +++ b/sql/build_info.h.ini @@ -23,5 +23,6 @@ #cmakedefine STONEDB_COMMIT_ID "@STONEDB_COMMIT_ID@" #cmakedefine STONEDB_COMMIT_TIME "@STONEDB_COMMIT_TIME@" #cmakedefine STONEDB_BUILD_TIME "@STONEDB_BUILD_TIME@" +#cmakedefine STONEDB_TAG_NAME "@STONEDB_TAG_NAME@" #endif //BUILD_INFO_T_H diff --git a/sql/build_info_t.h b/sql/build_info_t.h index be47e89269..e2e1975c46 100755 --- a/sql/build_info_t.h +++ b/sql/build_info_t.h @@ -4,4 +4,5 @@ #define STONEDB_BRANCH_NAME "AS_BRANCH_NAME" #define STONEDB_COMMIT_ID "AS_COMMIT_ID" #define STONEDB_COMMIT_TIME "AS_COMMIT_TIME" +#define STONEDB_TAG_NAME "AS_TAG_NAME" #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d1bab41f1c..c22fff2935 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8103,6 +8103,7 @@ static void set_server_version(void) { char *end= strxmov(server_version, MYSQL_SERVER_VERSION, MYSQL_SERVER_SUFFIX_STR, NullS); +#if 0 #ifdef EMBEDDED_LIBRARY end= my_stpcpy(end, "-embedded"); #endif @@ -8122,6 +8123,13 @@ static void set_server_version(void) static_cast(sizeof("-asan"))) end= my_stpcpy(end, "-asan"); #endif +#endif + if (SERVER_VERSION_LENGTH - (end - server_version) > + static_cast(sizeof("-"))) + end = my_stpcpy(end, "-"); + if (SERVER_VERSION_LENGTH - (end - server_version) > + static_cast(sizeof(STONEDB_TAG_NAME))) + end = my_stpcpy(end, STONEDB_TAG_NAME); }