Skip to content

Commit

Permalink
feat(stonedb): show stonedb tag version. (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
lujiashun committed Jan 30, 2023
1 parent ac1f616 commit 1af591d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/tianmu/r/issue1252.result
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions mysql-test/suite/tianmu/t/issue1252.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- source include/have_tianmu.inc
select (select version() regexp '^5.7.36-StoneDB-v[0-9]*\\.[0-9]*\\.[0-9]*$');
1 change: 1 addition & 0 deletions sql/build_info.h.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions sql/build_info_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -8122,6 +8123,13 @@ static void set_server_version(void)
static_cast<int>(sizeof("-asan")))
end= my_stpcpy(end, "-asan");
#endif
#endif
if (SERVER_VERSION_LENGTH - (end - server_version) >
static_cast<int>(sizeof("-")))
end = my_stpcpy(end, "-");
if (SERVER_VERSION_LENGTH - (end - server_version) >
static_cast<int>(sizeof(STONEDB_TAG_NAME)))
end = my_stpcpy(end, STONEDB_TAG_NAME);
}


Expand Down

0 comments on commit 1af591d

Please sign in to comment.