aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcmake/Modules/Packager.cmake56
-rw-r--r--hicn-light/cmake/Modules/Packaging.cmake4
-rw-r--r--hicn-plugin/cmake/Modules/Packaging.cmake4
-rw-r--r--lib/cmake/Modules/Packaging.cmake11
-rwxr-xr-xlibtransport/cmake/Modules/Packaging.cmake20
-rw-r--r--scripts/build-packages.sh128
-rw-r--r--utils/cmake/Modules/Packaging.cmake4
7 files changed, 195 insertions, 32 deletions
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index f060bfa4b..8f7ba4264 100755
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -42,7 +42,7 @@ macro(make_packages)
)
if (NOT VER)
- set(VER 1.0)
+ set(VER "v1.0-1-gcafe")
endif()
string(REGEX REPLACE "v(.*)-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3" VER ${VER})
@@ -51,13 +51,19 @@ macro(make_packages)
list(GET VER 1 commit_num)
list(GET VER 2 commit_name)
+ if (NOT ENV{BUILD_NUMBER})
+ set(bld "b1")
+ else()
+ set(bld "b$ENV{BUILD_NUMBER}")
+ endif()
+
#define DEB and RPM version numbers
if(${commit_num} EQUAL 0)
set(deb_ver "${tag}")
set(rpm_ver "${tag}")
else()
- set(deb_ver "${tag}~${commit_num}~${commit_name}")
- set(rpm_ver "${tag}~${commit_num}_${commit_name}")
+ set(deb_ver "${tag}-${commit_num}-${commit_name}~${bld}")
+ set(rpm_ver "${tag}-${commit_num}_${commit_name}~${bld}")
endif()
get_cmake_property(components COMPONENTS)
@@ -65,29 +71,57 @@ macro(make_packages)
if(OS_ID_LIKE MATCHES "debian")
set(CPACK_GENERATOR "DEB")
set(type "DEBIAN")
+
+ execute_process(
+ COMMAND dpkg --print-architecture
+ OUTPUT_VARIABLE arch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
set(CPACK_PACKAGE_VERSION "${deb_ver}")
- set(CPACK_${type}_FILE_NAME DEB-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${${lc}_DEB_DEPENDENCIES}")
+ set(CPACK_${type}_${uc}_FILE_NAME "${lc}_${tag}-${commit_num}-release_${arch}.deb")
+
+ set(DEB_DEPS)
+ if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
+ string(REPLACE "stable_version" ${tag} DEB_DEPS ${${lc}_DEB_DEPENDENCIES})
+ endif()
+
+ set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${DEB_DEPS}")
set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
endforeach()
elseif(OS_ID_LIKE MATCHES "rhel")
set(CPACK_GENERATOR "RPM")
set(type "RPM")
+
+ execute_process(
+ COMMAND uname -m
+ OUTPUT_VARIABLE arch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
set(CPACK_PACKAGE_VERSION "${rpm_ver}")
- set(CPACK_${type}_FILE_NAME RPM-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
+ set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
+
+ set(RPM_DEPS)
+ if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
+ string(REPLACE "stable_version" ${tag} RPM_DEPS ${${lc}_RPM_DEPENDENCIES})
+ endif()
+
+ set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${RPM_DEPS}")
+
if(${lc} MATCHES ".*-dev")
- set(CPACK_${type}_${uc}_DEBUGINFO_PACKAGE ON)
- set(lc ${lc}el)
+ set(package_name ${lc}el)
+ else()
+ set(package_name ${lc})
endif()
- set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
- set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
- set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${${lc}_RPM_DEPENDENCIES}")
+ set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
+ set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${tag}-${commit_num}-release.${arch}.rpm")
endforeach()
endif()
diff --git a/hicn-light/cmake/Modules/Packaging.cmake b/hicn-light/cmake/Modules/Packaging.cmake
index 386c9e985..7e8399626 100644
--- a/hicn-light/cmake/Modules/Packaging.cmake
+++ b/hicn-light/cmake/Modules/Packaging.cmake
@@ -21,11 +21,11 @@ set(${LIBHICN_LIGHT}_DESCRIPTION
)
set(${LIBHICN_LIGHT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0)"
+ "libhicn (>= stable_version), libparc (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${LIBHICN_LIGHT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0"
+ "libhicn >= stable_version, libparc >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/hicn-plugin/cmake/Modules/Packaging.cmake b/hicn-plugin/cmake/Modules/Packaging.cmake
index 21ba4138d..ce3b69f8f 100644
--- a/hicn-plugin/cmake/Modules/Packaging.cmake
+++ b/hicn-plugin/cmake/Modules/Packaging.cmake
@@ -21,11 +21,11 @@ set(${HICN_PLUGIN}_DESCRIPTION
)
set(${HICN_PLUGIN}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), vpp (== 19.01-release), vpp-plugins (== 19.01-release)"
+ "libhicn (>= stable_version), vpp (== stable_version-release), vpp-plugins (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${HICN_PLUGIN}_RPM_DEPENDENCIES
- "libhicn >= 1.0, vpp = 19.01-release, vpp-plugins = 19.01-release"
+ "libhicn >= stable_version, vpp = stable_version-release, vpp-plugins = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/lib/cmake/Modules/Packaging.cmake b/lib/cmake/Modules/Packaging.cmake
index 5f946f95d..2ceda1426 100644
--- a/lib/cmake/Modules/Packaging.cmake
+++ b/lib/cmake/Modules/Packaging.cmake
@@ -23,19 +23,20 @@ socket API, etc"
CACHE STRING "Description for deb/rpm package."
)
-set(lib${LIBHICN}-dev_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+set(lib${LIBHICN}_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
CACHE STRING "Description for deb/rpm package."
)
-set(lib${LIBHICN}-devel_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+
+set(lib${LIBHICN}-dev_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
CACHE STRING "Description for deb/rpm package."
)
set(lib${LIBHICN}-dev_DEB_DEPENDENCIES
- "libhicn (>= 1.0)"
+ "libhicn (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
-set(lib${LIBHICN}-devel_DEB_DEPENDENCIES
- "libhicn >= 1.0"
+set(lib${LIBHICN}-dev_RPM_DEPENDENCIES
+ "libhicn >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/libtransport/cmake/Modules/Packaging.cmake b/libtransport/cmake/Modules/Packaging.cmake
index 84e58c962..64d1dd325 100755
--- a/libtransport/cmake/Modules/Packaging.cmake
+++ b/libtransport/cmake/Modules/Packaging.cmake
@@ -32,44 +32,44 @@ set(lib${LIBTRANSPORT}-devel_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
if ((BUILD_MEMIF_CONNECTOR OR BUILD_VPP_PLUGIN) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0), vpp-lib (== 19.01-release)"
+ "libhicn (>= stable_version), libparc (>= 1.0), vpp-lib (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0, vpp-lib = 19.01-release"
+ "libhicn >= stable_version, libparc >= 1.0, vpp-lib = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0), vpp-dev (== 19.01-release)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
- set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
- "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0, vpp-devel = 19.01-release"
+ set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, libhicn-devel >= stable_version, libparc-devel >= 1.0, vpp-devel = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
else()
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0)"
+ "libhicn (>= stable_version), libparc (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0"
+ "libhicn >= stable_version, libparc >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
- set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
- "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0"
+ set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, libhicn-devel >= stable_version, libparc-devel >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index ae775aca9..6101e93fa 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -11,4 +11,132 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/bin/bash
+set -euxo pipefail
+
+SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+APT_PATH=`which apt-get` || true
+apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
+
+PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio/release/script.deb.sh"
+PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh"
+
+BUILD_TOOLS_UBUNTU="build-essential doxygen"
+LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
+DEPS_UBUNTU="libparc-dev libasio-dev"
+
+# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
+DEPS_CENTOS="libparc-devel asio-devel centos-release-scl devtoolset-7"
+LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
+
+install_cmake() {
+ cat /etc/resolv.conf
+ echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
+ cat /etc/resolv.conf
+
+ CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh"
+ CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh"
+ curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT}
+
+ sudo mkdir -p /opt/cmake
+ sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=/opt/cmake
+ export PATH=/opt/cmake/bin:${PATH}
+}
+
+# Parameters:
+# $1 = Distribution id
+# $2 = Distribution codename
+#
+setup_fdio_repo() {
+ DISTRIB_ID=${1}
+
+ if [ "${DISTRIB_ID}" == "ubuntu" ]; then
+ 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
+ rpm -ivh epel-release-latest-7.noarch.rpm || true
+ else
+ echo "Distribution ${DISTRIB_ID} is not supported"
+ exit -1
+ fi
+}
+
+setup() {
+ # Figure out what system we are running on
+ if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ else
+ echo "ERROR: System configuration not recognized. Build failed"
+ exit -1
+ fi
+
+ DISTRIB_ID=${ID}
+
+ echo DISTRIBUTION: ${PRETTY_NAME}
+ echo ARCHITECTURE: $(uname -m)
+
+ install_cmake
+ setup_fdio_repo ${DISTRIB_ID}
+
+ if [ "${DISTRIB_ID}" == "ubuntu" ]; then
+ sudo ${apt_get} update || true
+ fi
+
+ # Install dependencies
+ if [ ${DISTRIB_ID} == "ubuntu" ]; then
+ echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
+ elif [ ${DISTRIB_ID} == "centos" ]; then
+ # echo ${BUILD_TOOLS_GROUP_CENTOS} | xargs sudo yum groupinstall -y --nogpgcheck
+ echo ${DEPS_CENTOS} | xargs sudo yum install -y --nogpgcheck
+ sudo yum install devtoolset-7
+ scl enable devtoolset-7 bash
+
+ c++ --version
+
+ CXX_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/c++"
+ CC_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/cc"
+
+ ${CXX_COMPILER} --version
+ ${CC_COMPILER} --version
+
+ export CC=${CC_COMPILER} CXX=${CXX_COMPILER}
+ fi
+
+ # do nothing but check compiler version
+ c++ --version
+}
+
+# Parameters:
+# $1 = Package name
+#
+build_package() {
+ setup
+
+ echo "*******************************************************************"
+ echo "********************* STARTING PACKAGE BUILD **********************"
+ echo "*******************************************************************"
+
+ # Make the package
+ mkdir -p ${SCRIPT_PATH}/../build && pushd ${SCRIPT_PATH}/../build
+
+ rm -rf *
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+ make package
+
+ find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
+
+ popd
+
+ echo "*******************************************************************"
+ echo "***************** BUILD COMPLETED SUCCESSFULLY *******************"
+ echo "*******************************************************************"
+
+ exit 0
+}
+
+pushd ${SCRIPT_PATH}/..
+build_package
+popd
+
exit 0 \ No newline at end of file
diff --git a/utils/cmake/Modules/Packaging.cmake b/utils/cmake/Modules/Packaging.cmake
index cff3d3fb1..37c123cf2 100644
--- a/utils/cmake/Modules/Packaging.cmake
+++ b/utils/cmake/Modules/Packaging.cmake
@@ -18,11 +18,11 @@ useful for testing and debugging within a hicn network."
)
set(${HICN_UTILS}_DEB_DEPENDENCIES
- "libhicntransport (>= 1.0)"
+ "libhicntransport (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${HICN_UTILS}_RPM_DEPENDENCIES
- "libhicntransport >= 1.0"
+ "libhicntransport >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file