summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-10-02 14:18:28 +0200
committerMauro Sardara <msardara@cisco.com>2020-10-02 16:10:07 +0200
commit97ba3781b56a23169f4c35453c18c132bed6648e (patch)
treeb7d93df47e9cb648c73c5a13af09d21d064a0fa8 /cmake
parent964ffb40b4a1d93d88cfadaa53fc050ac67e443e (diff)
[HICN-643] Fix scripts for publishing release.
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: If01c46dcf8981385e544c9cc6c31ce1efe3c2d96
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/Packager.cmake31
1 files changed, 26 insertions, 5 deletions
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index 1edfd671d..7b7556394 100644
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -62,6 +62,25 @@ macro(extract_version)
list(GET VER 3 COMMIT_NAME)
endmacro(extract_version)
+macro(extract_previous_version)
+ execute_process(
+ COMMAND bash -c "git describe --abbrev=0 --tags --match v* $(git rev-list --tags --skip=1 --max-count=1)"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ OUTPUT_VARIABLE VER
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ if (NOT VER)
+ set(VER "v1.2-0-gcafe")
+ endif()
+
+ message(STATUS "Git describe output: ${VER}")
+
+ string(REGEX REPLACE "v([0-9]+).([0-9]+)" "\\1;\\2;" VER ${VER})
+ list(GET VER 0 VERSION_MAJOR)
+ list(GET VER 1 VERSION_MINOR)
+endmacro(extract_previous_version)
+
macro(make_packages)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# parse /etc/os-release
@@ -92,15 +111,17 @@ macro(make_packages)
set(bld "b$ENV{BUILD_NUMBER}")
endif()
- message("Build number is: ${bld}")
+ message(STATUS "Build number is: ${bld}")
#define DEB and RPM version numbers
if(${commit_num} EQUAL 0)
- set(deb_ver "${tag}")
- set(rpm_ver "${tag}")
+ extract_previous_version()
+ set(tag "${VERSION_MAJOR}.${VERSION_MINOR}")
+ set(deb_ver "${tag}-release")
+ set(rpm_ver "${tag}-release")
else()
- set(deb_ver "${tag}-${commit_num}-release")
- set(rpm_ver "${tag}-${commit_num}-release")
+ set(deb_ver "${tag}-${commit_num}")
+ set(rpm_ver "${tag}-${commit_num}")
endif()
get_next_version(${tag} next_version)