From d7031e5e09a5c5e719fc6308354da9753c15fff6 Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:46:56 +0800 Subject: [PATCH] package nebula graph according to environment variables (#2603) * Support yueshu package in workflow * Fix bug * Add release job for yueshu package * fix company name * restore preinst * restore * Update preinst Modify the Chinese part of the variable name * Update CMakeLists.txt Add variable name PROD_NAME_CN * Update preinst fix format --------- Co-authored-by: George <58841610+Shinji-IkariG@users.noreply.github.com> Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> --- .github/workflows/release.yml | 5 +- CMakeLists.txt | 8 +- cmake/CPackage.cmake | 6 +- package/CMakeLists.txt | 35 ++++++++ package/package.sh | 3 +- package/preinst | 162 ++++++++++++++++------------------ 6 files changed, 118 insertions(+), 101 deletions(-) create mode 100644 package/CMakeLists.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59afff12424..c18c0ce4f71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,14 +32,13 @@ jobs: -k ${{ secrets.OSS_SECRET }} \ -e ${{ secrets.OSS_ENDPOINT }} \ oss://nebula-graph-ent/general/nebula-graph/rc/${{ steps.tag.outputs.tagnum }}/ \ - oss://nebula-graph-ent/general/nebula-graph/${{ steps.tag.outputs.tagnum }} + oss://nebula-graph-ent/general/nebula-graph/${{ steps.tag.outputs.tagnum }} ossutil64 cp -rf \ -i ${{ secrets.OSS_ID }} \ -k ${{ secrets.OSS_SECRET }} \ -e ${{ secrets.OSS_ENDPOINT }} \ oss://nebula-graph-ent/general/nebula-graph/rc/${{ steps.tag.outputs.tagnum }}/symbols \ - oss://nebula-graph-ent/general/nebula-graph/${{ steps.tag.outputs.tagnum }} - + oss://nebula-graph-ent/general/nebula-graph/${{ steps.tag.outputs.tagnum }} docker_build: name: docker-build diff --git a/CMakeLists.txt b/CMakeLists.txt index 89ad187db5e..ef9bbd44486 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,11 +112,5 @@ nebula_add_subdirectory(src) nebula_add_subdirectory(conf) nebula_add_subdirectory(resources) nebula_add_subdirectory(scripts) +nebula_add_subdirectory(package) -include(CPackage) -package( - ${ENABLE_PACK_ONE} - "nebula-graph-ent" - "https://github.com/vesoft-inc/nebula/releases" - ${CMAKE_SOURCE_DIR}/package -) diff --git a/cmake/CPackage.cmake b/cmake/CPackage.cmake index 2a6f6c70e63..6b66330972c 100644 --- a/cmake/CPackage.cmake +++ b/cmake/CPackage.cmake @@ -145,10 +145,12 @@ macro(package to_one name home_page scripts_dir) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR}) set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${home_page}) + set(PREINST_PATH ${CMAKE_BINARY_DIR}/package/preinst) + if(ENABLE_EULA) set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${scripts_dir}/postinst) else() - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${scripts_dir}/preinst ${scripts_dir}/postinst) + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${PREINST_PATH} ${scripts_dir}/postinst) endif() set(CPACK_RPM_SPEC_MORE_DEFINE "%define debug_package %{nil} @@ -158,7 +160,7 @@ macro(package to_one name home_page scripts_dir) set(CPACK_RPM_PACKAGE_URL ${home_page}) set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${scripts_dir}/rpm_postinst) if(ENABLE_EULA) - set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${scripts_dir}/preinst) + set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${PREINST_PATH}) endif() set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/local) set(CPACK_RPM_PACKAGE_RELOCATABLE ON) diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt new file mode 100644 index 00000000000..0e9c3fe9380 --- /dev/null +++ b/package/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (c) 2023 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +macro(env_or_default name default_val) + if ("$ENV{${name}}" STREQUAL "") + set(${name} ${default_val}) + else() + set(${name} $ENV{${name}}) + endif() + message(STATUS "${name}: ${${name}}") +endmacro() + +env_or_default(COMPANY "vesoft") +env_or_default(COMPANY_CN "杭州欧若数网科技有限公司") +env_or_default(PROD_NAME "NebulaGraph") +env_or_default(PROD_NAME_CN "NebulaGraph") +env_or_default(PKG_NAME "nebula-graph-ent") +env_or_default(RELEASE_URL "https://github.com/vesoft-inc/nebula-ent/releases") +env_or_default(DOC_URL "https://docs.nebula-graph.io") +env_or_default(PROD_URL "https://nebula-graph.io") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/preinst + ${CMAKE_CURRENT_BINARY_DIR}/preinst +) + +include(CPackage) + +package( + ${ENABLE_PACK_ONE} + ${PKG_NAME} + ${RELEASE_URL} + ${CMAKE_SOURCE_DIR}/package +) diff --git a/package/package.sh b/package/package.sh index 251aee8c126..0bef1eb76b5 100755 --- a/package/package.sh +++ b/package/package.sh @@ -46,7 +46,6 @@ function _default_release_variables { enable_breakpad="ON" add_EULA="ON" enable_standalone="OFF" - } # change default variables. e.g. build release in docker @@ -209,7 +208,7 @@ function package { # rename package file outputDir=$build_dir/cpack_output mkdir -p ${outputDir} - for pkg_name in $(ls ./*nebula*-${version}*); do + for pkg_name in $(ls ./*graph*-${version}*); do mv ${pkg_name} ${outputDir}/ echo "####### target package file is ${outputDir}/${pkg_name}" done diff --git a/package/preinst b/package/preinst index 205d56cf523..bce129b911e 100755 --- a/package/preinst +++ b/package/preinst @@ -9,23 +9,23 @@ if command -v "more" > /dev/null 2>&1; then fi "$pager" <