diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 6f9e33292..ce40b8d4c 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -23,7 +23,7 @@ COLUMSNTORE_SOURCE_PATH=$(realpath "$SCRIPT_LOCATION"/../) DEFAULT_MARIA_BUILD_PATH=$(realpath "$MDB_SOURCE_PATH"/../BuildOf_$(basename "$MDB_SOURCE_PATH")) BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo") -DISTRO_OPTIONS=("ubuntu:20.04" "ubuntu:22.04" "ubuntu:24.04" "debian:11" "debian:12" "rockylinux:8" "rockylinux:9") +DISTRO_OPTIONS=("ubuntu:20.04" "ubuntu:22.04" "ubuntu:24.04" "debian:11" "debian:12" "rockylinux:8" "rockylinux:9" "rocky:10") GCC_VERSION="11" MDB_CMAKE_FLAGS=() @@ -123,7 +123,7 @@ install_deps() { libjemalloc-dev liblz-dev liblzo2-dev liblzma-dev liblz4-dev libbz2-dev libbenchmark-dev libdistro-info-perl \ graphviz devscripts ccache equivs eatmydata curl python3" - if [[ "$OS" == *"rockylinux:8"* || "$OS" == *"rocky:8"* ]]; then + if is_rocky_version $OS 8; then command="dnf install -y curl 'dnf-command(config-manager)' && dnf config-manager --set-enabled powertools && \ dnf install -y libarchive cmake ${RPM_BUILD_DEPS}" if [[ $GCC_TOOLSET = false ]]; then @@ -131,9 +131,8 @@ install_deps() { else command="$command && dnf install -y gcc-toolset-${GCC_VERSION} && . /opt/rh/gcc-toolset-${GCC_VERSION}/enable" fi - elif - [[ "$OS" == "rockylinux:9"* || "$OS" == "rocky:9"* ]] - then + + elif is_rocky_version_ge $OS 9; then command="dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb && \ dnf install -y pcre2-devel gcc gcc-c++ curl-minimal ${RPM_BUILD_DEPS}" diff --git a/build/build_cmapi.sh b/build/build_cmapi.sh index da0e64d94..01d3d55d2 100755 --- a/build/build_cmapi.sh +++ b/build/build_cmapi.sh @@ -46,13 +46,23 @@ install_deps() { cd "$COLUMNSTORE_SOURCE_PATH"/cmapi - if [[ "$OS" == "rockylinux:9" ]]; then + if is_rocky_version $OS 9; then retry_eval 5 "dnf install -q -y libxcrypt-compat yum-utils" retry_eval 5 "dnf config-manager --set-enabled devel && dnf update -q -y" #to make redhat-lsb-core available for rocky 9 fi + #no redhat-lsb-release for rockylinux >=10 + if ! is_rocky_version_ge $OS 10; then + retry_eval 5 "dnf update -q -y && dnf install -q -y redhat-lsb-core" + fi + + + if is_rocky_version_ge $OS 10; then + retry_eval 5 "dnf update -q -y && dnf install -q -y libxcrypt-compat" + fi + 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" + retry_eval 5 "dnf update -q -y && dnf install -q -y epel-release wget zstd findutils gcc cmake make rpm-build 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 diff --git a/build/utils.sh b/build/utils.sh index e90eb522c..c722584e1 100644 --- a/build/utils.sh +++ b/build/utils.sh @@ -604,3 +604,58 @@ change_ubuntu_mirror_in_docker() { execInnerDocker "$container_name" "$docker_funcs; change_ubuntu_mirror ${region}" } + +is_rocky_version() { + local image="$1" + local version="$2" + + if [[ -z "$image" ]]; then + echo "Usage: is_rocky_version [version]" + return 1 + fi + + if [[ "$image" == *"rockylinux"* || "$image" == *"rocky"* ]]; then + if [[ -n "$version" ]]; then + if [[ "$image" == *":$version"* ]]; then + return 0 # matches Rocky Linux with version + else + return 1 # Rocky Linux but wrong version + fi + else + return 0 # matches Rocky Linux, any version + fi + fi + + return 1 # not Rocky Linux +} + +is_rocky_version_ge() { + local image="$1" + local min_version="$2" + + if [[ -z "$image" || -z "$min_version" ]]; then + echo "Usage: is_rocky_version_ge " + return 1 + fi + + # First check if it's Rocky Linux at all + if ! is_rocky_version "$image"; then + return 1 + fi + + # Extract the version from the tag (after colon) + local tag="${image##*:}" + if [[ "$tag" == "$image" ]]; then + return 1 # no tag -> cannot compare + fi + + # Major version (before dot if any) + local major="${tag%%.*}" + + if [[ "$major" =~ ^[0-9]+$ && "$min_version" =~ ^[0-9]+$ ]]; then + ((major >= min_version)) + return $? + fi + + return 1 +}