summaryrefslogtreecommitdiffstats
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
parent964ffb40b4a1d93d88cfadaa53fc050ac67e443e (diff)
[HICN-643] Fix scripts for publishing release.
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: If01c46dcf8981385e544c9cc6c31ce1efe3c2d96
-rw-r--r--cmake/Modules/Packager.cmake31
-rw-r--r--scripts/build-packages.sh3
2 files changed, 27 insertions, 7 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)
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index 3e19138ed..abbb2565a 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -113,8 +113,7 @@ setup_fdio_repo() {
DISTRIB_ID=${1}
if [ "${DISTRIB_ID}" == "ubuntu" ]; then
- rm -r /etc/apt/sources.list.d/*
- curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
+ curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
elif [ "${DISTRIB_ID}" == "centos" ]; then
curl -s ${PACKAGECLOUD_RELEASE_REPO_RPM} | sudo bash
curl ${LATEST_EPEL_REPO} > epel-release-latest-7.noarch.rpm