Skip to content
Snippets Groups Projects
Commit 8509f163 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

cmake: allow to set arbitrary version

This commit allows to override Tarantool version detection by setting
CMake TARANTOOL_VERSION variable. This is needed to build Tarantool as a
part of tarantool/sdk, which sets its own, extended version.

Also, this commit updates box-py/args.test.py to allow arbitrary tags
appended to the version (tarantool/sdk appends -rNNN).
parent 79f531c9
No related branches found
No related tags found
No related merge requests found
......@@ -219,37 +219,37 @@ endif()
# Get version
#
set (PACKAGE_VERSION "")
set (TARANTOOL_VERSION "")
# Try to get version from VERSION file
set(VERSION_FILE_ORIG "${PROJECT_SOURCE_DIR}/VERSION")
set(VERSION_FILE "${PROJECT_BINARY_DIR}/VERSION")
if (EXISTS "${VERSION_FILE_ORIG}")
file (STRINGS "${VERSION_FILE_ORIG}" TARANTOOL_VERSION)
elseif (EXISTS "${VERSION_FILE}")
file (STRINGS "${VERSION_FILE}" TARANTOOL_VERSION)
endif()
# Get git version only if source directory has .git repository, this
# avoids git to search .git repository in parent
# directories.
#
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT)
execute_process (COMMAND ${GIT} describe --long HEAD
OUTPUT_VARIABLE TARANTOOL_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if(NOT TARANTOOL_VERSION)
# Try to get version from VERSION file
set(VERSION_FILE_ORIG "${PROJECT_SOURCE_DIR}/VERSION")
set(VERSION_FILE "${PROJECT_BINARY_DIR}/VERSION")
if (EXISTS "${VERSION_FILE_ORIG}")
file (STRINGS "${VERSION_FILE_ORIG}" TARANTOOL_VERSION)
elseif (EXISTS "${VERSION_FILE}")
file (STRINGS "${VERSION_FILE}" TARANTOOL_VERSION)
endif()
if (NOT ("${TARANTOOL_GIT_VERSION}" STREQUAL "${TARANTOOL_VERSION}"))
set(TARANTOOL_VERSION "${TARANTOOL_GIT_VERSION}")
message(STATUS "Generating VERSION file")
file(WRITE ${VERSION_FILE} "${TARANTOOL_VERSION}\n")
# Get git version only if source directory has .git repository, this
# avoids git to search .git repository in parent
# directories.
#
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT)
execute_process (COMMAND ${GIT} describe --long HEAD
OUTPUT_VARIABLE TARANTOOL_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if (NOT ("${TARANTOOL_GIT_VERSION}" STREQUAL "${TARANTOOL_VERSION}"))
set(TARANTOOL_VERSION "${TARANTOOL_GIT_VERSION}")
message(STATUS "Generating VERSION file")
file(WRITE ${VERSION_FILE} "${TARANTOOL_VERSION}\n")
endif()
endif()
endif()
if (NOT TARANTOOL_VERSION)
message (FATAL_ERROR "Unable to retrive version from git or ${VERSION_FILE} file.")
if (NOT TARANTOOL_VERSION)
message (FATAL_ERROR
"Unable to retrive version from git or ${VERSION_FILE} file.")
endif()
endif()
#
......
......@@ -44,7 +44,7 @@ tarantool --no-such-option --version
tarantool: unrecognized option
tarantool --version
Tarantool 2.minor.patch-<suffix>-<rev>-<commit>
Tarantool 2.<minor>.<patch>-<suffix>
Target: platform <build>
Build options: flags
Compiler: cc
......@@ -52,7 +52,7 @@ C_FLAGS: flags
CXX_FLAGS: flags
tarantool -v
Tarantool 2.minor.patch-<suffix>-<rev>-<commit>
Tarantool 2.<minor>.<patch>-<suffix>
Target: platform <build>
Build options: flags
Compiler: cc
......@@ -60,7 +60,7 @@ C_FLAGS: flags
CXX_FLAGS: flags
tarantool -V
Tarantool 2.minor.patch-<suffix>-<rev>-<commit>
Tarantool 2.<minor>.<patch>-<suffix>
Target: platform <build>
Build options: flags
Compiler: cc
......@@ -111,7 +111,7 @@ arg[3] => 2
arg[4] => 3
tarantool -V ${SOURCEDIR}/test/box-py/args.lua 1 2 3
Tarantool 2.minor.patch-<suffix>-<rev>-<commit>
Tarantool 2.<minor>.<patch>-<suffix>
Target: platform <build>
Build options: flags
Compiler: cc
......
......@@ -22,7 +22,8 @@ sys.stdout.push_filter("unrecognized option.*", "unrecognized option")
server.test_option("-Z")
server.test_option("--no-such-option")
server.test_option("--no-such-option --version")
sys.stdout.push_filter(".* (\d+)\.\d+\.\d+(-\w+)?(-\d+)?(-\w+)?", "Tarantool \\1.minor.patch-<suffix>-<rev>-<commit>")
sys.stdout.push_filter(".* (\d+)\.\d+\.\d+(-\w+)*",
"Tarantool \\1.<minor>.<patch>-<suffix>")
sys.stdout.push_filter("Target: .*", "Target: platform <build>")
sys.stdout.push_filter(".*Disable shared arena since.*\n", "")
sys.stdout.push_filter("Build options: .*", "Build options: flags")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment