aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-11-06 20:19:46 +0100
committerMauro Sardara <msardara@cisco.com>2020-11-06 23:54:23 +0100
commitc1de1ea148175650dfeab648d946e3266fdee117 (patch)
tree8cd771d5d18bcc35a54c809b1c5717be5c043acf /cmake
parent7f2bbf5f6934be58c016f0159e497fa519d14372 (diff)
[HICN-654] Fix versioning.
- Add rc0 tag for release candidate packages pushed in hicn repo - Fix version for centos and aarch64 packages Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I0b04d8164690635c19a0d429fb383268b9d3318e
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/Packager.cmake32
1 files changed, 22 insertions, 10 deletions
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index a943d1905..7aad1d7b0 100644
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -55,10 +55,10 @@ macro(extract_version)
message(STATUS "Git describe output: ${VER}")
- string(REGEX REPLACE "v([0-9]+).([0-9]+)(.*)?-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3;\\4;\\5" VER ${VER})
+ string(REGEX REPLACE "v([0-9]+).([0-9]+)-?(.*)?-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3;\\4;\\5;" VER ${VER})
list(GET VER 0 VERSION_MAJOR)
list(GET VER 1 VERSION_MINOR)
- list(GET VER 2 RELEASE)
+ list(GET VER 2 RELEASE_CANDIDATE)
list(GET VER 3 VERSION_REVISION)
list(GET VER 4 COMMIT_NAME)
endmacro(extract_version)
@@ -79,7 +79,7 @@ function(make_packages)
message(STATUS "Version major: ${VERSION_MAJOR}")
message(STATUS "Version minor: ${VERSION_MINOR}")
- message(STATUS "Release: ${RELEASE}")
+ message(STATUS "Release: ${RELEASE_CANDIDATE}")
message(STATUS "Revision: ${VERSION_REVISION}")
message(STATUS "Commit hash: ${COMMIT_NAME}")
@@ -97,12 +97,23 @@ function(make_packages)
message(STATUS "Build number is: ${bld}")
#define DEB and RPM version numbers
- if("${RELEASE}" STREQUAL "-release")
- set(deb_ver "${tag}-release")
- set(rpm_ver "${tag}-release")
+ if(NOT RELEASE_CANDIDATE)
+ if (commit_num)
+ set(deb_ver "${tag}.${commit_num}-release")
+ set(rpm_ver "${tag}.${commit_num}")
+ else()
+ set(deb_ver "${tag}-release")
+ set(rpm_ver "${tag}")
+ endif()
+ set(rpm_release "release")
else()
+ # TODO To be changed for next release with
+ # set(deb_ver "${tag}${RELEASE_CANDIDATE}~${commit_num}")
+ # set(rpm_ver "${tag}")
+ # set(rpm_release "${RELEASE_CANDIDATE}~${commit_num}")
set(deb_ver "${tag}-${commit_num}")
set(rpm_ver "${tag}-${commit_num}")
+ set(rpm_release "1")
endif()
message(STATUS "Version: ${deb_ver}")
@@ -130,7 +141,7 @@ function(make_packages)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- set(CPACK_PACKAGE_VERSION "${deb_ver}")
+ set(CPACK_${type}_PACKAGE_VERSION "${deb_ver}")
foreach(lc ${components})
if (${lc} MATCHES ".*Unspecified.*")
continue()
@@ -163,7 +174,8 @@ function(make_packages)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- set(CPACK_PACKAGE_VERSION "${rpm_ver}")
+ set(CPACK_${type}_PACKAGE_VERSION "${rpm_ver}")
+ set(CPACK_${type}_PACKAGE_RELEASE "${rpm_release}")
foreach(lc ${components})
if (${lc} MATCHES ".*Unspecified.*")
continue()
@@ -187,7 +199,7 @@ function(make_packages)
endif()
set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
- set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}.${arch}.rpm")
+ set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}-${rpm_release}.${arch}.rpm")
if (NOT ${${lc}_RPM_POST_INSTALL_SCRIPT_FILE} STREQUAL "")
set(CPACK_RPM_${uc}_POST_INSTALL_SCRIPT_FILE "${${lc}_RPM_POST_INSTALL_SCRIPT_FILE}")
@@ -210,7 +222,7 @@ function(make_packages)
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
set(CPACK_${CPACK_GENERATOR}_COMPONENT_INSTALL ON)
set(CPACK_${type}_PACKAGE_MAINTAINER "HICN Team")
- set(CPACK_${type}_PACKAGE_RELEASE 1)
+ set(CPACK_PACKAGE_CONTACT ${CONTACT})
include(CPack)
endif()
endif()