summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-11-30 14:15:56 +0100
committerManuel Bentele2021-11-30 14:33:53 +0100
commitb8326e90edc0150d69e0ad54d73bbd003a556875 (patch)
tree596f30735d427fd5ff514971f450025f5dcb27bc
parent[KERNEL] Add support for Linux kernel 5.15.x LTS (diff)
downloaddnbd3-b8326e90edc0150d69e0ad54d73bbd003a556875.tar.gz
dnbd3-b8326e90edc0150d69e0ad54d73bbd003a556875.tar.xz
dnbd3-b8326e90edc0150d69e0ad54d73bbd003a556875.zip
[BUILD] Fix versioning format for Docker tags
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/GenerateVersion.cmake2
-rw-r--r--cmake/Version.cmake4
3 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf11744..69459dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,7 +126,7 @@ endif(DNBD3_RELEASE_HARDEN AND CMAKE_BUILD_TYPE MATCHES "Release")
# define packaging if Release build is enabled
if(CMAKE_BUILD_TYPE MATCHES Release)
# get version source package or Git repository
- get_repository_version(REPOSITORY_VERSION REPOSITORY_BRANCH ${INCLUDE_VERSION_HEADER} ${CMAKE_BUILD_TYPE} ${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR})
+ get_repository_version(REPOSITORY_VERSION REPOSITORY_VERSION_SHORT REPOSITORY_BRANCH ${INCLUDE_VERSION_HEADER} ${CMAKE_BUILD_TYPE} ${GIT_EXECUTABLE} ${CMAKE_SOURCE_DIR})
# define project version
if(KernelHeaders_VERSION)
@@ -223,7 +223,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release)
find_package(Docker REQUIRED)
include(DockerImage)
- set(DOCKER_TAG ${CPACK_PACKAGE_NAME}:${REPOSITORY_VERSION_FULL})
+ set(DOCKER_TAG ${CPACK_PACKAGE_NAME}:${REPOSITORY_VERSION_SHORT})
# define Ubuntu docker image
set(DOCKER_FILE_UBUNTU ${CMAKE_SOURCE_DIR}/pkg/docker/ubuntu-20-04_dockerfile)
diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake
index bddd672..b7579bc 100644
--- a/cmake/GenerateVersion.cmake
+++ b/cmake/GenerateVersion.cmake
@@ -11,7 +11,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
include(Version)
# get Git version of Git repository
-get_repository_version(DNBD3_VERSION DNBD3_BRANCH ${VERSION_INPUT_FILE} ${VERSION_BUILD_TYPE} ${GIT_EXECUTABLE} ${REPOSITORY_DIR})
+get_repository_version(DNBD3_VERSION DNBD3_VERSION_SHORT DNBD3_BRANCH ${VERSION_INPUT_FILE} ${VERSION_BUILD_TYPE} ${GIT_EXECUTABLE} ${REPOSITORY_DIR})
# generate version header if header does not exists
if(NOT EXISTS ${VERSION_INPUT_FILE})
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
index c121499..0f26944 100644
--- a/cmake/Version.cmake
+++ b/cmake/Version.cmake
@@ -31,7 +31,7 @@ macro(gen_project_version VERSION_INPUT_FILE VERSION_INPUT_FILE_TEMPLATE VERSION
endmacro(gen_project_version VERSION_INPUT_FILE VERSION_INPUT_FILE_TEMPLATE VERSION_OUTPUT_FILE)
# macro to get Git version information
-macro(get_repository_version REPOSITORY_VERSION REPOSITORY_BRANCH VERSION_HEADER_FILE VERSION_BUILD_TYPE GIT_EXECUTABLE REPOSITORY_DIR)
+macro(get_repository_version REPOSITORY_VERSION REPOSITORY_VERSION_SHORT REPOSITORY_BRANCH VERSION_HEADER_FILE VERSION_BUILD_TYPE GIT_EXECUTABLE REPOSITORY_DIR)
# set empty Git version information
set(GIT_VERSION "")
# set empty Git branch information
@@ -74,6 +74,8 @@ macro(get_repository_version REPOSITORY_VERSION REPOSITORY_BRANCH VERSION_HEADER
endif(${VERSION_BUILD_TYPE} MATCHES "Release")
endif(GIT_VERSION STREQUAL "")
+ set(${REPOSITORY_VERSION_SHORT} ${GIT_VERSION})
+
# get current branch of Git repository
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${REPOSITORY_DIR}