From c1de1ea148175650dfeab648d946e3266fdee117 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Fri, 6 Nov 2020 20:19:46 +0100 Subject: [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 Change-Id: I0b04d8164690635c19a0d429fb383268b9d3318e --- cmake/Modules/Packager.cmake | 32 +++++++++++++------ scripts/build-extras.sh | 12 ++++++++ scripts/functions.sh | 73 ++++++++++++++++++++++---------------------- 3 files changed, 70 insertions(+), 47 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() diff --git a/scripts/build-extras.sh b/scripts/build-extras.sh index 948e2d15b..78a6ac98e 100644 --- a/scripts/build-extras.sh +++ b/scripts/build-extras.sh @@ -17,6 +17,18 @@ set -euxo pipefail SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) source ${SCRIPT_PATH}/functions.sh +# Libparc and libmemif are still not available in Ubuntu 20, so +# we remove it from the list for now. +# TODO Remove it as soon as they are available. +DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libmemif-dev"}) +DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libmemif"}) +DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libparc-dev"}) + +DEPS_CENTOS=(${DEPS_CENTOS[@]/"libmemif-devel"}) +DEPS_CENTOS=(${DEPS_CENTOS[@]/"libmemif"}) +DEPS_CENTOS=(${DEPS_CENTOS[@]/"libparc-devel"}) + + # Parameters: # $1 = Package name # diff --git a/scripts/functions.sh b/scripts/functions.sh index d047aa094..7258800b2 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -35,46 +35,45 @@ else exit 1 fi -VERSION_REGEX="s/v([0-9]+).([0-9]+)(.*)?-([0-9]+)-(g[0-9a-f]+)/\1.\2\3-release/g" +VERSION_REGEX="s/v([0-9]+).([0-9]+)(.*)?-([0-9]+)-(g[0-9a-f]+)/\1.\2-release/g" VPP_VERSION_DEB=$(git describe --long --match "v*" | sed -E ${VERSION_REGEX}) VPP_VERSION_RPM="${VPP_VERSION_DEB}.x86_64" -BUILD_TOOLS_UBUNTU="" -LIBSSL_LIBEVENT_UBUNTU=" " -DEPS_UBUNTU="build-essential \ - doxygen \ - curl \ - libparc-dev \ - libmemif-dev \ - libmemif \ - libasio-dev \ - libconfig-dev \ - libcurl4-openssl-dev \ - collectd-dev \ - libevent-dev \ - libssl-dev \ - ninja-build \ - vpp=${VPP_VERSION_DEB} \ - vpp-dev=${VPP_VERSION_DEB} \ - libvppinfra=${VPP_VERSION_DEB} \ - libvppinfra-dev=${VPP_VERSION_DEB} \ - vpp-plugin-core=${VPP_VERSION_DEB} \ - python3-ply" +DEPS_UBUNTU=("build-essential" + "doxygen" + "curl" + "libparc-dev" + "libmemif-dev" + "libmemif" + "libasio-dev" + "libconfig-dev" + "libcurl4-openssl-dev" + "collectd-dev" + "libevent-dev" + "libssl-dev" + "ninja-build" + "vpp=${VPP_VERSION_DEB}" + "vpp-dev=${VPP_VERSION_DEB}" + "libvppinfra=${VPP_VERSION_DEB}" + "libvppinfra-dev=${VPP_VERSION_DEB}" + "vpp-plugin-core=${VPP_VERSION_DEB}" + "python3-ply") # BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} \ - vpp-lib-${VPP_VERSION_RPM} \ - libparc-devel \ - curl \ - libmemif-devel \ - ninja-build \ - libmemif \ - libcurl-devel \ - asio-devel \ - libconfig-devel \ - centos-release-scl \ - bzip2 \ - devtoolset-7" +DEPS_CENTOS=("vpp-devel-${VPP_VERSION_RPM}" + "vpp-lib-${VPP_VERSION_RPM}" + "libparc-devel" + "curl" + "libmemif-devel" + "ninja-build" + "libmemif" + "libcurl-devel" + "asio-devel" + "libconfig-devel" + "centos-release-scl" + "bzip2" + "devtoolset-7" + "rpm-build") LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" COLLECTD_SOURCE="https://storage.googleapis.com/collectd-tarballs/collectd-5.9.2.tar.bz2" @@ -123,9 +122,9 @@ function install_deps() { DISTRIB_ID=${ID} if [ ${DISTRIB_ID} == "ubuntu" ]; then - echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends + echo ${DEPS_UBUNTU[@]} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends elif [ ${DISTRIB_ID} == "centos" ]; then - echo ${DEPS_CENTOS} | xargs sudo yum install -y --nogpgcheck + echo ${DEPS_CENTOS[@]} | xargs sudo yum install -y --nogpgcheck ${CXX_COMPILER} --version ${CC_COMPILER} --version fi -- cgit 1.2.3-korg