This is an automated email from the ASF dual-hosted git repository. boroknagyz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push: new 050805d21 IMPALA-12362: (part-4/4) Refactor linux packaging related cmake files. 050805d21 is described below commit 050805d21b649e49beaea9a805b274c8270da8c8 Author: Xiang Yang <yx91...@126.com> AuthorDate: Tue Jan 16 16:39:49 2024 +0000 IMPALA-12362: (part-4/4) Refactor linux packaging related cmake files. Independent linux packaging related content to package/CMakeLists.txt to make it more clearly. This patch also add LICENSE and NOTICE file in the final package. Testing: - Manually deploy package on Ubuntu22.04 and verify it. Change-Id: If3914dcda69f81a735cdf70d76c59fa09454777b Reviewed-on: http://gerrit.cloudera.org:8080/20263 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> --- .gitignore | 3 ++ CMakeLists.txt | 107 +------------------------------------- NOTICE.txt | 2 +- package/CMakeLists.txt | 136 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 107 deletions(-) diff --git a/.gitignore b/.gitignore index c34a9544e..c66967175 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,9 @@ build.ninja rules.ninja CMakeDoxyfile.in CMakeDoxygenDefaults.cmake +CPackConfig.cmake +CPackSourceConfig.cmake +_CPack_Packages # Build timestamp files .*timestamp diff --git a/CMakeLists.txt b/CMakeLists.txt index a34cd46e6..9dcfeee89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,6 @@ set(NO_TESTS 1) # initialized. project(Impala) -option(BUILD_PACKAGES "Build deployment packages") - include(cmake_modules/kudu_cmake_fns.txt) if (NOT DEFINED BUILD_SHARED_LIBS) @@ -497,11 +495,6 @@ else() set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM ${JUNITXML_WRAPPER}) endif() -cmake_host_system_information(RESULT OS_DISTRIB_ID QUERY DISTRIB_ID) -cmake_host_system_information(RESULT OS_DISTRIB_VERSION_ID QUERY DISTRIB_VERSION_ID) -message(STATUS "DISTRIB_ID: ${OS_DISTRIB_ID}") -message(STATUS "DISTRIB_VERSION_ID: ${OS_DISTRIB_VERSION_ID}") - ## installation path set(CMAKE_INSTALL_PREFIX "/opt") set(IMPALA_INSTALLDIR "impala" CACHE INTERNAL "") @@ -515,42 +508,7 @@ add_subdirectory(be) add_subdirectory(docker) add_subdirectory(java) add_subdirectory(shell) - -install(DIRECTORY "www/" DESTINATION ${IMPALA_INSTALLDIR}/www) -install(FILES fe/target/impala-frontend-$ENV{IMPALA_VERSION}.jar - DESTINATION ${IMPALA_INSTALLDIR}/lib/jars) - -set(IMPALA_GCC_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/gcc-$ENV{IMPALA_GCC_VERSION}) -FILE(GLOB gcc_lib ${IMPALA_GCC_HOME}/lib64/libgcc_s.so.1*) -install(FILES ${gcc_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) - -FILE(GLOB cpp_lib ${IMPALA_GCC_HOME}/lib64/libstdc++.so.6*) -install(FILES ${cpp_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) - -set(KUDU_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/kudu-$ENV{IMPALA_KUDU_VERSION}/release) -# The parent folder is lib64 on centos/redhat, while on ubuntu it's lib. -FILE(GLOB kudu_lib ${KUDU_HOME}/lib*/libkudu_client.so*) -install(FILES ${kudu_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) - -FILE(GLOB hadoop_lib $ENV{HADOOP_LIB_DIR}/native/libhadoop.so*) -install(FILES ${hadoop_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) - -install(DIRECTORY fe/target/dependency/ DESTINATION ${IMPALA_INSTALLDIR}/lib/jars - FILES_MATCHING PATTERN "*.jar") - -string(TOLOWER ${OS_DISTRIB_ID} OS_DISTRIB_ID) -if (${OS_DISTRIB_ID} STREQUAL "rhel" AND ${OS_DISTRIB_VERSION_ID} VERSION_GREATER_EQUAL 8) - # TODO: remove this after resolving IMPALA-12255 - message(STATUS "Not packaging impala-shell on redhat8+ due to ambiguous python shebang") -else() - install(DIRECTORY shell/build/impala-shell-$ENV{IMPALA_VERSION}/ - DESTINATION ${IMPALA_INSTALLDIR}/shell - USE_SOURCE_PERMISSIONS PATTERN "*.pyc" EXCLUDE) -endif() - -install(DIRECTORY package/bin/ DESTINATION ${IMPALA_INSTALLDIR}/bin - USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*.sh") -install(DIRECTORY package/conf/ DESTINATION ${IMPALA_INSTALLDIR}/conf) +add_subdirectory(package) # Build target for all generated files which most backend code depends on add_custom_target(gen-deps ALL DEPENDS thrift-deps proto-deps fb-deps @@ -600,66 +558,3 @@ if (DUMP_INCLUDE_PATHS) endif(DUMP_INCLUDE_PATHS) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++") - -# packaging -if (BUILD_PACKAGES) - - if (${OS_DISTRIB_ID} MATCHES "(rhel|centos)") - set(CPACK_GENERATOR "RPM") - elseif (${OS_DISTRIB_ID} MATCHES "ubuntu") - set(CPACK_GENERATOR "DEB") - else() - message(WARNING "OS is ${OS_DISTRIB_ID}. No packages will be generated.") - endif() - - if (CPACK_GENERATOR) - message(STATUS "Packaging enabled: ${CPACK_GENERATOR}") - set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) - set(CPACK_PACKAGE_VENDOR "Apache") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An open source massively parallel processing SQL query engine.") - set(CPACK_PACKAGE_CONTACT "d...@impala.apache.org") - set(CPACK_PACKAGE_HOMEPAGE_URL "https://impala.apache.org") - set(CPACK_PACKAGE_VERSION "$ENV{IMPALA_VERSION}") - set(CPACK_RPM_PACKAGE_LICENSE "ASL-2.0") - # Set a meaningful package name, e.g. Impala-4.3.0-SNAPSHOT_hive-3.1.3000.7.2.18.0-41-x86_64.el7 - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_hive-$ENV{IMPALA_HIVE_VERSION}") - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CMAKE_SYSTEM_PROCESSOR}") - if (${CPACK_GENERATOR} MATCHES "RPM") - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.el${OS_DISTRIB_VERSION_ID}") - elseif (${CPACK_GENERATOR} MATCHES "DEB") - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.ubuntu-${OS_DISTRIB_VERSION_ID}") - endif() - message(STATUS "Package name: ${CPACK_PACKAGE_FILE_NAME}") - - if ($ENV{STRIP_DEPLOYMENT_IMPALAD}) - set(CPACK_STRIP_FILES ${IMPALA_INSTALLDIR}/bin/impalad) - message("Binaries in the package will be stripped") - endif() - - set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "impala") - - execute_process( - COMMAND bash -c "${CMAKE_SOURCE_DIR}/docker/install_os_packages.sh --dry-run | tail -n1" - OUTPUT_VARIABLE PKG_LIST - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if ("${PKG_LIST}" STREQUAL "") - message(FATAL_ERROR "Package list is empty: '${PKG_LIST}'") - else() - message(STATUS "Get required package list: '${PKG_LIST}'") - endif() - - if (${CPACK_GENERATOR} MATCHES "RPM") - set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) - set(CPACK_RPM_PACKAGE_REQUIRES ${PKG_LIST}) - else() - set(CPACK_DEBIAN_PACKAGE_DEPENDS ${PKG_LIST}) - endif() - endif() - -include(CPack) - -endif() diff --git a/NOTICE.txt b/NOTICE.txt index e4bd7b3ad..4c8ed2875 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Impala -Copyright 2019 The Apache Software Foundation +Copyright 2024 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt new file mode 100644 index 000000000..5c46a18d3 --- /dev/null +++ b/package/CMakeLists.txt @@ -0,0 +1,136 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +project(Impala_packaging) + +cmake_host_system_information(RESULT OS_DISTRIB_ID QUERY DISTRIB_ID) +cmake_host_system_information(RESULT OS_DISTRIB_VERSION_ID QUERY DISTRIB_VERSION_ID) +message(STATUS "DISTRIB_ID: ${OS_DISTRIB_ID}") +message(STATUS "DISTRIB_VERSION_ID: ${OS_DISTRIB_VERSION_ID}") + +install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.txt DESTINATION ${IMPALA_INSTALLDIR} RENAME LICENSE) +install(FILES ${CMAKE_SOURCE_DIR}/NOTICE.txt DESTINATION ${IMPALA_INSTALLDIR} RENAME NOTICE) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/www/" DESTINATION ${IMPALA_INSTALLDIR}/www) +install(FILES ${CMAKE_SOURCE_DIR}/fe/target/impala-frontend-$ENV{IMPALA_VERSION}.jar + DESTINATION ${IMPALA_INSTALLDIR}/lib/jars) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/fe/target/dependency/ + DESTINATION ${IMPALA_INSTALLDIR}/lib/jars + FILES_MATCHING PATTERN "*.jar") + +set(IMPALA_GCC_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/gcc-$ENV{IMPALA_GCC_VERSION}) +FILE(GLOB gcc_lib ${IMPALA_GCC_HOME}/lib64/libgcc_s.so.1*) +if("${gcc_lib}" STREQUAL "") + message(FATAL_ERROR "libgcc_s.so.1 was not found in '${IMPALA_GCC_HOME}/lib64'!") +endif() +install(FILES ${gcc_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) + +FILE(GLOB cpp_lib ${IMPALA_GCC_HOME}/lib64/libstdc++.so.6*) +if("${cpp_lib}" STREQUAL "") + message(FATAL_ERROR "libstdc++.so.6 was not found in '${IMPALA_GCC_HOME}/lib64'!") +endif() +install(FILES ${cpp_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) + +set(KUDU_HOME $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/kudu-$ENV{IMPALA_KUDU_VERSION}/release) +# The parent folder is lib64 on centos/redhat, while on ubuntu it's lib. +FILE(GLOB kudu_lib ${KUDU_HOME}/lib*/libkudu_client.so*) +if("${kudu_lib}" STREQUAL "") + message(FATAL_ERROR "libkudu_client.so was not found in '${KUDU_HOME}/lib'!") +endif() +install(FILES ${kudu_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) + +FILE(GLOB hadoop_lib $ENV{HADOOP_LIB_DIR}/native/libhadoop.so*) +if("${hadoop_lib}" STREQUAL "") + message(FATAL_ERROR "libhadoop.so was not found in '$ENV{HADOOP_LIB_DIR}/native'!") +endif() +install(FILES ${hadoop_lib} DESTINATION ${IMPALA_INSTALLDIR}/lib/native) + +string(TOLOWER ${OS_DISTRIB_ID} OS_DISTRIB_ID) +if (${OS_DISTRIB_ID} STREQUAL "rhel" AND ${OS_DISTRIB_VERSION_ID} VERSION_GREATER_EQUAL 8) + # TODO: remove this after resolving IMPALA-12255 + message(STATUS "Not packaging impala-shell on redhat8+ due to ambiguous python shebang") +else() + install(DIRECTORY ${CMAKE_SOURCE_DIR}/shell/build/impala-shell-$ENV{IMPALA_VERSION}/ + DESTINATION ${IMPALA_INSTALLDIR}/shell + USE_SOURCE_PERMISSIONS PATTERN "*.pyc" EXCLUDE) +endif() + +install(DIRECTORY bin/ DESTINATION ${IMPALA_INSTALLDIR}/bin + USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*.sh") +install(DIRECTORY conf/ DESTINATION ${IMPALA_INSTALLDIR}/conf) + +# packaging +option(BUILD_PACKAGES "Build deployment packages") +if (NOT BUILD_PACKAGES) + return() +endif() + +if (${OS_DISTRIB_ID} MATCHES "(rhel|centos)") + set(CPACK_GENERATOR "RPM") +elseif (${OS_DISTRIB_ID} MATCHES "ubuntu") + set(CPACK_GENERATOR "DEB") +else() + message(FATAL_ERROR "OS is ${OS_DISTRIB_ID}. No packages will be generated.") +endif() + +message(STATUS "Packaging enabled: ${CPACK_GENERATOR}") +set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) +set(CPACK_PACKAGE_VENDOR "Apache") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An open source massively parallel processing SQL query engine.") +set(CPACK_PACKAGE_CONTACT "d...@impala.apache.org") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://impala.apache.org") +set(CPACK_PACKAGE_VERSION "$ENV{IMPALA_VERSION}") +set(CPACK_RPM_PACKAGE_LICENSE "ASL-2.0") +set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build) +# Set a meaningful package name, e.g. apache-impala-4.4.0_hive-3.1.3-x86_64.el7 +set(CPACK_PACKAGE_FILE_NAME "apache-impala-${CPACK_PACKAGE_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_hive-$ENV{IMPALA_HIVE_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CMAKE_SYSTEM_PROCESSOR}") +if (${CPACK_GENERATOR} MATCHES "RPM") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.el${OS_DISTRIB_VERSION_ID}") +elseif (${CPACK_GENERATOR} MATCHES "DEB") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.ubuntu-${OS_DISTRIB_VERSION_ID}") +endif() +message(STATUS "Package name: ${CPACK_PACKAGE_FILE_NAME}") + +if ($ENV{STRIP_DEPLOYMENT_IMPALAD}) + set(CPACK_STRIP_FILES ${IMPALA_INSTALLDIR}/sbin/impalad) + message("Binaries in the package will be stripped") +endif() + +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "impala") + +execute_process( + COMMAND bash -c "${CMAKE_SOURCE_DIR}/docker/install_os_packages.sh --dry-run | tail -n1" + OUTPUT_VARIABLE PKG_LIST + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if ("${PKG_LIST}" STREQUAL "") + message(FATAL_ERROR "Package list is empty: '${PKG_LIST}'") +else() + message(STATUS "Get required package list: '${PKG_LIST}'") +endif() + +if (${CPACK_GENERATOR} MATCHES "RPM") + set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) + set(CPACK_RPM_PACKAGE_REQUIRES ${PKG_LIST}) +else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS ${PKG_LIST}) +endif() + +include(CPack)