From 09f5df182cb394806aac0744bdcb7ee626abe1fe Mon Sep 17 00:00:00 2001 From: "aleksei.bukhalov" Date: Fri, 4 Jul 2025 14:36:10 +0200 Subject: [PATCH] review fixes --- .drone.jsonnet | 4 ++-- build/bootstrap_mcs.sh | 12 ++++++------ build/build_cmapi.sh | 24 ++++++++++-------------- build/prepare_test_container.sh | 4 +++- build/report_test_stage.sh | 4 +++- build/run_mtr.sh | 3 ++- build/run_multi_node_mtr.sh | 3 ++- build/utils.sh | 10 ++++++++++ 8 files changed, 38 insertions(+), 26 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 5a3edb040..56a269b5b 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -481,7 +481,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", 'bash -c "set -o pipefail && bash /mdb/' + builddir + "/storage/columnstore/columnstore/build/bootstrap_mcs.sh " + "--build-type RelWithDebInfo " + "--distro " + platform + " " + - "--build-packages --install-deps --sccache --sccache-arch " + arch + + "--build-packages --install-deps --sccache" + " " + customBootstrapParams + " " + customBootstrapParamsForExisitingPipelines(platform) + " | " + "/mdb/" + builddir + "/storage/columnstore/columnstore/build/ansi2txt.sh " + @@ -497,7 +497,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", DEBIAN_FRONTEND: "noninteractive", }, commands: [ - "bash /mdb/" + builddir + "/storage/columnstore/columnstore/build/build_cmapi.sh --distro " + platform + " --arch " + arch, + "bash /mdb/" + builddir + "/storage/columnstore/columnstore/build/build_cmapi.sh --distro " + platform, ], }, { diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 856f5e57f..eed9873c8 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -76,11 +76,11 @@ if [[ ! " ${DISTRO_OPTIONS[*]} " =~ " ${OS} " ]]; then detect_distro fi -if [[ "$OS" == *"rocky"* ]]; then - pkg_format="rpm" +select_pkg_format ${OS} + +if [[ "$PKG_FORMAT" == "rpm" ]]; then CTEST_BIN_NAME=:"ctest3" else - pkg_format="deb" CTEST_BIN_NAME="ctest" fi @@ -277,7 +277,7 @@ modify_packaging() { echo "Modifying_packaging..." cd $MDB_SOURCE_PATH - if [[ $pkg_format == "deb" ]]; then + if [[ $PKG_FORMAT == "deb" ]]; then sed -i 's|.*-d storage/columnstore.*|elif [[ -d storage/columnstore/columnstore/debian ]]|' debian/autobake-deb.sh fi @@ -289,7 +289,7 @@ modify_packaging() { grep mariadb /usr/share/lto-disabled-list/lto-disabled-list fi - if [[ $pkg_format == "deb" ]]; then + if [[ $PKG_FORMAT == "deb" ]]; then apt-cache madison liburing-dev | grep liburing-dev || { sed 's/liburing-dev/libaio-dev/g' -i debian/control && sed '/-DIGNORE_AIO_CHECK=YES/d' -i debian/rules && @@ -498,7 +498,7 @@ generate_svgs() { build_package() { cd $MDB_SOURCE_PATH - if [[ $pkg_format == "rpm" ]]; then + if [[ $PKG_FORMAT == "rpm" ]]; then command="cmake ${MDB_CMAKE_FLAGS[@]} && make -j\$(nproc) package" else export DEBIAN_FRONTEND="noninteractive" diff --git a/build/build_cmapi.sh b/build/build_cmapi.sh index 241b3fc35..84c6ca5b0 100755 --- a/build/build_cmapi.sh +++ b/build/build_cmapi.sh @@ -13,7 +13,6 @@ MDB_SOURCE_PATH=$(realpath "$SCRIPT_LOCATION"/../../../..) source "$SCRIPT_LOCATION"/utils.sh optparse.define short=d long=distro desc="distro" variable=OS -optparse.define short=a long=arch desc="architecture" variable=ARCH source $(optparse.build) echo "Arguments received: $@" @@ -22,18 +21,15 @@ if [ "$EUID" -ne 0 ]; then exit 1 fi -if [[ -z "${OS:-}" || -z "${ARCH:-}" ]]; then - echo "Please provide provide --distro and --arch parameters, e.g. ./build_cmapi.sh --distro ubuntu:22.04 --arch amd64" +if [[ -z "${OS:-}" ]]; then + echo "Please provide provide --distro parameter, e.g. ./build_cmapi.sh --distro ubuntu:22.04" exit 1 fi -pkg_format="deb" -if [[ "$OS" == *"rocky"* ]]; then - pkg_format="rpm" -fi +select_pkg_format ${OS} -if [[ "$ARCH" == "arm64" ]]; then - export CC=gcc #TODO: what it is for? +if [[ "$(arch)" == "arm64" ]]; then + export CC=gcc fi on_exit() { @@ -55,18 +51,18 @@ install_deps() { retry_eval 5 "dnf config-manager --set-enabled devel && dnf update -q -y" #to make redhat-lsb-core available for rocky 9 fi - if [[ "$pkg_format" == "rpm" ]]; then + if [[ "$PKG_FORMAT" == "rpm" ]]; then retry_eval 5 "dnf update -q -y && dnf install -q -y epel-release wget zstd findutils gcc cmake make rpm-build redhat-lsb-core libarchive" else retry_eval 5 "apt-get update -qq -o Dpkg::Use-Pty=0 && apt-get install -qq -o Dpkg::Use-Pty=0 wget zstd findutils gcc cmake make dpkg-dev lsb-release" fi - if [ "$ARCH" == "amd64" ]; then + if [ "$(arch)" == "x86_64" ]; then PYTHON_URL="https://github.com/indygreg/python-build-standalone/releases/download/20220802/cpython-3.9.13+20220802-x86_64_v2-unknown-linux-gnu-pgo+lto-full.tar.zst" - elif [ "$ARCH" == "arm64" ]; then + elif [ "$(arch)" == "arm64" ]; then PYTHON_URL="https://github.com/indygreg/python-build-standalone/releases/download/20220802/cpython-3.9.13+20220802-aarch64-unknown-linux-gnu-noopt-full.tar.zst" else - echo "Unsupported architecture: $ARCH" + echo "Unsupported architecture: $(arch)" exit 1 fi @@ -84,7 +80,7 @@ install_deps() { build_cmapi() { cd "$COLUMNSTORE_SOURCE_PATH"/cmapi ./cleanup.sh - cmake -D"${pkg_format^^}"=1 -DSERVER_DIR="$MDB_SOURCE_PATH" . && make package + cmake -D"${PKG_FORMAT^^}"=1 -DSERVER_DIR="$MDB_SOURCE_PATH" . && make package } install_deps build_cmapi diff --git a/build/prepare_test_container.sh b/build/prepare_test_container.sh index 8253215cc..e43978973 100755 --- a/build/prepare_test_container.sh +++ b/build/prepare_test_container.sh @@ -27,8 +27,10 @@ if [[ -z "${CONTAINER_NAME:-}" || -z "${DOCKER_IMAGE:-}" || -z "${RESULT:-}" || exit 1 fi +select_pkg_format ${RESULT} + start_container() { - if [[ "$RESULT" == *rocky* ]]; then + if [[ $PKG_FORMAT == "rpm" ]]; then SYSTEMD_PATH="/usr/lib/systemd/systemd" MTR_PATH="/usr/share/mysql-test" else diff --git a/build/report_test_stage.sh b/build/report_test_stage.sh index 15d2e6732..cea115616 100755 --- a/build/report_test_stage.sh +++ b/build/report_test_stage.sh @@ -39,7 +39,9 @@ if [[ -z $(docker ps -q --filter "name=${CONTAINER_NAME}") ]]; then exit 1 fi -if [[ "$RESULT" == *rocky* ]]; then +select_pkg_format ${RESULT} + +if [[ "$PKG_FORMAT" == "rpm" ]]; then SYSTEMD_PATH="/usr/lib/systemd/systemd" MTR_PATH="/usr/share/mysql-test" else diff --git a/build/run_mtr.sh b/build/run_mtr.sh index dd7271325..d2f664b34 100755 --- a/build/run_mtr.sh +++ b/build/run_mtr.sh @@ -39,8 +39,9 @@ collect_logs() { } trap collect_logs EXIT +select_pkg_format ${RESULT} -if [[ "$DISTRO" == *rocky* ]]; then +if [[ "$PKG_FORMAT" == "rpm" ]]; then SOCKET_PATH="/var/lib/mysql/mysql.sock" MTR_PATH="/usr/share/mysql-test" else diff --git a/build/run_multi_node_mtr.sh b/build/run_multi_node_mtr.sh index a8404f1d8..19829bd92 100755 --- a/build/run_multi_node_mtr.sh +++ b/build/run_multi_node_mtr.sh @@ -23,8 +23,9 @@ for flag in MCS_IMAGE_NAME DISTRO; do fi done +select_pkg_format ${DISTRO} -if [[ "$DISTRO" == *rocky* ]]; then +if [[ "$PKG_FORMAT" == "rpm" ]]; then SOCKET_PATH="/var/lib/mysql/mysql.sock" MTR_PATH="/usr/share/mysql-test" else diff --git a/build/utils.sh b/build/utils.sh index 42ee52077..f41dcd895 100644 --- a/build/utils.sh +++ b/build/utils.sh @@ -171,6 +171,16 @@ detect_distro() { message "Detected $color_yellow$OS $OS_VERSION$color_normal" } +select_pkg_format() { + local distro="$1" + + if [[ "$distro" == *rocky* ]]; then + export PKG_FORMAT="rpm" + else + export PKG_FORMAT="deb" + fi +} + menuStr="" function hideCursor() {