summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-02-18 09:22:44 -0500
committerMichal Cmarada <mcmarada@cisco.com>2019-02-19 08:53:12 +0100
commiteb28616ca1c69184b7b2b4cf4ba96cf4df29f978 (patch)
tree1610251180d5f8dc8d0814c7636072fc9387176d
parente3665c6b2cb135f935eb266c3958b6d639dad1e5 (diff)
JVPP-22: Update packaging
- rpm package name update according to naming conventions - vpp instalation verification - update versioning script Change-Id: I962895ce636aec949930ea452d1e924024c4b780 Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
-rw-r--r--CMakeLists.txt22
-rwxr-xr-xclean.sh14
-rwxr-xr-xinstall_jvpp.sh13
-rw-r--r--java/CMakeLists.txt28
-rwxr-xr-xscripts/verify-installed25
-rwxr-xr-xversion47
6 files changed, 126 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a58d788..2074565 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,20 +102,32 @@ find_path(JAVA_HOME_SET NAMES include/jni.h PATHS ${dirlist})
if (NOT JAVA_HOME_SET)
message("JAVA_HOME is not found")
else()
- message("JAVA HOME: ${JAVA_HOME}")
set(ENV{JAVA_HOME} "${JAVA_HOME_SET}")
endif()
message("\nJAVA:")
-message(" JAVA_HOME: $ENV{JAVA_HOME}")
-
+message(" Java home: $ENV{JAVA_HOME}")
find_package(Java 1.8 REQUIRED COMPONENTS Development)
-message("JAVA: ${Java}")
get_filename_component(jvm_path ${Java_JAVAC_EXECUTABLE} DIRECTORY)
set(Java_INCLUDE_DIRS ${jvm_path}/../include ${jvm_path}/../include/linux)
message(" Java headers: ${Java_INCLUDE_DIRS}")
message(" Java compiler: ${Java_JAVAC_EXECUTABLE}")
+
+execute_process(COMMAND ./scripts/verify-installed vpp* OUTPUT_VARIABLE VPP_INSTALLED)
+string(STRIP "${VPP_INSTALLED}" VPP_INSTALLED)
+
+if (${VPP_INSTALLED} MATCHES "vpp-dev")
+ message("\nVPP instalation found.")
+ message("Packages: \n${VPP_INSTALLED}")
+else()
+ if (${RELEASE_ID} IN_LIST DebianBasedOS)
+ set(REQUIREMENTS "vpp, vpp-dev, libvppinfra, vpp-plugin-core")
+ else()
+ set(REQUIREMENTS "vpp, vpp-devel, vpp-plugins")
+ endif()
+ message(FATAL_ERROR "Error VPP is not installed.\nPlease install: ${REQUIREMENTS}.")
+endif()
+
add_subdirectory(java)
-#find_package(vpp REQUIRED)
diff --git a/clean.sh b/clean.sh
index 4f81a09..92e3185 100755
--- a/clean.sh
+++ b/clean.sh
@@ -1,4 +1,18 @@
#!/usr/bin/env bash
+
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
echo "JVPP cleanup started"
make clean
rm -rf build-root/packages/*
diff --git a/install_jvpp.sh b/install_jvpp.sh
index 1c3a101..52d453e 100755
--- a/install_jvpp.sh
+++ b/install_jvpp.sh
@@ -1,5 +1,18 @@
#!/usr/bin/env bash
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
MAIN_VER="$(./version | cut -f1 -d"-")"
VERSION="$(./version | cut -f1 -d"~")"
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 460a955..1f72782 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -274,11 +274,6 @@ endif ()
unset(vpp_version)
set(COLUMNS 200)
-execute_process(
- COMMAND dpkg -l vpp
- COMMAND grep vpp
- COMMAND awk "{print $3}" OUTPUT_VARIABLE vpp_version)
-string(REGEX REPLACE "\n$" "" vpp_version "${vpp_version}")
set(CPACK_PACKAGE_DESCRIPTION "VPP-Java-API-bindings
This package contains VPP java api bindings.")
@@ -291,6 +286,8 @@ set(CPACK_OUTPUT_FILE_PREFIX build-root/packages)
set(CPACK_PACKAGE_FILE_NAME "vpp-api-java_${JVPP_VERSION}")
if (${RELEASE_ID} IN_LIST DebianBasedOS)
set(CPACK_GENERATOR DEB)
+ execute_process(COMMAND ./version deb-vpp-version OUTPUT_VARIABLE vpp_version)
+ string(STRIP "${vpp_version}" vpp_version)
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
@@ -309,13 +306,27 @@ if (${RELEASE_ID} IN_LIST DebianBasedOS)
elseif (${RELEASE_ID} IN_LIST RHBasedOS)
set(CPACK_GENERATOR RPM)
+ execute_process(COMMAND ./version rpm-vpp-version OUTPUT_VARIABLE vpp_version)
+ string(STRIP "${vpp_version}" vpp_version)
# Excluding /usr/share/java top level directory due to conflict with javapackages-tools (openjdk dependency)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/java")
set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
- set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_RPM_PACKAGE_SECTION "${CPACK_PACKAGE_SECTION}")
- set(CPACK_RPM_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
+ execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE)
+ string(STRIP "${CPACK_RPM_PACKAGE_ARCHITECTURE}" CPACK_RPM_PACKAGE_ARCHITECTURE)
+ execute_process(COMMAND ./version rpm-version OUTPUT_VARIABLE CPACK_RPM_PACKAGE_VERSION)
+ string(STRIP "${CPACK_RPM_PACKAGE_VERSION}" CPACK_RPM_PACKAGE_VERSION)
+ execute_process(COMMAND ./version rpm-release OUTPUT_VARIABLE CPACK_RPM_PACKAGE_RELEASE)
+ string(STRIP "${CPACK_RPM_PACKAGE_RELEASE}" CPACK_RPM_PACKAGE_RELEASE)
+ execute_process(COMMAND ./version os-version-id OUTPUT_VARIABLE OS_VERSION_ID)
+ string(STRIP "${OS_VERSION_ID}" OS_VERSION_ID)
+
+ # according to naming conventions file name should consist of:
+ # name-version-release.architecture.rpm (e.g. vpp-api-java-19.04-SNAPSHOT~9_ge3665c6~b7.x86_64.rpm)
+ if (${RELEASE_ID} MATCHES "CentOS" AND ${OS_VERSION_ID} MATCHES "7")
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
+ endif ()
set(CPACK_RPM_PACKAGE_PRIORITY extra)
set(CPACK_RPM_PACKAGE_DEPENDS "vpp (>= ${vpp_version}), vpp-plugins (>= ${vpp_version})")
@@ -323,8 +334,9 @@ elseif (${RELEASE_ID} IN_LIST RHBasedOS)
message("\nRPM package:")
message(" Name: ${CPACK_RPM_PACKAGE_NAME}")
message(" Version: ${CPACK_RPM_PACKAGE_VERSION}")
+ message(" Release: ${CPACK_RPM_PACKAGE_RELEASE}")
message(" Description: ${CPACK_RPM_PACKAGE_DESCRIPTION}")
- message(" File name: ${CPACK_RPM_PACKAGE_FILE_NAME}")
+ message(" File name: ${CPACK_PACKAGE_FILE_NAME}")
message(" Depends on: ${CPACK_RPM_PACKAGE_DEPENDS}\n")
endif ()
if (PackZip)
diff --git a/scripts/verify-installed b/scripts/verify-installed
new file mode 100755
index 0000000..908eb93
--- /dev/null
+++ b/scripts/verify-installed
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package=$1
+source /etc/os-release
+
+if [[ "$ID" = "centos" ]]; then
+ yum list installed | grep ${package}
+ exit
+else
+ dpkg -l ${package} |grep ii | grep ${package}
+fi
+
diff --git a/version b/version
index 55f8754..a9c6126 100755
--- a/version
+++ b/version
@@ -17,11 +17,11 @@ path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
cd "$path"
-if [ -f .version ]; then
+if [[ -f .version ]]; then
vstring=$(cat .version)
else
vstring=$(git describe)
- if [ $? != 0 ]; then
+ if [[ $? != 0 ]]; then
exit 1
fi
fi
@@ -30,30 +30,57 @@ TAG=$(echo ${vstring} | cut -d- -f1 | sed -e 's/^v//')
ADD=$(echo ${vstring} | cut -s -d- -f2)
git rev-parse 2> /dev/null
-if [ $? == 0 ]; then
+if [[ $? == 0 ]]; then
CMT=$(git describe --dirty --long | cut -s -d- -f3,4)
else
CMT=$(echo ${vstring} | cut -s -d- -f3,4)
fi
-CMTR=$(echo $CMT | sed 's/-/_/')
+CMTR=$(echo ${CMT} | sed 's/-/_/')
-if [ -n "${BUILD_NUMBER}" ]; then
+if [[ -n "${BUILD_NUMBER}" ]]; then
BLD="~b${BUILD_NUMBER}"
fi
-if [ "$1" = "rpm-version" ]; then
+if [[ "$1" = "rpm-version" ]]; then
echo ${TAG}
exit
fi
-if [ "$1" = "rpm-release" ]; then
- [ -z "${ADD}" ] && echo release && exit
+if [[ "$1" = "rpm-release" ]]; then
+ [[ -z "${ADD}" ]] && echo release && exit
echo ${ADD}${CMTR:+~${CMTR}}${BLD}
exit
fi
- if [ -n "${ADD}" ]; then
- if [ "$1" = "rpm-string" ]; then
+if [[ "$1" = "deb-vpp-version" ]]; then
+ vpp_version=`dpkg -l vpp |grep vpp |awk '{print $3}'`
+ echo ${vpp_version}
+ exit
+fi
+
+if [[ "$1" = "rpm-vpp-version" ]]; then
+ vpp_version=`yum list installed vpp |grep vpp |awk -F' ' '{print $2}'`
+ echo ${vpp_version}
+ exit
+fi
+
+
+if [[ "$1" = "os-version-id" ]]; then
+ [[ -z "${ADD}" ]] && echo release && exit
+ source /etc/os-release
+ echo ${VERSION_ID}
+ exit
+fi
+if [[ "$1" = "os-id" ]]; then
+ [[ -z "${ADD}" ]] && echo release && exit
+ source /etc/os-release
+ echo ${ID}
+ exit
+fi
+
+
+ if [[ -n "${ADD}" ]]; then
+ if [[ "$1" = "rpm-string" ]]; then
echo ${TAG}-${ADD}${CMTR:+~${CMTR}}${BLD}
else
echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}