From 83c293303989e15c5db0d359b96372dcade0472f Mon Sep 17 00:00:00 2001 From: Leonid Fedorov Date: Wed, 3 Sep 2025 18:12:42 +0000 Subject: [PATCH] fix(ci): do not build debuginfo packages for RPMS, as it cost 40min of packaging time --- build/bootstrap_mcs.sh | 21 ++++++++++++++++++--- cmake/cpack_manage.cmake | 27 ++++++++++++++++++++++++--- cmake/cpack_overrides.cmake | 31 +++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 cmake/cpack_overrides.cmake diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 65a0d98b5..f6fb95ae0 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -442,7 +442,15 @@ construct_cmake_flags() { if [[ $SCCACHE = true ]]; then warn "Use sccache" - MDB_CMAKE_FLAGS+=(-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache) + # Use full path to ensure sccache is found during RPM builds + MDB_CMAKE_FLAGS+=(-DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/sccache -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/sccache) + + message "Sccache binary check:" + ls -la /usr/local/bin/sccache || warn "sccache binary not found" + /usr/local/bin/sccache --version || warn "sccache version failed" + + message "Starting sccache server:" + /usr/local/bin/sccache --start-server 2>&1 || warn "Failed to start sccache server" fi if [[ $RUN_BENCHMARKS = true ]]; then @@ -531,7 +539,13 @@ build_package() { cd $MDB_SOURCE_PATH if [[ $PKG_FORMAT == "rpm" ]]; then - command="cmake ${MDB_CMAKE_FLAGS[@]} && make -j\$(nproc) package" + message "Configuring cmake for RPM package" + MDB_CMAKE_FLAGS+=(-DCPACK_PACKAGE_DIRECTORY=$MARIA_BUILD_PATH/..) + + cmake "${MDB_CMAKE_FLAGS[@]}" -S"$MDB_SOURCE_PATH" -B"$MARIA_BUILD_PATH" + check_errorcode + message "Building RPM package" + command="cmake --build \"$MARIA_BUILD_PATH\" -j$(nproc) --target package" else export DEBIAN_FRONTEND="noninteractive" export DEB_BUILD_OPTIONS="parallel=$(nproc)" @@ -827,7 +841,8 @@ if [[ $BUILD_PACKAGES = true ]]; then exit_code=$? if [[ $SCCACHE = true ]]; then - sccache --show-adv-stats + message "Final sccache statistics:" + /usr/local/bin/sccache --show-adv-stats fi exit $exit_code diff --git a/cmake/cpack_manage.cmake b/cmake/cpack_manage.cmake index e463db9cf..ee51c011a 100644 --- a/cmake/cpack_manage.cmake +++ b/cmake/cpack_manage.cmake @@ -28,6 +28,27 @@ macro(columnstore_add_rpm_deps) columnstore_append_for_cpack(CPACK_RPM_columnstore-engine_PACKAGE_REQUIRES ${ARGN}) endmacro() -if(RPM) - columnstore_add_rpm_deps("snappy" "jemalloc" "procps-ng" "gawk") -endif() +# Columnstore-specific RPM packaging overrides 1) Use fast compression to speed up packaging +set(CPACK_RPM_COMPRESSION_TYPE + "zstd" + CACHE STRING "RPM payload compression" FORCE +) +# 2) Disable debuginfo/debugsource to avoid slow packaging and duplicate file warnings +set(CPACK_RPM_DEBUGINFO_PACKAGE + OFF + CACHE BOOL "Disable debuginfo package" FORCE +) +set(CPACK_RPM_PACKAGE_DEBUG + 0 + CACHE STRING "Disable RPM debug package" FORCE +) +unset(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX CACHE) + +# Ensure our overrides are applied by CPack at packaging time CPACK_PROJECT_CONFIG_FILE is included by cpack after +# CPackConfig.cmake is loaded +set(CPACK_PROJECT_CONFIG_FILE + "${CMAKE_CURRENT_LIST_DIR}/cpack_overrides.cmake" + CACHE FILEPATH "Columnstore CPack overrides" FORCE +) + +columnstore_add_rpm_deps("snappy" "jemalloc" "procps-ng" "gawk") diff --git a/cmake/cpack_overrides.cmake b/cmake/cpack_overrides.cmake new file mode 100644 index 000000000..fcc92e09b --- /dev/null +++ b/cmake/cpack_overrides.cmake @@ -0,0 +1,31 @@ +# Columnstore-specific CPack overrides applied at package time +# This file is referenced via CPACK_PROJECT_CONFIG_FILE and is included by CPack +# after it reads the generated CPackConfig.cmake, letting these settings win. + +# Faster payload compression +set(CPACK_RPM_COMPRESSION_TYPE "zstd") + +# Control debuginfo generation (symbols) without debugsource (sources) +option(CS_RPM_DEBUGINFO "Build Columnstore -debuginfo RPM (symbols only)" OFF) + +if(CS_RPM_DEBUGINFO) + # Generate debuginfo RPM (symbols) + set(CPACK_RPM_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_PACKAGE_DEBUG 1) +else() + # No debuginfo RPM + set(CPACK_RPM_DEBUGINFO_PACKAGE OFF) + set(CPACK_RPM_PACKAGE_DEBUG 0) + set(CPACK_STRIP_FILES OFF) + # Prevent rpmbuild from stripping binaries and running debug post scripts. + # CPACK_STRIP_FILES only affects CPack's own stripping; rpmbuild still + # executes brp-strip and find-debuginfo by default unless we override macros. + if(DEFINED CPACK_RPM_SPEC_MORE_DEFINE) + set(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define __strip /bin/true\n%define __objdump /bin/true\n%define __os_install_post %nil\n%define __debug_install_post %nil") + else() + set(CPACK_RPM_SPEC_MORE_DEFINE "%define __strip /bin/true\n%define __objdump /bin/true\n%define __os_install_post %nil\n%define __debug_install_post %nil") + endif() +endif() + +# Always disable debugsource by not mapping sources +unset(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX)