diff options
Diffstat (limited to 'java/CMakeLists.txt')
-rw-r--r-- | java/CMakeLists.txt | 28 |
1 files changed, 20 insertions, 8 deletions
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) |