From f88fffe2e81e1cfa8a4b01c298300e9d888086e0 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnychenko Date: Tue, 17 Feb 2026 11:41:40 +0200 Subject: [PATCH 1/5] PSMDB-1946 psmdb83: update build script for 8.3 --- percona-packaging/scripts/psmdb_builder.sh | 1083 ++++++++++++-------- 1 file changed, 669 insertions(+), 414 deletions(-) diff --git a/percona-packaging/scripts/psmdb_builder.sh b/percona-packaging/scripts/psmdb_builder.sh index a5addf59c19ec..80fe5b4a12309 100755 --- a/percona-packaging/scripts/psmdb_builder.sh +++ b/percona-packaging/scripts/psmdb_builder.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash shell_quote_string() { - echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' + echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' } -usage() { +usage () { cat <&2 "Current directory cannot be used for building!" exit 1 else - if ! test -d "$WORKDIR"; then + if ! test -d "$WORKDIR" + then echo >&2 "$WORKDIR is not a directory." exit 1 fi @@ -83,34 +87,31 @@ check_workdir() { return } -add_percona_yum_repo() { - if [ ! -f /etc/yum.repos.d/percona-dev.repo ]; then - wget http://jenkins.percona.com/yum-repo/percona-dev.repo - mv -f percona-dev.repo /etc/yum.repos.d/ - fi - return -} - -get_sources() { +get_sources(){ cd "${WORKDIR}" - if [ "${SOURCE}" = 0 ]; then + if [ "${SOURCE}" = 0 ] + then echo "Sources will not be downloaded" return 0 fi PRODUCT=percona-server-mongodb - echo "PRODUCT=${PRODUCT}" >percona-server-mongodb-50.properties - echo "PSM_BRANCH=${PSM_BRANCH}" >>percona-server-mongodb-50.properties - echo "JEMALLOC_TAG=${JEMALLOC_TAG}" >>percona-server-mongodb-50.properties - echo "BUILD_NUMBER=${BUILD_NUMBER}" >>percona-server-mongodb-50.properties - echo "BUILD_ID=${BUILD_ID}" >>percona-server-mongodb-50.properties + JEMALLOC_TAG=psmdb-3.2.11-3.1 + + echo "PRODUCT=${PRODUCT}" > percona-server-mongodb-83.properties + echo "PSM_BRANCH=${PSM_BRANCH}" >> percona-server-mongodb-83.properties + echo "JEMALLOC_TAG=${JEMALLOC_TAG}" >> percona-server-mongodb-83.properties + echo "BUILD_NUMBER=${BUILD_NUMBER}" >> percona-server-mongodb-83.properties + echo "BUILD_ID=${BUILD_ID}" >> percona-server-mongodb-83.properties git clone "$REPO" retval=$? - if [ $retval != 0 ]; then + if [ $retval != 0 ] + then echo "There were some issues during repo cloning from github. Please retry one more time" exit 1 fi cd percona-server-mongodb - if [ ! -z "$BRANCH" ]; then + if [ ! -z "$BRANCH" ] + then git reset --hard git clean -xdf git checkout "$BRANCH" @@ -128,19 +129,20 @@ get_sources() { MONGO_TOOLS_TAG="r${PSM_VER}" fi - echo "{" >version.json - echo " \"version\": \"${PSM_VER}-${PSM_RELEASE}\"," >>version.json - echo " \"githash\": \"${REVISION_LONG}\"" >>version.json - echo "}" >>version.json + echo "{" > version.json + echo " \"version\": \"${PSM_VER}-${PSM_RELEASE}\"," >> version.json + echo " \"githash\": \"${REVISION_LONG}\"" >> version.json + echo "}" >> version.json # PRODUCT_FULL=${PRODUCT}-${PSM_VER}-${PSM_RELEASE} - echo "PRODUCT_FULL=${PRODUCT_FULL}" >>${WORKDIR}/percona-server-mongodb-50.properties - echo "VERSION=${PSM_VER}" >>${WORKDIR}/percona-server-mongodb-50.properties - echo "RELEASE=${PSM_RELEASE}" >>${WORKDIR}/percona-server-mongodb-50.properties - echo "MONGO_TOOLS_TAG=${MONGO_TOOLS_TAG}" >>${WORKDIR}/percona-server-mongodb-50.properties + echo "PRODUCT_FULL=${PRODUCT_FULL}" >> ${WORKDIR}/percona-server-mongodb-83.properties + echo "VERSION=${PSM_VER}" >> ${WORKDIR}/percona-server-mongodb-83.properties + echo "RELEASE=${PSM_RELEASE}" >> ${WORKDIR}/percona-server-mongodb-83.properties + echo "MONGO_TOOLS_TAG=${MONGO_TOOLS_TAG}" >> ${WORKDIR}/percona-server-mongodb-83.properties - echo "REVISION=${REVISION}" >>${WORKDIR}/percona-server-mongodb-50.properties + echo "REVISION=${REVISION}" >> ${WORKDIR}/percona-server-mongodb-83.properties + echo "REVISION_LONG=${REVISION_LONG}" >> ${WORKDIR}/percona-server-mongodb-83.properties rm -fr debian rpm cp -a percona-packaging/manpages . cp -a percona-packaging/docs/* . @@ -154,27 +156,43 @@ get_sources() { git checkout $MONGO_TOOLS_TAG sed -i 's|VersionStr="$(go run release/release.go get-version)"|VersionStr="$PSMDB_TOOLS_REVISION"|' set_goenv.sh sed -i 's|GitCommit="$(git rev-parse HEAD)"|GitCommit="$PSMDB_TOOLS_COMMIT_HASH"|' set_goenv.sh - echo "export PSMDB_TOOLS_COMMIT_HASH=\"$(git rev-parse HEAD)\"" >set_tools_revision.sh - echo "export PSMDB_TOOLS_REVISION=\"${PSM_VER}-${PSM_RELEASE}\"" >>set_tools_revision.sh + echo "export PSMDB_TOOLS_COMMIT_HASH=\"$(git rev-parse HEAD)\"" > set_tools_revision.sh + echo "export PSMDB_TOOLS_REVISION=\"${PSM_VER}-${PSM_RELEASE}\"" >> set_tools_revision.sh chmod +x set_tools_revision.sh + export GOROOT="/usr/local/go/" + export GOPATH=$PWD/../ + export PATH="/usr/local/go/bin:$PATH:$GOPATH" + export GOBINPATH="/usr/local/go/bin" + + # Dirty hack for mongo-tools 100.7.3 and aarch64 builds. Should fail once Mongo fixes OS detection https://jira.mongodb.org/browse/TOOLS-3318 + #if [ x"$ARCH" = "xaarch64" ]; then + sed -i '/GetLinuxDistroAndVersion()/ s/os, version, err = GetLinuxDistroAndVersion()/os, version, err = "rhel", "9.3", nil/' release/platform/platform.go || exit 1 + #fi + cd ${WORKDIR} - source percona-server-mongodb-50.properties + source percona-server-mongodb-83.properties # mv percona-server-mongodb ${PRODUCT}-${PSM_VER}-${PSM_RELEASE} + cd ${PRODUCT}-${PSM_VER}-${PSM_RELEASE} - git clone https://github.com/aws/aws-sdk-cpp.git - cd aws-sdk-cpp - git reset --hard - git clean -xdf - git checkout 1.9.379 - git submodule update --init --recursive - mkdir build + python3 buildscripts/install_bazel.py + export PATH=\/root/.local/bin:$PATH >> ~/.bashrc + source ~/.bashrc + sed -i 's:build-id:build-id=sha1:' SConstruct + + git clone https://github.com/aws/aws-sdk-cpp.git + cd aws-sdk-cpp + git reset --hard + git clean -xdf + git checkout 1.9.379 + git submodule update --init --recursive + mkdir build cd ../../ tar --owner=0 --group=0 --exclude=.* -czf ${PRODUCT}-${PSM_VER}-${PSM_RELEASE}.tar.gz ${PRODUCT}-${PSM_VER}-${PSM_RELEASE} - echo "UPLOAD=UPLOAD/experimental/BUILDS/${PRODUCT}-5.0/${PRODUCT}-${PSM_VER}-${PSM_RELEASE}/${PSM_BRANCH}/${REVISION}/${BUILD_ID}" >>percona-server-mongodb-50.properties - mkdir $WORKDIR/source_tarball - mkdir $CURDIR/source_tarball + echo "UPLOAD=UPLOAD/experimental/BUILDS/${PRODUCT}-8.3/${PRODUCT}-${PSM_VER}-${PSM_RELEASE}/${PSM_BRANCH}/${REVISION}/${BUILD_ID}" >> percona-server-mongodb-83.properties + mkdir -p $WORKDIR/source_tarball + mkdir -p $CURDIR/source_tarball cp ${PRODUCT}-${PSM_VER}-${PSM_RELEASE}.tar.gz $WORKDIR/source_tarball cp ${PRODUCT}-${PSM_VER}-${PSM_RELEASE}.tar.gz $CURDIR/source_tarball cd $CURDIR @@ -182,13 +200,19 @@ get_sources() { return } -get_system() { +get_system(){ if [ -f /etc/redhat-release ]; then GLIBC_VER_TMP="$(rpm glibc -qa --qf %{VERSION})" RHEL=$(rpm --eval %rhel) ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') OS_NAME="el$RHEL" OS="rpm" + elif [ -f /etc/amazon-linux-release ]; then + GLIBC_VER_TMP="$(rpm glibc -qa --qf %{VERSION})" + RHEL=$(rpm --eval %amzn) + ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') + OS_NAME="amzn$RHEL" + OS="rpm" else GLIBC_VER_TMP="$(dpkg-query -W -f='${Version}' libc6 | awk -F'-' '{print $1}')" ARCH=$(uname -m) @@ -196,20 +220,68 @@ get_system() { OS="deb" fi export GLIBC_VER=".glibc${GLIBC_VER_TMP}" + + local major="$(echo ${GLIBC_VER_TMP} | cut -d '.' -f 1)" + local minor="$(echo ${GLIBC_VER_TMP} | cut -d '.' -f 2)" + if [ "$major" -gt 2 ] || [ "$major" -eq 2 -a "$minor" -ge 34 ]; then + echo "${GLIBC_TUNABLES}" + export GLIBC_TUNABLES="glibc.pthread.rseq=0" + echo "glibc version is ${GLIBC_VER_TMP} >= 2.34, setting env variable GLIBC_TUNABLES=glibc.pthread.rseq=0" + fi + return } install_golang() { - wget https://golang.org/dl/go1.15.7.linux-amd64.tar.gz -O /tmp/golang1.15.tar.gz - tar --transform=s,go,go1.15, -zxf /tmp/golang1.15.tar.gz - rm -rf /usr/local/go1.15 /usr/local/go1.11 /usr/local/go1.8 /usr/local/go1.9 /usr/local/go1.9.2 /usr/local/go - mv go1.15 /usr/local/ - ln -s /usr/local/go1.15 /usr/local/go + if [ "$ARCH" = "x86_64" ]; then + GO_ARCH="amd64" + elif [ "$ARCH" = "aarch64" ]; then + GO_ARCH="arm64" + else + echo "Unsupported architecture: $ARCH" + return 1 + fi + + GO_VERSION="1.25.7" + GO_TAR="go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" + GO_SHA="${GO_TAR}.sha256" + GO_URL="https://downloads.percona.com/downloads/packaging/go/${GO_TAR}" + SHA_URL="https://downloads.percona.com/downloads/packaging/go/${GO_SHA}" + DL_PATH="/tmp/${GO_TAR}" + SHA_PATH="/tmp/${GO_SHA}" + + while :; do + #if wget --spider "$GO_URL" && wget --spider "$SHA_URL"; then + if wget --spider "$GO_URL"; then + wget -q "$GO_URL" -O "$DL_PATH" + break + #wget -q "$SHA_URL" -O "$SHA_PATH" + + #EXPECTED_SHA=$(awk '{print $1}' "$SHA_PATH") + #ACTUAL_SHA=$(sha256sum "$DL_PATH" | awk '{print $1}') + + #if [ "$EXPECTED_SHA" = "$ACTUAL_SHA" ]; then + # echo "SHA256 verification passed." + # break + #else + # echo "SHA256 verification failed! Retrying in 10 seconds..." + # rm -f "$DL_PATH" "$SHA_PATH" + #fi + else + echo "Go archive not available. Retrying in 10 seconds..." + fi + sleep 10 + done + + tar --transform=s,go,go${GO_VERSION}, -zxf "$DL_PATH" + rm -rf /usr/local/go* + mv go${GO_VERSION} /usr/local/ + ln -s /usr/local/go${GO_VERSION} /usr/local/go } -install_gcc_8_centos() { +install_gcc_centos(){ if [ "${RHEL}" -lt 8 ]; then - yum -y install gcc-c++ devtoolset-8-gcc-c++ devtoolset-8-binutils cmake3 python38 + yum -y install gcc-c++ devtoolset-8-gcc-c++ devtoolset-8-binutils cmake3 python38 source /opt/rh/devtoolset-8/enable else yum -y install binutils gcc gcc-c++ @@ -217,245 +289,222 @@ install_gcc_8_centos() { } -install_gcc_8_deb() { - if [ x"${DEBIAN}" = xxenial ]; then - wget https://jenkins.percona.com/downloads/gcc8/gcc-8.3.0_Ubuntu-xenial-x64.tar.gz -O /tmp/gcc-8.3.0_Ubuntu-xenial-x64.tar.gz - CUR_DIR=$PWD - cd /tmp - tar -zxf gcc-8.3.0_Ubuntu-xenial-x64.tar.gz - rm -rf /usr/local/gcc-8.3.0 - mv gcc-8.3.0 /usr/local/ - cd $CUR_DIR - fi - if [ x"${DEBIAN}" = xfocal -o x"${DEBIAN}" = xbionic -o x"${DEBIAN}" = xdisco -o x"${DEBIAN}" = xbuster ]; then +install_gcc_deb(){ + if [ x"${DEBIAN}" = xfocal -o x"${DEBIAN}" = xbionic -o x"${DEBIAN}" = xbuster ]; then apt-get -y install gcc-8 g++-8 fi - if [ x"${DEBIAN}" = xbullseye ]; then + if [ x"${DEBIAN}" = xbullseye -o x"${DEBIAN}" = xjammy ]; then apt-get -y install gcc-10 g++-10 fi - if [ x"${DEBIAN}" = xstretch ]; then - wget https://jenkins.percona.com/downloads/gcc8/gcc-8.3.0_Debian-stretch-x64.tar.gz -O /tmp/gcc-8.3.0_Debian-stretch-x64.tar.gz - tar -zxf /tmp/gcc-8.3.0_Debian-stretch-x64.tar.gz - rm -rf /usr/local/gcc-8.3.0 - mv gcc-8.3.0 /usr/local/ - fi } -set_compiler() { - if [ "x$OS" = "xdeb" ]; then - if [ x"${DEBIAN}" = xfocal -o x"${DEBIAN}" = xbionic -o x"${DEBIAN}" = xdisco -o x"${DEBIAN}" = xbuster ]; then - export CC=/usr/bin/gcc-8 - export CXX=/usr/bin/g++-8 - elif [ x"${DEBIAN}" = xbullseye ]; then - export CC=/usr/bin/gcc-10 - export CXX=/usr/bin/g++-10 - else - export CC=/usr/local/gcc-8.3.0/bin/gcc-8.3 - export CXX=/usr/local/gcc-8.3.0/bin/g++-8.3 - fi - else - if [ "x${RHEL}" == "x8" ]; then - export CC=/usr/bin/gcc - export CXX=/usr/bin/g++ - else - export CC=/opt/rh/devtoolset-8/root/usr/bin/gcc - export CXX=/opt/rh/devtoolset-8/root/usr/bin/g++ - fi +set_compiler(){ + if [ x"$RHEL" != x2023 ]; then + export CC=/opt/mongodbtoolchain/v4/bin/gcc + export CXX=/opt/mongodbtoolchain/v4/bin/g++ fi + return } -fix_rules() { - if [ x"${DEBIAN}" = xfocal -o x"${DEBIAN}" = xbionic -o x"${DEBIAN}" = xdisco -o x"${DEBIAN}" = xbuster ]; then - sed -i 's|CC = gcc-5|CC = /usr/bin/gcc-8|' debian/rules - sed -i 's|CXX = g++-5|CXX = /usr/bin/g++-8|' debian/rules - elif [ x"${DEBIAN}" = xbullseye ]; then - sed -i 's|CC = gcc-5|CC = /usr/bin/gcc-10|' debian/rules - sed -i 's|CXX = g++-5|CXX = /usr/bin/g++-10|' debian/rules - else - sed -i 's|CC = gcc-5|CC = /usr/local/gcc-8.3.0/bin/gcc-8.3|' debian/rules - sed -i 's|CXX = g++-5|CXX = /usr/local/gcc-8.3.0/bin/g++-8.3|' debian/rules - fi - sed -i 's:release:release --disable-warnings-as-errors :g' debian/rules +fix_rules(){ + sed -i 's|CC = gcc-5|CC = /opt/mongodbtoolchain/v4/bin/gcc|' debian/rules + sed -i 's|CXX = g++-5|CXX = /opt/mongodbtoolchain/v4/bin/g++|' debian/rules + return } -aws_sdk_build() { +aws_sdk_build(){ cd $WORKDIR - git clone https://github.com/aws/aws-sdk-cpp.git - cd aws-sdk-cpp - git reset --hard - git clean -xdf - git checkout 1.9.379 - git submodule update --init --recursive - mkdir build - cd build - CMAKE_CMD="cmake" - if [ -f /etc/redhat-release ]; then - RHEL=$(rpm --eval %rhel) - if [ x"$RHEL" = x6 ]; then - CMAKE_CMD="cmake3" - fi - fi - set_compiler - if [ -z "${CC}" -a -z "${CXX}" ]; then - ${CMAKE_CMD} .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON || exit $? - else - ${CMAKE_CMD} CC=${CC} CXX=${CXX} .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON || exit $? - fi - make -j4 || exit $? - make install + git clone https://github.com/aws/aws-sdk-cpp.git + cd aws-sdk-cpp + git reset --hard + git clean -xdf + git checkout 1.9.379 + git submodule update --init --recursive + mkdir build + cd build + CMAKE_CMD="cmake" + set_compiler + CMAKE_CXX_FLAGS="" + if [ x"${DEBIAN}" = xjammy -o x"${DEBIAN}" = xbookworm -o x"${DEBIAN}" = xnoble ]; then + CMAKE_CXX_FLAGS=" -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=uninitialized " + CMAKE_C_FLAGS=" -Wno-error=maybe-uninitialized -Wno-error=maybe-uninitialized -Wno-error=uninitialized " + fi + if [ -z "${CC}" -a -z "${CXX}" ]; then + ${CMAKE_CMD} .. -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DAUTORUN_UNIT_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr || exit $? + else + ${CMAKE_CMD} CC=${CC} CXX=${CXX} .. -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DAUTORUN_UNIT_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr || exit $? + fi + make -j${NCPU} || exit $? + make install cd ${WORKDIR} } install_deps() { - if [ $INSTALL = 0 ]; then + if [ $INSTALL = 0 ] + then echo "Dependencies will not be installed" - return + return; fi - if [ $(id -u) -ne 0 ]; then + if [ $( id -u ) -ne 0 ] + then echo "It is not possible to instal dependencies. Please run as root" exit 1 fi CURPLACE=$(pwd) if [ "x$OS" = "xrpm" ]; then + if [ x"$RHEL" = x9 ]; then + # Exclude openssl package upgrade for RHEL 9 to prevent rockylinux9 compatibility issues + OPENSSL_EXCLUDE="--exclude=openssl --exclude=openssl-libs --exclude=openssl-fips-provider --exclude=openssl-fips-provider-so --nobest" + yum clean all + yum -y update --exclude=openssl* --security + else + OPENSSL_EXCLUDE="" yum -y update - yum -y install wget - add_percona_yum_repo - wget http://jenkins.percona.com/yum-repo/percona-dev.repo - mv -f percona-dev.repo /etc/yum.repos.d/ + fi + yum -y install wget sudo + yum -y install perl + if [ x"$RHEL" != x2023 ]; then + install_mongodbtoolchain + fi + if [ x"$ARCH" = "xx86_64" ]; then yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm percona-release enable tools testing yum clean all yum install -y patchelf - RHEL=$(rpm --eval %rhel) - if [ x"$RHEL" = x6 ]; then - yum -y install epel-release - yum -y install rpmbuild rpm-build libpcap-devel gcc make cmake gcc-c++ openssl-devel git - yum -y install cyrus-sasl-devel snappy-devel zlib-devel bzip2-devel libpcap-devel - yum -y install scons make rpm-build rpmbuild percona-devtoolset-gcc percona-devtoolset-binutils - yum -y install percona-devtoolset-gcc-c++ percona-devtoolset-libstdc++-devel percona-devtoolset-valgrind-devel - yum -y install python27 python27-devel rpmlint libcurl-devel e2fsprogs-devel expat-devel lz4-devel git cmake3 - yum -y install openldap-devel krb5-devel xz-devel - wget https://bootstrap.pypa.io/get-pip.py - python2.7 get-pip.py - rm -rf /usr/bin/python2 - ln -s /usr/bin/python2.7 /usr/bin/python2 - elif [ x"$RHEL" = x7 ]; then - yum -y install epel-release - yum -y install rpmbuild rpm-build libpcap-devel gcc make cmake gcc-c++ openssl-devel - yum -y install cyrus-sasl-devel snappy-devel zlib-devel bzip2-devel scons rpmlint - yum -y install rpm-build git libopcodes libcurl-devel rpmlint e2fsprogs-devel expat-devel lz4-devel which - yum -y install openldap-devel krb5-devel xz-devel - - yum -y install centos-release-scl - yum-config-manager --enable centos-sclo-rh-testing - yum -y install rh-python38-python rh-python38-python-devel rh-python38-python-pip - source /opt/rh/rh-python38/enable - - pip install --upgrade pip - pip install --user setuptools --upgrade - pip3.8 install --user typing pyyaml regex Cheetah3 - pip2.7 install --user typing pyyaml regex Cheetah Cheetah3 - else - yum -y install bzip2-devel libpcap-devel snappy-devel gcc gcc-c++ rpm-build rpmlint - yum -y install cmake cyrus-sasl-devel make openssl-devel zlib-devel libcurl-devel git - yum -y install python2-scons python2-pip which - yum -y install redhat-rpm-config python2-devel e2fsprogs-devel expat-devel lz4-devel - yum -y install openldap-devel krb5-devel xz-devel - yum -y install python38 python38-devel python38-pip - fi - if [ "x${RHEL}" == "x8" ]; then - /usr/bin/pip3.8 install --user typing pyyaml regex Cheetah3 - /usr/bin/pip2.7 install --user typing pyyaml regex Cheetah - fi - wget https://curl.se/download/curl-7.66.0.tar.gz - tar -xvzf curl-7.66.0.tar.gz - cd curl-7.66.0 - ./configure - make + fi + if [ x"$RHEL" = x7 ]; then + yum -y install epel-release + yum -y install rpmbuild rpm-build libpcap-devel gcc make cmake gcc-c++ openssl-devel + yum -y install cyrus-sasl-devel cyrus-sasl-plain snappy-devel zlib-devel bzip2-devel rpmlint + yum -y install rpm-build git libopcodes libcurl-devel rpmlint e2fsprogs-devel expat-devel lz4-devel which + yum -y install openldap-devel krb5-devel xz-devel + yum -y install libzstd + + yum -y install centos-release-scl + yum-config-manager --enable centos-sclo-rh-testing + yum -y install devtoolset-9 + yum -y install devtoolset-11-elfutils devtoolset-11-dwz + + PATH=/opt/mongodbtoolchain/v4/bin/:$PATH + + pip install --upgrade pip + pip install --user setuptools --upgrade + pip install --user typing pyyaml regex Cheetah3 + elif [ x"$RHEL" = x8 ]; then + yum-config-manager --enable ol8_codeready_builder + yum -y install epel-release + yum -y install bzip2-devel libpcap-devel snappy-devel rpm-build rpmlint + yum -y install cmake cyrus-sasl-devel make openssl-devel zlib-devel libcurl-devel git + yum -y install which + yum -y install redhat-rpm-config e2fsprogs-devel expat-devel lz4-devel + yum -y install openldap-devel krb5-devel xz-devel + yum -y install gcc-toolset-9 gcc-c++ + yum -y install gcc-toolset-11-dwz gcc-toolset-11-elfutils + yum -y install python38 python38-devel python38-pip + + PATH=/opt/mongodbtoolchain/v4/bin/:$PATH + /usr/bin/pip install --user typing pyyaml regex Cheetah3 + elif [ x"$RHEL" = x9 -o x"$RHEL" = x2023 ]; then + dnf config-manager --enable ol9_codeready_builder + + yum -y install $OPENSSL_EXCLUDE oracle-epel-release-el9 + yum -y install $OPENSSL_EXCLUDE bzip2-devel libpcap-devel snappy-devel gcc gcc-c++ rpm-build rpmlint + yum -y install $OPENSSL_EXCLUDE cmake cyrus-sasl-devel make openssl-devel zlib-devel libcurl-devel git + yum -y install $OPENSSL_EXCLUDE python3 python3-pip python3-devel + + yum -y install $OPENSSL_EXCLUDE redhat-rpm-config which e2fsprogs-devel expat-devel lz4-devel + yum -y install $OPENSSL_EXCLUDE openldap-devel krb5-devel xz-devel + yum -y install $OPENSSL_EXCLUDE perl + /usr/bin/pip install --upgrade pip setuptools --ignore-installed + /usr/bin/pip install --user typing pyyaml==5.3.1 regex Cheetah3 + + fi + wget https://curl.se/download/curl-7.77.0.tar.gz -O curl-7.77.0.tar.gz + tar -xzf curl-7.77.0.tar.gz + cd curl-7.77.0 + ./configure --with-openssl + make -j${NCPU} make install - cd ../ - # - install_golang - install_gcc_8_centos - if [ -f /opt/rh/devtoolset-8/enable ]; then - source /opt/rh/devtoolset-8/enable - source /opt/rh/rh-python38/enable + cd ../ +# + install_golang + if [ x"$RHEL" = x8 ]; then + if [ -f /opt/rh/gcc-toolset-9/enable ]; then + source /opt/rh/gcc-toolset-9/enable + source /opt/rh/gcc-toolset-11/enable fi - pip install --upgrade pip + fi + if [ x"$RHEL" = x2023 ]; then + yum install -y lld + yum install -y python3.11* + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 11 + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 10 + alternatives --auto python3 + fi + pip install --upgrade pip else - apt-get -y update - DEBIAN_FRONTEND=noninteractive apt-get -y install curl lsb-release wget apt-transport-https software-properties-common - export DEBIAN=$(lsb_release -sc) - export ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') - wget https://repo.percona.com/apt/pool/testing/p/percona-release/percona-release_1.0-27.generic_all.deb && dpkg -i percona-release_1.0-27.generic_all.deb - if [ x"${DEBIAN}" = "xxenial" -o x"${DEBIAN}" = "xbionic" -o x"${DEBIAN}" = "xfocal" ]; then - add-apt-repository -y ppa:deadsnakes/ppa - elif [ x"${DEBIAN}" = "xstretch" -o x"${DEBIAN}" = "xbuster" ]; then - wget https://people.debian.org/~paravoid/python-all/unofficial-python-all.asc - mv unofficial-python-all.asc /etc/apt/trusted.gpg.d/ - echo "deb http://people.debian.org/~paravoid/python-all ${DEBIAN} main" | tee /etc/apt/sources.list.d/python-all.list - fi - percona-release enable tools testing - apt-get update - if [ x"${DEBIAN}" = "xbullseye" ]; then - INSTALL_LIST="python3 python3-dev python3-pip" - else - INSTALL_LIST="python3.7 python3.7-dev dh-systemd" - fi - INSTALL_LIST="${INSTALL_LIST} git valgrind scons liblz4-dev devscripts debhelper debconf libpcap-dev libbz2-dev libsnappy-dev pkg-config zlib1g-dev libzlcore-dev libsasl2-dev gcc g++ cmake curl" - INSTALL_LIST="${INSTALL_LIST} libssl-dev libcurl4-openssl-dev libldap2-dev libkrb5-dev liblzma-dev patchelf" - if [ x"${DEBIAN}" != "xstretch" -a x"${DEBIAN}" != "xbullseye" ]; then - INSTALL_LIST="${INSTALL_LIST} python3.7-distutils" - fi - until apt-get -y install dirmngr; do - sleep 1 - echo "waiting" - done - until DEBIAN_FRONTEND=noninteractive apt-get -y install ${INSTALL_LIST}; do - sleep 1 - echo "waiting" - done - apt-get -y install libext2fs-dev || apt-get -y install e2fslibs-dev - install_golang - install_gcc_8_deb - wget https://bootstrap.pypa.io/get-pip.py - if [ x"${DEBIAN}" = "xbullseye" ]; then - update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 - else - update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 - ln -sf /usr/bin/python3.7 /usr/bin/python3 - fi - python get-pip.py - easy_install pip - pip install setuptools - fi - if [ x"${DEBIAN}" = "xstretch" ]; then - LIBCURL_DEPS="libidn2-0-dev libldap2-dev libnghttp2-dev libnss3-dev libpsl-dev librtmp-dev libssh2-1-dev libssl1.0-dev" - until DEBIAN_FRONTEND=noninteractive apt-get -y install ${LIBCURL_DEPS}; do - sleep 1 - echo "waiting" - done - wget http://curl.haxx.se/download/curl-7.66.0.tar.gz - tar -xvzf curl-7.66.0.tar.gz - cd curl-7.66.0 - ./configure --enable-static --disable-shared --disable-dependency-tracking --disable-symbol-hiding --enable-versioned-symbols --enable-threaded-resolver --with-lber-lib=lber --with-gssapi=/usr --with-libssh2 --with-nghttp2 --with-zsh-functions-dir=/usr/share/zsh/vendor-completions --with-ca-path=/etc/ssl/certs --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt --with-ssl - make - make install - cd ../ - CURL_LINKFLAGS=$(pkg-config libcurl --static --libs) - export LDFLAGS="${LDFLAGS} ${CURL_LINKFLAGS}" + apt-get -y update + DEBIAN_FRONTEND=noninteractive apt-get -y install curl lsb-release wget apt-transport-https software-properties-common + export DEBIAN=$(lsb_release -sc) + export ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') + wget https://repo.percona.com/apt/pool/main/p/percona-release/percona-release_1.0-27.generic_all.deb && dpkg -i percona-release_1.0-27.generic_all.deb + percona-release enable tools testing + apt-get update + if [ x"${DEBIAN}" = "xfocal" ]; then + INSTALL_LIST="dh-systemd" + fi + INSTALL_LIST="${INSTALL_LIST} git valgrind liblz4-dev devscripts debhelper debconf libpcap-dev libbz2-dev libsnappy-dev pkg-config zlib1g-dev libzlcore-dev libsasl2-dev gcc g++ cmake curl" + INSTALL_LIST="${INSTALL_LIST} libssl-dev libcurl4-openssl-dev libldap2-dev libkrb5-dev liblzma-dev patchelf libexpat1-dev sudo libfile-copy-recursive-perl" + until apt-get -y install dirmngr; do + sleep 1 + echo "waiting" + done + until DEBIAN_FRONTEND=noninteractive apt-get -y install ${INSTALL_LIST}; do + sleep 1 + echo "waiting" + done + apt-get -y install libext2fs-dev || apt-get -y install e2fslibs-dev + install_golang + + install_mongodbtoolchain + PATH=/opt/mongodbtoolchain/v4/bin/:$PATH + update-alternatives --install /usr/bin/python python /opt/mongodbtoolchain/v4/bin/python3.10 1 + + wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py + python get-pip.py + easy_install pip + pip install setuptools fi aws_sdk_build - return + #keep symbol table in the binary + sed -i 's:$strip, "--remove-section=.comment":$strip, "--strip-debug", "--remove-section=.comment":g' /usr/bin/dh_strip + return; +} + +install_mongodbtoolchain(){ + #curl -o toolchain_installer.sh https://jenkins.percona.com/downloads/mongodbtoolchain/installer.sh + curl -O https://downloads.percona.com/downloads/packaging/toolchain_installer.tar.gz + tar -zxvf toolchain_installer.tar.gz + if [ ! -z "${RHEL}" ]; then + OS_CODE_NAME=${RHEL} + else + OS_CODE_NAME=${DEBIAN} + fi + export USER=$(whoami) + #bash -x ./toolchain_installer.sh -k --download-url https://jenkins.percona.com/downloads/mongodbtoolchain/${OS_CODE_NAME}_mongodbtoolchain_${ARCH}.tar.gz || exit 1 + bash -x ./installer.sh --keep-download --download-dir /tmp/ --download-url https://downloads.percona.com/downloads/packaging/${OS_CODE_NAME}_mongodbtoolchain_${ARCH}.tar.gz || exit 1 + export PATH=/opt/mongodbtoolchain/v4/bin/:$PATH } -get_tar() { +get_tar(){ TARBALL=$1 TARFILE=$(basename $(find $WORKDIR/$TARBALL -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1)) - if [ -z $TARFILE ]; then + if [ -z $TARFILE ] + then TARFILE=$(basename $(find $CURDIR/$TARBALL -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1)) - if [ -z $TARFILE ]; then + if [ -z $TARFILE ] + then echo "There is no $TARBALL for build" exit 1 else @@ -467,13 +516,15 @@ get_tar() { return } -get_deb_sources() { +get_deb_sources(){ param=$1 echo $param FILE=$(basename $(find $WORKDIR/source_deb -name "percona-server-mongodb*.$param" | sort | tail -n1)) - if [ -z $FILE ]; then + if [ -z $FILE ] + then FILE=$(basename $(find $CURDIR/source_deb -name "percona-server-mongodb*.$param" | sort | tail -n1)) - if [ -z $FILE ]; then + if [ -z $FILE ] + then echo "There is no sources for build" exit 1 else @@ -485,26 +536,42 @@ get_deb_sources() { return } -build_srpm() { - if [ $SRPM = 0 ]; then +build_srpm(){ + if [ $SRPM = 0 ] + then echo "SRC RPM will not be created" - return + return; fi - if [ "x$OS" = "xdeb" ]; then + if [ "x$OS" = "xdeb" ] + then echo "It is not possible to build src rpm here" exit 1 fi cd $WORKDIR get_tar "source_tarball" rm -fr rpmbuild - ls | grep -v tar.gz | xargs rm -rf + ls | grep -v tar.gz | grep -v percona-server-mongodb-83.properties | xargs rm -rf TARFILE=$(find . -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1) SRC_DIR=${TARFILE%.tar.gz} + tar xzf ${WORKDIR}/${TARFILE} + source ${WORKDIR}/percona-server-mongodb-83.properties + cd ${PRODUCT_FULL} + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelignore + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazeliskrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelversion + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc.psmdb + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.npmrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.prettierignore + cd .. + tar --owner=0 --group=0 -czf ${PRODUCT_FULL}.tar.gz ${PRODUCT_FULL} # mkdir -vp rpmbuild/{SOURCES,SPECS,BUILD,SRPMS,RPMS} - tar vxzf ${WORKDIR}/${TARFILE} --wildcards '*/percona-packaging' --strip=1 + tar xzf ${WORKDIR}/${TARFILE} --wildcards '*/percona-packaging' --strip=1 SPEC_TMPL=$(find percona-packaging/redhat -name 'percona-server-mongodb.spec.template' | sort | tail -n1) # + wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh + mv call-home.sh rpmbuild/SOURCES cp -av percona-packaging/conf/* rpmbuild/SOURCES cp -av percona-packaging/redhat/mongod.* rpmbuild/SOURCES # @@ -514,15 +581,37 @@ build_srpm() { sed -i 's:@@LOGDIR@@:mongo:g' rpmbuild/SOURCES/percona-server-mongodb-helper.sh # sed -e "s:@@SOURCE_TARBALL@@:$(basename ${TARFILE}):g" \ - -e "s:@@VERSION@@:${VERSION}:g" \ - -e "s:@@RELEASE@@:${RELEASE}:g" \ - -e "s:@@SRC_DIR@@:$SRC_DIR:g" \ - ${SPEC_TMPL} >rpmbuild/SPECS/$(basename ${SPEC_TMPL%.template}) + -e "s:@@VERSION@@:${VERSION}:g" \ + -e "s:@@RELEASE@@:${RELEASE}:g" \ + -e "s:@@SRC_DIR@@:$SRC_DIR:g" \ + -e "s:@@PSMDB_GIT_HASH@@:${REVISION_LONG}:g" \ + ${SPEC_TMPL} > rpmbuild/SPECS/$(basename ${SPEC_TMPL%.template}) mv -fv ${TARFILE} ${WORKDIR}/rpmbuild/SOURCES - if [ -f /opt/rh/devtoolset-8/enable ]; then - source /opt/rh/devtoolset-8/enable - source /opt/rh/rh-python38/enable + if [ x"$RHEL" = x7 ]; then + if [ -f /opt/rh/devtoolset-9/enable ]; then + source /opt/rh/devtoolset-9/enable + source /opt/rh/devtoolset-11/enable + fi + elif [ x"$RHEL" = x8 ]; then + if [ -f /opt/rh/gcc-toolset-9/enable ]; then + source /opt/rh/gcc-toolset-9/enable + source /opt/rh/gcc-toolset-11/enable + fi fi + + cd ${WORKDIR}/rpmbuild/SPECS + line_number=$(grep -n SOURCE999 percona-server-mongodb.spec | awk -F ':' '{print $1}') + cp ../SOURCES/call-home.sh ./ + awk -v n=$line_number 'NR <= n {print > "part1.txt"} NR > n {print > "part2.txt"}' percona-server-mongodb.spec + head -n -1 part1.txt > temp && mv temp part1.txt + echo "cat <<'CALLHOME' > /tmp/call-home.sh" >> part1.txt + cat call-home.sh >> part1.txt + echo "CALLHOME" >> part1.txt + cat part2.txt >> part1.txt + rm -f call-home.sh part2.txt + mv part1.txt percona-server-mongodb.spec + cd ${WORKDIR} + rpmbuild -bs --define "_topdir ${WORKDIR}/rpmbuild" --define "dist .generic" rpmbuild/SPECS/$(basename ${SPEC_TMPL%.template}) mkdir -p ${WORKDIR}/srpm mkdir -p ${CURDIR}/srpm @@ -531,19 +620,23 @@ build_srpm() { return } -build_rpm() { - if [ $RPM = 0 ]; then +build_rpm(){ + if [ $RPM = 0 ] + then echo "RPM will not be created" - return + return; fi - if [ "x$OS" = "xdeb" ]; then + if [ "x$OS" = "xdeb" ] + then echo "It is not possible to build rpm here" exit 1 fi SRC_RPM=$(basename $(find $WORKDIR/srpm -name 'percona-server-mongodb*.src.rpm' | sort | tail -n1)) - if [ -z $SRC_RPM ]; then + if [ -z $SRC_RPM ] + then SRC_RPM=$(basename $(find $CURDIR/srpm -name 'percona-server-mongodb*.src.rpm' | sort | tail -n1)) - if [ -z $SRC_RPM ]; then + if [ -z $SRC_RPM ] + then echo "There is no src rpm for build" echo "You can create it using key --build_src_rpm=1" exit 1 @@ -562,50 +655,76 @@ build_rpm() { rpm2cpio ${SRC_RPM} | cpio -id TARF=$(find . -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1) tar vxzf ${TARF} --wildcards '*/etc' --strip=1 - if [ -f /opt/rh/devtoolset-8/enable ]; then - source /opt/rh/devtoolset-8/enable - source /opt/rh/rh-python38/enable + tar vxzf ${TARF} --wildcards '*/buildscripts' --strip=1 + python3 buildscripts/install_bazel.py + export PATH=\/root/.local/bin:$PATH >> ~/.bashrc + source ~/.bashrc + rm -rf install_bazel.py + if [ x"$RHEL" = x7 ]; then + if [ -f /opt/rh/devtoolset-9/enable ]; then + source /opt/rh/devtoolset-9/enable + source /opt/rh/devtoolset-11/enable + fi + elif [ x"$RHEL" = x8 ]; then + if [ -f /opt/rh/gcc-toolset-9/enable ]; then + source /opt/rh/gcc-toolset-9/enable + source /opt/rh/gcc-toolset-11/enable + mv /usr/bin/python3 /usr/bin/python3_old + fi + elif [ x"$RHEL" = x9 ]; then + mv /usr/bin/python3 /usr/bin/python3_old fi - RHEL=$(rpm --eval %rhel) - ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') - if [ "x${RHEL}" == "x6" ]; then + if [ "x${RHEL}" == "x2023" ]; then pip install --upgrade pip + pip install --user requirements_parser pip install --user -r etc/pip/dev-requirements.txt pip install --user -r etc/pip/evgtest-requirements.txt + pip install --user -r etc/pip/compile-requirements.txt + export PYTHONPATH="/usr/local/lib64/python3.11/site-packages:/usr/local/lib/python3.11/site-packages:$PYTHONPATH" +# export CC=/usr/bin/gcc +# export CXX=/usr/bin/g++ else - pip3.8 install --upgrade pip - pip3.8 install --user -r etc/pip/dev-requirements.txt - pip3.8 install --user -r etc/pip/evgtest-requirements.txt - fi - # - cd $WORKDIR - if [ -f /opt/rh/devtoolset-8/enable ]; then - source /opt/rh/devtoolset-8/enable - source /opt/rh/rh-python38/enable + PATH=/opt/mongodbtoolchain/v4/bin/:$PATH fi +# PATH=/opt/mongodbtoolchain/v4/bin/:$PATH + pip install --upgrade pip - echo "CC and CXX should be modified once correct compiller would be installed on Centos" - if [ "x${RHEL}" == "x8" ]; then - export CC=/usr/bin/gcc - export CXX=/usr/bin/g++ - else - export CC=/opt/rh/devtoolset-8/root/usr/bin/gcc - export CXX=/opt/rh/devtoolset-8/root/usr/bin/g++ + # PyYAML pkg installation fix, more info: https://github.com/yaml/pyyaml/issues/724 + pip install pyyaml==5.4.1 --no-build-isolation + pip install 'referencing<0.30.0' --no-build-isolation + pip install 'jsonschema-specifications<=2023.07.1' --no-build-isolation + + pip install 'poetry==2.0.0' 'pyproject-hooks==1.2.0' + pip install 'mongo_tooling_metrics==1.0.8' 'retry' 'psutil' 'Cheetah3' + + + if [ "x${RHEL}" != "x2023" ]; then + echo "CC and CXX should be modified once correct compiller would be installed on Centos" + export CC=/opt/mongodbtoolchain/v4/bin/gcc + export CXX=/opt/mongodbtoolchain/v4/bin/g++ + #update toolchain pathes to know about installed poetry + toolchain_revision=$(tar -ztf /tmp/mongodbtoolchain.tar.gz | head -1 | sed 's/\/$//') + /opt/mongodbtoolchain/revisions/${toolchain_revision}/scripts/install.sh fi # - echo "RHEL=${RHEL}" >>percona-server-mongodb-50.properties - echo "ARCH=${ARCH}" >>percona-server-mongodb-50.properties + cd $WORKDIR + + echo "RHEL=${RHEL}" >> percona-server-mongodb-83.properties + echo "ARCH=${ARCH}" >> percona-server-mongodb-83.properties # - file /usr/bin/scons # - #if [ "x${RHEL}" == "x6" ]; then [[ ${PATH} == *"/usr/local/go/bin"* && -x /usr/local/go/bin/go ]] || export PATH=/usr/local/go/bin:${PATH} export GOROOT="/usr/local/go/" export GOPATH=$(pwd)/ - export PATH="/usr/local/go/bin:$PATH:$GOPATH" + export PATH="/usr/bin:/usr/local/go/bin:$PATH:$GOPATH" export GOBINPATH="/usr/local/go/bin" - #fi + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + if [ "x${RHEL}" == "x2023" ]; then + export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 " + else + export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 -B/opt/mongodbtoolchain/v4/bin" + fi rpmbuild --define "_topdir ${WORKDIR}/rpmbuild" --define "dist .$OS_NAME" --rebuild rpmbuild/SRPMS/$SRC_RPM return_code=$? @@ -618,12 +737,14 @@ build_rpm() { cp rpmbuild/RPMS/*/*.rpm ${CURDIR}/rpm } -build_source_deb() { - if [ $SDEB = 0 ]; then +build_source_deb(){ + if [ $SDEB = 0 ] + then echo "Source deb package will not be created" - return + return; fi - if [ "x$OS" = "xrpm" ]; then + if [ "x$OS" = "xrpm" ] + then echo "It is not possible to build source deb here" exit 1 fi @@ -646,14 +767,32 @@ build_source_deb() { sed -i 's:@@LOGDIR@@:mongodb:g' ${BUILDDIR}/debian/mongod.default sed -i 's:@@LOGDIR@@:mongodb:g' ${BUILDDIR}/debian/percona-server-mongodb-helper.sh # + if [ x"${DEBIAN}" = "xbullseye" -o x"${DEBIAN}" = "xbookworm" -o x"${DEBIAN}" = "xjammy" -o x"${DEBIAN}" = "xnoble" ]; then + sed -i 's:dh-systemd,::' ${BUILDDIR}/debian/control + fi + # mv ${BUILDDIR}/debian/mongod.default ${BUILDDIR}/debian/percona-server-mongodb-server.mongod.default mv ${BUILDDIR}/debian/mongod.service ${BUILDDIR}/debian/percona-server-mongodb-server.mongod.service # mv ${TARFILE} ${PRODUCT}_${VERSION}.orig.tar.gz cd ${BUILDDIR} + + export PATH=/opt/mongodbtoolchain/v4/bin/:$PATH pip install --upgrade pip - pip install -r etc/pip/dev-requirements.txt - pip install -r etc/pip/evgtest-requirements.txt + + # PyYAML pkg installation fix, more info: https://github.com/yaml/pyyaml/issues/724 + pip install pyyaml==5.4.1 --no-build-isolation + pip install 'referencing<0.30.0' --no-build-isolation + pip install 'jsonschema-specifications<=2023.07.1' --no-build-isolation + + pip install 'poetry==2.0.0' 'pyproject-hooks==1.2.0' + pip install 'mongo_tooling_metrics==1.0.8' 'retry' 'psutil' 'Cheetah3' + + #update toolchain pathes to know about installed poetry + toolchain_revision=$(tar -ztf /tmp/mongodbtoolchain.tar.gz | head -1 | sed 's/\/$//') + /opt/mongodbtoolchain/revisions/${toolchain_revision}/scripts/install.sh + poetry env use /opt/mongodbtoolchain/v4/bin/python3 + poetry install --no-root --sync set_compiler fix_rules @@ -666,23 +805,26 @@ build_source_deb() { cp *.debian.tar.* $WORKDIR/source_deb cp *_source.changes $WORKDIR/source_deb cp *.dsc $WORKDIR/source_deb - cp *.orig.tar.gz $WORKDIR/source_deb cp *.debian.tar.* $CURDIR/source_deb cp *_source.changes $CURDIR/source_deb cp *.dsc $CURDIR/source_deb + cp *.orig.tar.gz $WORKDIR/source_deb cp *.orig.tar.gz $CURDIR/source_deb } -build_deb() { - if [ $DEB = 0 ]; then +build_deb(){ + if [ $DEB = 0 ] + then echo "Deb package will not be created" - return + return; fi - if [ "x$OS" = "xrmp" ]; then + if [ "x$OS" = "xrpm" ] + then echo "It is not possible to build deb here" exit 1 fi - for file in 'dsc' 'orig.tar.gz' 'changes' 'debian.tar*'; do + for file in 'dsc' 'orig.tar.gz' 'changes' 'debian.tar*' + do get_deb_sources $file done cd $WORKDIR @@ -691,8 +833,9 @@ build_deb() { export DEBIAN=$(lsb_release -sc) export ARCH=$(echo $(uname -m) | sed -e 's:i686:i386:g') # - echo "DEBIAN=${DEBIAN}" >>percona-server-mongodb-50.properties - echo "ARCH=${ARCH}" >>percona-server-mongodb-50.properties + echo "DEBIAN=${DEBIAN}" >> ${WORKDIR}/percona-server-mongodb-83.properties + echo "ARCH=${ARCH}" >> ${WORKDIR}/percona-server-mongodb-83.properties + source ${WORKDIR}/percona-server-mongodb-83.properties # DSC=$(basename $(find . -name '*.dsc' | sort | tail -n1)) @@ -700,28 +843,70 @@ build_deb() { dpkg-source -x ${DSC} # cd ${PRODUCT}-${VERSION} + export PATH=/opt/mongodbtoolchain/v4/bin/:$PATH + pip install --upgrade pip - pip install -r etc/pip/dev-requirements.txt - pip install -r etc/pip/evgtest-requirements.txt + + # PyYAML pkg installation fix, more info: https://github.com/yaml/pyyaml/issues/724 + pip install pyyaml==5.4.1 --no-build-isolation + pip install 'referencing<0.30.0' --no-build-isolation + pip install 'jsonschema-specifications<=2023.07.1' --no-build-isolation + + pip install 'poetry==2.0.0' 'pyproject-hooks==1.2.0' + pip install 'mongo_tooling_metrics==1.0.8' 'retry' 'psutil' 'Cheetah3' + + #update toolchain pathes to know about installed poetry + toolchain_revision=$(tar -ztf /tmp/mongodbtoolchain.tar.gz | head -1 | sed 's/\/$//') + /opt/mongodbtoolchain/revisions/${toolchain_revision}/scripts/install.sh + poetry env use /opt/mongodbtoolchain/v4/bin/python3 + poetry install --no-root --sync + # + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelignore + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazeliskrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelversion + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc.psmdb + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.npmrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.prettierignore + python3 buildscripts/install_bazel.py + export PATH=\/root/.local/bin:$PATH >> ~/.bashrc + source ~/.bashrc cp -av percona-packaging/debian/rules debian/ set_compiler fix_rules - if [ x"${DEBIAN}" = "xbullseye" ]; then + + if [ x"${DEBIAN}" = "xbullseye" -o x"${DEBIAN}" = "xbookworm" -o x"${DEBIAN}" = "xjammy" -o x"${DEBIAN}" = "xnoble" ]; then sed -i 's:dh-systemd,::' debian/control - sed -i 's:etc/:/etc/:g' debian/percona-server-mongodb-server.conffiles fi sed -i 's|VersionStr="$(go run release/release.go get-version)"|VersionStr="$PSMDB_TOOLS_REVISION"|' mongo-tools/set_goenv.sh sed -i 's|GitCommit="$(git rev-parse HEAD)"|GitCommit="$PSMDB_TOOLS_COMMIT_HASH"|' mongo-tools/set_goenv.sh sed -i 's|go build|go build -a -x|' mongo-tools/build.sh sed -i 's|exit $ec||' mongo-tools/build.sh . ./mongo-tools/set_tools_revision.sh + + export PSMDB_VERSION="${VERSION}-${RELEASE}" + export PSMDB_GIT_HASH="${REVISION_LONG}" + dch -m -D "${DEBIAN}" --force-distribution -v "${VERSION}-${RELEASE}.${DEBIAN}" 'Update distribution' export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - if [ x"${DEBIAN}" = "xstretch" ]; then - CURL_LINKFLAGS=$(pkg-config libcurl --static --libs) - export LINKFLAGS="${LINKFLAGS} ${CURL_LINKFLAGS}" - fi + + export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 -B/opt/mongodbtoolchain/v4/bin" + + cd debian/ + wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh + sed -i 's:exit 0::' percona-server-mongodb-server.postinst + echo "cat <<'CALLHOME' > /tmp/call-home.sh" >> percona-server-mongodb-server.postinst + cat call-home.sh >> percona-server-mongodb-server.postinst + echo "CALLHOME" >> percona-server-mongodb-server.postinst + echo 'bash +x /tmp/call-home.sh -f "PRODUCT_FAMILY_PSMDB" -v '"${PSM_VER}-${PSM_RELEASE}"' -d "PACKAGE" &>/dev/null || :' >> percona-server-mongodb-server.postinst + echo "chgrp percona-telemetry /usr/local/percona/telemetry_uuid &>/dev/null || :" >> percona-server-mongodb-server.postinst + echo "chmod 664 /usr/local/percona/telemetry_uuid &>/dev/null || :" >> percona-server-mongodb-server.postinst + echo "rm -rf /tmp/call-home.sh" >> percona-server-mongodb-server.postinst + echo "exit 0" >> percona-server-mongodb-server.postinst + rm -f call-home.sh + cd ../ + export GOROOT="/usr/local/go/" export GOPATH=$PWD/../ export PATH="/usr/local/go/bin:$PATH:$GOPATH" @@ -733,13 +918,15 @@ build_deb() { cp $WORKDIR/*.deb $CURDIR/deb } -build_tarball() { - if [ $TARBALL = 0 ]; then +build_tarball(){ + if [ $TARBALL = 0 ] + then echo "Binary tarball will not be created" - return + return; fi get_tar "source_tarball" cd $WORKDIR + source ${WORKDIR}/percona-server-mongodb-83.properties TARFILE=$(basename $(find . -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1)) # @@ -748,54 +935,60 @@ build_tarball() { export PATH=/usr/local/go/bin:$PATH # # - PSM_TARGETS="mongod mongos mongo mongobridge perconadecrypt $SPECIAL_TAR" + PSM_TARGETS="mongod mongos perconadecrypt mongobridge $SPECIAL_TAR" PSM_REAL_TARGETS=() # transformed targets with 'install-' prefix - for pp in $PSM_TARGETS; do + for pp in $PSM_TARGETS + do # using regex to find '=' characters in string # don't touch if it starts from '-' character or 'install-' string # also don't change parameter if it contains slash to preserve targets specifying full path to unittests or object files if [[ $pp =~ ^install-|^-|=|/ ]]; then # if - or = is found parameter is unchanged - PSM_REAL_TARGETS+=($pp) + PSM_REAL_TARGETS+=( $pp ) else # otherwise add 'install-' prefix required by hygienic build - PSM_REAL_TARGETS+=(install-$pp) + PSM_REAL_TARGETS+=( install-$pp ) fi done TARBALL_SUFFIX="" if [ ${DEBUG} = 1 ]; then - TARBALL_SUFFIX=".dbg" + TARBALL_SUFFIX=".dbg" fi if [ -f /etc/debian_version ]; then set_compiler fi # - if [ -f /etc/redhat-release ]; then - #export OS_RELEASE="centos$(lsb_release -sr | awk -F'.' '{print $1}')" - RHEL=$(rpm --eval %rhel) - if [ -f /opt/rh/devtoolset-8/enable ]; then - source /opt/rh/devtoolset-8/enable - source /opt/rh/rh-python38/enable + if [ -f /etc/redhat-release -o -f /etc/amazon-linux-release ]; then + #export OS_RELEASE="centos$(lsb_release -sr | awk -F'.' '{print $1}')" + if [ x"$RHEL" = x7 ]; then + if [ -f /opt/rh/devtoolset-9/enable ]; then + source /opt/rh/devtoolset-9/enable + source /opt/rh/devtoolset-11/enable + fi + elif [ x"$RHEL" = x8 ]; then + if [ -f /opt/rh/gcc-toolset-9/enable ]; then + source /opt/rh/gcc-toolset-9/enable + source /opt/rh/gcc-toolset-11/enable + fi fi - echo "CC and CXX should be modified once correct compiller would be installed on Centos" - if [ "x${RHEL}" == "x8" ]; then + if [ "x${RHEL}" != "x2023" ]; then + echo "CC and CXX should be modified once correct compiller would be installed on Centos" + export CC=/opt/mongodbtoolchain/v4/bin/gcc + export CXX=/opt/mongodbtoolchain/v4/bin/g++ + else export CC=/usr/bin/gcc export CXX=/usr/bin/g++ - else - export CC=/opt/rh/devtoolset-8/root/usr/bin/gcc - export CXX=/opt/rh/devtoolset-8/root/usr/bin/g++ fi fi # - ARCH=$(uname -m 2>/dev/null || true) + ARCH=$(uname -m 2>/dev/null||true) TARFILE=$(basename $(find . -name 'percona-server-mongodb*.tar.gz' | sort | grep -v "tools" | tail -n1)) PSMDIR=${TARFILE%.tar.gz} PSMDIR_ABS=${WORKDIR}/${PSMDIR} TOOLSDIR=${PSMDIR}/mongo-tools TOOLSDIR_ABS=${WORKDIR}/${TOOLSDIR} TOOLS_TAGS="ssl sasl" - NJOBS=4 tar xzf $TARFILE rm -f $TARFILE @@ -807,7 +1000,7 @@ build_tarball() { export CFLAGS="${CFLAGS:-} -fno-omit-frame-pointer" export CXXFLAGS="${CFLAGS}" if [ ${DEBUG} = 1 ]; then - export CXXFLAGS="${CFLAGS} -Wno-error=deprecated-declarations" + export CXXFLAGS="${CFLAGS} -Wno-error=deprecated-declarations" fi export INSTALLDIR=/usr/local export AWS_LIBS=/usr/local @@ -817,17 +1010,27 @@ build_tarball() { # Finally build Percona Server for MongoDB with SCons cd ${PSMDIR_ABS} - if [ "x${RHEL}" == "x8" ]; then - pip3.6 install --upgrade pip - pip3.6 install --user -r etc/pip/dev-requirements.txt - pip3.6 install --user -r etc/pip/evgtest-requirements.txt - else + if [ "x${RHEL}" != "x2023" ]; then + export PATH=/opt/mongodbtoolchain/v4/bin/:$PATH pip install --upgrade pip - pip install --user -r etc/pip/dev-requirements.txt - pip install --user -r etc/pip/evgtest-requirements.txt fi - if [ -f /etc/redhat-release ]; then - RHEL=$(rpm --eval %rhel) + # PyYAML pkg installation fix, more info: https://github.com/yaml/pyyaml/issues/724 + pip install pyyaml==5.4.1 --no-build-isolation + pip install 'referencing<0.30.0' --no-build-isolation + pip install 'jsonschema-specifications<=2023.07.1' --no-build-isolation + + pip install 'poetry==2.0.0' 'pyproject-hooks==1.2.0' + pip install 'mongo_tooling_metrics==1.0.8' 'retry' 'psutil' 'Cheetah3' + + #update toolchain pathes to know about installed poetry + if [ "x${RHEL}" != "x2023" ]; then + toolchain_revision=$(tar -ztf /tmp/mongodbtoolchain.tar.gz | head -1 | sed 's/\/$//') + /opt/mongodbtoolchain/revisions/${toolchain_revision}/scripts/install.sh + poetry env use /opt/mongodbtoolchain/v4/bin/python3 + fi + poetry install --no-root --sync + + if [ -f /etc/redhat-release -o -f /etc/amazon-linux-release ]; then if [ $RHEL = 7 -o $RHEL = 8 ]; then if [ -d aws-sdk-cpp ]; then rm -rf aws-sdk-cpp @@ -840,15 +1043,27 @@ build_tarball() { git clean -xdf git checkout 1.9.379 git submodule update --init --recursive + if [[ x"${RHEL}" =~ ^x(7|8|9|2023)$ ]]; then + sed -i 's:v0.4.42:v0.6.10:' third-party/CMakeLists.txt + sed -i 's:"-Werror" ::' cmake/compiler_settings.cmake + fi mkdir build cd build set_compiler + if [ x"${DEBIAN}" = xjammy ]; then + CMAKE_CXX_FLAGS=" -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=uninitialized " + CMAKE_C_FLAGS=" -Wno-error=maybe-uninitialized -Wno-error=maybe-uninitialized -Wno-error=uninitialized " + fi + CMAKE_CMD="cmake" +# if [ x"$RHEL" = x7 ]; then +# CMAKE_CMD="cmake3" +# fi if [ -z "${CC}" -a -z "${CXX}" ]; then - cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" || exit $? + ${CMAKE_CMD} .. -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" -DAUTORUN_UNIT_TESTS=OFF || exit $? else - cmake CC=${CC} CXX=${CXX} .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" || exit $? + ${CMAKE_CMD} CC=${CC} CXX=${CXX} .. -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" -DAUTORUN_UNIT_TESTS=OFF || exit $? fi - make -j4 || exit $? + make -j${NCPU} || exit $? make install mkdir -p ${INSTALLDIR}/include/ mkdir -p ${INSTALLDIR}/lib/ @@ -859,25 +1074,33 @@ build_tarball() { fi fi export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - if [ x"${DEBIAN}" = "xstretch" ]; then - CURL_LINKFLAGS=$(pkg-config libcurl --static --libs) - export LINKFLAGS="${LINKFLAGS} ${CURL_LINKFLAGS}" - fi - if [ ${DEBUG} = 0 ]; then - buildscripts/scons.py CC=${CC} CXX=${CXX} --disable-warnings-as-errors --release --ssl --opt=on -j$NJOBS --use-sasl-client --wiredtiger --audit --inmemory --hotbackup CPPPATH="${INSTALLDIR}/include ${AWS_LIBS}/include" LIBPATH="${INSTALLDIR}/lib ${AWS_LIBS}/lib ${AWS_LIBS}/lib64" LINKFLAGS="${LINKFLAGS}" ${PSM_REAL_TARGETS[@]} || exit $? + if [ "x${RHEL}" == "x2023" ]; then + export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 " else - buildscripts/scons.py CC=${CC} CXX=${CXX} --disable-warnings-as-errors --audit --ssl --dbg=on -j$NJOBS --use-sasl-client \ - CPPPATH="${INSTALLDIR}/include ${AWS_LIBS}/include" LIBPATH="${INSTALLDIR}/lib ${AWS_LIBS}/lib ${AWS_LIBS}/lib64" LINKFLAGS="${LINKFLAGS}" --wiredtiger --inmemory --hotbackup ${PSM_REAL_TARGETS[@]} || exit $? + export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 -B/opt/mongodbtoolchain/v4/bin" fi - # - # scons install doesn't work - it installs the binaries not linked with fractal tree - #scons --prefix=$PWD/$PSMDIR install - # + if [ x"${DEBIAN}" = "xstretch" ]; then + CURL_LINKFLAGS=$(pkg-config libcurl --static --libs) + export OPT_LINKFLAGS="${OPT_LINKFLAGS} ${CURL_LINKFLAGS}" + fi + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelignore + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazeliskrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelversion + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.bazelrc.psmdb + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.npmrc + wget https://raw.githubusercontent.com/percona/percona-server-mongodb/refs/heads/${BRANCH}/.prettierignore + python3 buildscripts/install_bazel.py + export PATH=\/root/.local/bin:$PATH >> ~/.bashrc + source ~/.bashrc + bazel clean --expunge || true + bazel build --config=psmdb_opt_release --define=MONGO_VERSION=${VERSION}-${RELEASE} --define=GIT_COMMIT_HASH=${REVISION_LONG} install-dist-test + rm -rf .[^.]* mkdir -p ${PSMDIR}/bin for target in ${PSM_TARGETS[@]}; do - cp -f build/install/bin/$target ${PSMDIR}/bin + cp -fL bazel-bin/install-dist-test/bin/${target#"bazel-bin/install-dist-test/bin/"} ${PSMDIR}/bin if [ ${DEBUG} = 0 ]; then - strip --strip-debug ${PSMDIR}/bin/${target} + strip --strip-debug ${PSMDIR}/bin/${target#"bazel-bin/install-dist-test/bin/"} fi done # @@ -894,8 +1117,8 @@ build_tarball() { cp -r ${WORKDIR}/${TOOLSDIR} ./ cd mongo-tools . ./set_tools_revision.sh - sed -i '12d' buildscript/build.go - sed -i '167,176d' buildscript/build.go + sed -i '14d' buildscript/build.go + sed -i '226,234d' buildscript/build.go sed -i "s:versionStr,:\"$PSMDB_TOOLS_REVISION\",:" buildscript/build.go sed -i "s:gitCommit):\"$PSMDB_TOOLS_COMMIT_HASH\"):" buildscript/build.go ./make build @@ -908,11 +1131,8 @@ build_tarball() { # Patch needed libraries cd "${PSMDIR_ABS}/${PSMDIR}" - if [ ! -d lib/private ]; then - mkdir -p lib/private - fi - LIBLIST="libcrypto.so libssl.so libsasl2.so librtmp.so libssl3.so libsmime3.so libnss3.so libnssutil3.so libplds4.so libplc4.so libnspr4.so libssl3.so liblzma.so libidn.so" - DIRLIST="bin lib/private" + LIBLIST="" + DIRLIST="bin" LIBPATH="" @@ -964,14 +1184,31 @@ build_tarball() { done } + function fix_sasl_lib { + # Details are in tickets PSMDB-950 PSMDB-1153 PSMDB-1261 + patchelf --remove-needed libsasl2.so.3 bin/mongod + patchelf --remove-needed libsasl2.so.2 bin/mongod + patchelf --remove-needed libsasl2.so.3 bin/mongo + patchelf --remove-needed libsasl2.so.2 bin/mongo + patchelf --remove-needed libsasl2.so.3 bin/mongos + patchelf --remove-needed libsasl2.so.2 bin/mongos + + # Details are in tickets PSMDB-1160 + if [ "x$OS" = "xrpm" ] + then + patchelf --remove-needed libsasl2.so bin/mongod + patchelf --remove-needed libsasl2.so bin/mongo + fi + } + function replace_libs { local elf_path=$1 for libpath_sorted in ${LIBPATH}; do for elf in $(find ${elf_path} -maxdepth 1 -exec file {} \; | grep 'ELF ' | cut -d':' -f1); do - LDD=$(ldd ${elf} | grep ${libpath_sorted} | head -n1 | awk '{print $1}') + LDD=$(ldd ${elf} | grep ${libpath_sorted}|head -n1|awk '{print $1}') lib_realpath_basename="$(basename $(readlink -f ${libpath_sorted}))" lib_without_version_suffix="$(echo ${lib_realpath_basename} | awk -F"." 'BEGIN { OFS = "." }{ print $1, $2}')" - if [[ ! -z $LDD ]]; then + if [[ ! -z $LDD ]]; then echo "Replacing lib ${lib_realpath_basename} to ${lib_without_version_suffix} for ${elf}" patchelf --replace-needed ${LDD} ${lib_without_version_suffix} ${elf} fi @@ -1023,6 +1260,9 @@ build_tarball() { replace_libs ${DIR} done + # Use system libsasl2 for some binaries + fix_sasl_lib + # Create and replace by sparse file to reduce size create_sparse bin replace_binaries bin @@ -1033,8 +1273,16 @@ build_tarball() { done } + PSMDIR_ORIGINAL=${PSMDIR} + + if [[ x"${OS}" == "xrpm" ]]; then + GLIBC_VER=".ol"${RHEL} + else + GLIBC_VER="."${DEBIAN} + fi + cd ${PSMDIR_ABS} - mv ${PSMDIR} ${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX} + mv ${PSMDIR_ORIGINAL} ${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX} if [[ ${DEBUG} = 0 ]]; then cp -r ${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX} ${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}-minimal @@ -1051,15 +1299,15 @@ build_tarball() { tar --owner=0 --group=0 -czf ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}.tar.gz ${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX} DIRNAME="tarball" if [ "${DEBUG}" = 1 ]; then - DIRNAME="debug" + DIRNAME="debug" fi mkdir -p ${WORKDIR}/${DIRNAME} mkdir -p ${CURDIR}/${DIRNAME} cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}.tar.gz ${WORKDIR}/${DIRNAME} cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}.tar.gz ${CURDIR}/${DIRNAME} if [[ ${DEBUG} = 0 ]]; then - cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}-minimal.tar.gz ${WORKDIR}/${DIRNAME} - cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}-minimal.tar.gz ${CURDIR}/${DIRNAME} + cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}-minimal.tar.gz ${WORKDIR}/${DIRNAME} + cp ${WORKDIR}/${PSMDIR}-${ARCH}${GLIBC_VER}${TARBALL_SUFFIX}-minimal.tar.gz ${CURDIR}/${DIRNAME} fi } @@ -1082,9 +1330,10 @@ INSTALL=0 RPM_RELEASE=1 DEB_RELEASE=1 REVISION=0 +REVISION_LONG=0 BRANCH="master" REPO="https://github.com/percona/percona-server-mongodb.git" -PSM_VER="5.0.0" +PSM_VER="8.3.0" PSM_RELEASE="1" MONGO_TOOLS_TAG="master" PRODUCT=percona-server-mongodb @@ -1095,7 +1344,13 @@ RELEASE=${PSM_RELEASE} PRODUCT_FULL=${PRODUCT}-${PSM_VER}-${PSM_RELEASE} PSM_BRANCH=${BRANCH} if [ ${DEBUG} = 1 ]; then - TARBALL=1 + TARBALL=1 +fi +if test -e "/proc/cpuinfo" +then + NCPU="$(grep -c ^processor /proc/cpuinfo)" +else + NCPU=4 fi check_workdir From 6a9ce4afd052f034f1fa8e655e9283cfd78c8755 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnychenko Date: Mon, 9 Mar 2026 13:49:27 +0200 Subject: [PATCH 2/5] PSMDB-1946 psmdb-83: cherry-pick build changes from 8.0 --- percona-packaging/conf/mongod.conf | 4 - percona-packaging/conf/mongod.service | 6 +- .../percona-server-mongodb-enable-auth.sh | 95 +++++----- .../conf/percona-server-mongodb-helper.sh | 41 +++-- percona-packaging/debian/changelog | 4 +- percona-packaging/debian/control | 30 +++- .../percona-server-mongodb-mongos.postinst | 17 ++ .../percona-server-mongodb-mongos.postrm | 31 ++++ .../percona-server-mongodb-mongos.preinst | 14 ++ .../percona-server-mongodb-server.conffiles | 4 +- .../percona-server-mongodb-server.postinst | 14 ++ .../percona-server-mongodb-server.postrm | 11 +- .../debian/percona-server-mongodb-shell.dirs | 2 +- .../percona-server-mongodb-shell.manpages | 2 +- percona-packaging/debian/rules | 34 ++-- .../psmdb_sbom/psmdb_generate_sbom.sh | 163 +++++++++++++++++ .../percona-server-mongodb.spec.template | 169 +++++++++++++----- percona-packaging/scripts/test-build.sh | 10 +- 18 files changed, 497 insertions(+), 154 deletions(-) create mode 100644 percona-packaging/debian/percona-server-mongodb-mongos.postinst create mode 100644 percona-packaging/debian/percona-server-mongodb-mongos.postrm create mode 100644 percona-packaging/debian/percona-server-mongodb-mongos.preinst create mode 100644 percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh diff --git a/percona-packaging/conf/mongod.conf b/percona-packaging/conf/mongod.conf index 6b1a5106f2524..d90d0fdead9a5 100644 --- a/percona-packaging/conf/mongod.conf +++ b/percona-packaging/conf/mongod.conf @@ -39,10 +39,6 @@ systemLog: logAppend: true path: /var/log/mongodb/mongod.log -processManagement: - fork: true - pidFilePath: /var/run/mongod.pid - # network interfaces net: port: 27017 diff --git a/percona-packaging/conf/mongod.service b/percona-packaging/conf/mongod.service index 998fd6b052091..9c50c88a6d1bb 100644 --- a/percona-packaging/conf/mongod.service +++ b/percona-packaging/conf/mongod.service @@ -3,7 +3,6 @@ Description=High-performance, schema-free document-oriented database After=time-sync.target network.target [Service] -Type=forking User=mongod Group=mongod PermissionsStartOnly=true @@ -13,9 +12,10 @@ LimitAS=infinity LimitNOFILE=64000 LimitNPROC=64000 EnvironmentFile=-/etc/@@LOCATION@@/mongod +Environment="GLIBC_TUNABLES=glibc.pthread.rseq=0" +Environment="MONGODB_CONFIG_OVERRIDE_NOFORK=1" ExecStartPre=/usr/bin/percona-server-mongodb-helper.sh -ExecStart=/usr/bin/env bash -c "${NUMACTL} /usr/bin/mongod ${OPTIONS} > ${STDOUT} 2> ${STDERR}" -PIDFile=/var/run/mongod.pid +ExecStart=/usr/bin/env bash -c "${NUMACTL} /usr/bin/mongod ${OPTIONS}" [Install] WantedBy=multi-user.target diff --git a/percona-packaging/conf/percona-server-mongodb-enable-auth.sh b/percona-packaging/conf/percona-server-mongodb-enable-auth.sh index 4d66cd07c1bd9..50d369058fe76 100755 --- a/percona-packaging/conf/percona-server-mongodb-enable-auth.sh +++ b/percona-packaging/conf/percona-server-mongodb-enable-auth.sh @@ -13,7 +13,7 @@ CONF_FORMAT="yaml" AUTH_SECTION_EXISTS=0 PARAM_USERNAME=0 -SCRIPT_PWD=$(cd $(dirname $0) && pwd) +SCRIPT_PWD=$(cd `dirname $0` && pwd) MONGO_CLIENT_BIN="${SCRIPT_PWD}/mongosh" if [ "${SCRIPT_PWD}" = "/usr/bin" ]; then @@ -23,7 +23,7 @@ else fi usage() { - echo "Usage: $(basename $0) [-h] [-q] [-c ConfigFileName] [-u Username] [-p Password]" + echo "Usage: `basename $0` [-h] [-q] [-c ConfigFileName] [-u Username] [-p Password]" echo echo " This script is used to enable authentication in Percona Server for MongoDB automatically." echo " User 'dba' (or provided with the '-u' argument) with role 'root' will be created with autogenerated password (or provided with the '-p' argument) and the service will be restarted." @@ -37,49 +37,44 @@ usage() { } while getopts ":hqc:u:p:" arg; do - case $arg in + case $arg in c) # Specify CONF value. - CONF=${OPTARG} - ;; + CONF=${OPTARG} + ;; q) # quiet mode. - QUIET=1 - ;; + QUIET=1 + ;; u) # Username to use instead of 'dba'. - USERNAME="${OPTARG}" - PARAM_USERNAME=1 - ;; + USERNAME="${OPTARG}" + PARAM_USERNAME=1 + ;; p) # Password to use instead of auto generation. - PASSWORD="${OPTARG}" - ;; + PASSWORD="${OPTARG}" + ;; h) # Display help. - usage - exit 0 - ;; - *) ;; - esac + usage + exit 0 + ;; + *) + ;; + esac done [[ -z "$CONF" ]] && CONF='/etc/mongod.conf' -[[ -f "$CONF" ]] || { - echo "Configuration file '$CONF' does not exist" >&2 - exit 1 -} +[[ -f "$CONF" ]] || { echo "Configuration file '$CONF' does not exist" >&2; exit 1; } -[[ "$EUID" -ne 0 ]] && { - echo "Please run as root" >&2 - exit 1 -} +[[ "$EUID" -ne 0 ]] && { echo "Please run as root" >&2; exit 1; } [[ -z "$USERNAME" || "$USERNAME" = "root" && "$PARAM_USERNAME" = 0 ]] && USERNAME='dba' -[[ -z "$PASSWORD" ]] && PASSWORD="$(tr -dc 'a-zA-Z0-9' indent) {delete vname[i]}} @@ -106,7 +101,7 @@ get_value_from_yaml() { break fi done - done <<<"$array" + done <<< "$array" echo $result } @@ -137,10 +132,10 @@ add_value_to_yaml() { sed -i "s/security:/security:\n authorization: enabled/" $CONF fi else - delim=$(grep '## Enterprise-Only Options:' $CONF) + delim=$( grep '## Enterprise-Only Options:' $CONF ) if [[ $delim == '' ]]; then - echo "security:" >>$CONF - echo " authorization: enabled" >>$CONF + echo "security:" >> $CONF + echo " authorization: enabled" >> $CONF else sed -i "s/## Enterprise-Only Options:/security:\n authorization: enabled\n## Enterprise-Only Options:/" $CONF fi @@ -153,8 +148,8 @@ add_user_to_mongo() { port="$(get_value_from_yaml net port)" user="$USERNAME" password="$PASSWORD" - echo "db.createUser({user: \"$user\", pwd: \"$password\", roles: [ \"root\" ] });" | ${MONGO_CLIENT_BIN} admin --port ${port} --eval >/dev/null 2>&1 - if [ $? -eq 0 ]; then + echo "db.createUser({user: \"$user\", pwd: \"$password\", roles: [ \"root\" ] });" | ${MONGO_CLIENT_BIN} admin --port ${port} --eval > /dev/null 2>&1 + if [ $? -eq 0 ];then echo -e "User has been created successfully!\nUser:${user}\nPassword:${password}" else echo "ERROR! User cannot be added!" @@ -166,15 +161,15 @@ add_user_to_mongo() { if [ ! -f /tmp/mongodb_create.lock ]; then AUTH_ENABLED=0 auth_res=$(get_value_from_yaml security auth) - if [[ $auth_res == enabled ]]; then + if [[ $auth_res == enabled ]]; then AUTH_ENABLED=1 - elif [[ $auth_res == disabled ]]; then + elif [[ $auth_res == disabled ]]; then AUTH_ENABLED=0 AUTH_SECTION_EXISTS=1 - elif [[ $(egrep '^auth=1' $CONF) ]]; then + elif [[ `egrep '^auth=1' $CONF` ]]; then AUTH_ENABLED=1 CONF_FORMAT="conf" - elif [[ $(egrep '^auth=0' $CONF) ]]; then + elif [[ `egrep '^auth=0' $CONF` ]]; then AUTH_ENABLED=0 AUTH_SECTION_EXISTS=1 fi @@ -192,16 +187,16 @@ if [ ! -f /tmp/mongodb_create.lock ]; then replsetname_res=$(get_value_from_yaml replication replSetName) keyfile_res=$(get_value_from_yaml security keyFile) if [[ $replsetname_res != 0 ]]; then - # replication.replsetName is specified in the config - if [[ $keyfile_res == 0 ]]; then - # security.keyFile does not exist in the config - echo "ERROR! You need to configure a shared keyfile on all members before enabling authentication in a replica set!" - exit 1 - elif [[ ! -f "$keyfile_res" ]]; then - # security.keyFile exists but the file is absent - echo "ERROR! The configured keyfile $keyfile_res doesn't exist. Cannot enable authentication in a replica set." - exit 1 - fi + # replication.replsetName is specified in the config + if [[ $keyfile_res == 0 ]]; then + # security.keyFile does not exist in the config + echo "ERROR! You need to configure a shared keyfile on all members before enabling authentication in a replica set!" + exit 1 + elif [[ ! -f "$keyfile_res" ]]; then + # security.keyFile exists but the file is absent + echo "ERROR! The configured keyfile $keyfile_res doesn't exist. Cannot enable authentication in a replica set." + exit 1 + fi fi touch /tmp/mongodb_create.lock started=$(pgrep mongod | wc -l) diff --git a/percona-packaging/conf/percona-server-mongodb-helper.sh b/percona-packaging/conf/percona-server-mongodb-helper.sh index 8828c2553ff29..6b0bf36fb85db 100755 --- a/percona-packaging/conf/percona-server-mongodb-helper.sh +++ b/percona-packaging/conf/percona-server-mongodb-helper.sh @@ -2,32 +2,38 @@ # PATH="${PATH}:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin" # -touch /var/run/mongod.pid touch /var/log/@@LOGDIR@@/mongod.{stdout,stderr} -chown mongod:mongod /var/run/mongod.pid chown -R mongod:mongod /var/log/@@LOGDIR@@ # KTHP=/sys/kernel/mm/transparent_hugepage # [ -z "${CONF}" ] && CONF=/etc/mongod.conf # -print_error() { - echo " * Error disabling Transparent Huge pages, exiting" - exit 1 +print_error(){ + echo " * Error enabling Transparent Huge pages, exiting" + exit 1 } # + +if grep -q "pidFilePath" /etc/mongod.conf; then + touch /var/run/mongod.pid + chown mongod:mongod /var/run/mongod.pid +fi + . /etc/@@LOCATION@@/mongod DAEMON_OPTS="${OPTIONS}" # # Handle NUMA access to CPUs (SERVER-3574) # This verifies the existence of numactl as well as testing that the command works NUMACTL_ARGS="--interleave=all" -if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null; then +if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null +then NUMACTL="numactl $NUMACTL_ARGS" DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"} NUMA_CONF=$(grep -c 'NUMACTL="numactl --interleave=all"' /etc/@@LOCATION@@/mongod) - if [ $NUMA_CONF = 0 ]; then - echo 'NUMACTL="numactl --interleave=all"' >>/etc/@@LOCATION@@/mongod + if [ $NUMA_CONF = 0 ] + then + echo 'NUMACTL="numactl --interleave=all"' >> /etc/@@LOCATION@@/mongod fi else NUMACTL="" @@ -39,13 +45,14 @@ defaults=$(echo "${OPTIONS}" | egrep -o 'storageEngine.*' | tr -d '[[:blank:]]' config=$(egrep -o '^[[:blank:]]+engine.*' ${CONF} | tr -d '[[:blank:]]' | awk -F':' '{print $NF}' 2>/dev/null) # if [ -n "${defaults}" ] && [ -n "${config}" ]; then # engine is set in 2 places - if [ "${defaults}" == "${config}" ]; then # it's OK - echo " * Warning, engine is set both in defaults file and mongod.conf!" - else - echo " * Error, different engines are set in the same time!" - exit 1 - fi + if [ "${defaults}" == "${config}" ]; then # it's OK + echo " * Warning, engine is set both in defaults file and mongod.conf!" + else + echo " * Error, different engines are set in the same time!" + exit 1 + fi fi -# disable THP -fgrep '[always]' ${KTHP}/enabled >/dev/null 2>&1 && (echo never >${KTHP}/enabled 2>/dev/null || print_error) || true -fgrep '[always]' ${KTHP}/defrag >/dev/null 2>&1 && (echo never >${KTHP}/defrag 2>/dev/null || print_error) || true +# enable THP +fgrep '[always]' ${KTHP}/enabled > /dev/null 2>&1 || (echo always > ${KTHP}/enabled 2> /dev/null || print_error) || true +fgrep '[defer+madvise]' ${KTHP}/defrag > /dev/null 2>&1 || (echo defer+madvise > ${KTHP}/defrag 2> /dev/null || print_error) || true +fgrep '0' ${KTHP}/khugepaged/max_ptes_none > /dev/null 2>&1 || (echo 0 > ${KTHP}/khugepaged/max_ptes_none 2> /dev/null || print_error) || true diff --git a/percona-packaging/debian/changelog b/percona-packaging/debian/changelog index 0a5b6f08e3c35..8cf9a3901177e 100644 --- a/percona-packaging/debian/changelog +++ b/percona-packaging/debian/changelog @@ -1,5 +1,5 @@ -percona-server-mongodb (4.4.0) UNRELEASED; urgency=medium +percona-server-mongodb (8.3.0) UNRELEASED; urgency=medium * Updated to next upstream release. - -- Oleksandr Miroshnychenko Thu, 27 Feb 2020 12:20:22 +0600 + -- Oleksandr Miroshnychenko Mon, 9 Mar 2026 12:45:11 +0200 diff --git a/percona-packaging/debian/control b/percona-packaging/debian/control index c31dc3ff774bc..94e50e95f47ba 100644 --- a/percona-packaging/debian/control +++ b/percona-packaging/debian/control @@ -7,9 +7,12 @@ Build-Depends: debhelper (>= 9), debconf, libbz2-dev, libsnappy-dev, pkg-config, Package: percona-server-mongodb +Provides: mongodb-org, mongodb-enterprise Architecture: any -Breaks: percona-server-mongodb (< 4.4.0), percona-server-mongodb-32, percona-server-mongodb-34, percona-server-mongodb-36, mongodb-org, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen -Depends: ${shlibs:Depends}, ${misc:Depends}, percona-server-mongodb-mongos (= ${source:Version}), percona-server-mongodb-shell (= ${source:Version}), percona-server-mongodb-server (= ${source:Version}), percona-server-mongodb-tools (= ${source:Version}), libsasl2-modules-gssapi-mit +Breaks: percona-server-mongodb (< 4.4.0), percona-server-mongodb-32, percona-server-mongodb-34, percona-server-mongodb-36, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-nightly, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-database-tools +Depends: ${shlibs:Depends}, ${misc:Depends}, percona-server-mongodb-mongos (= ${source:Version}), percona-mongodb-mongosh, percona-server-mongodb-server (= ${source:Version}), percona-server-mongodb-tools (= ${source:Version}), libsasl2-modules-gssapi-mit +Conflicts: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg +Replaces: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg Description: This metapackage will install the mongo shell, import/export tools, other client utilities, server software, default configuration, and init.d scripts. This package contains high-performance MongoDB replacement from Percona - Percona Server for MongoDB. Percona Server for MongoDB is built for scalability, performance and high availability, scaling from single server deployments to large, complex multi-site architectures. @@ -32,29 +35,38 @@ Description: This metapackage will install the mongo shell, import/export tools, * Aggregation Framework & Native MapReduce Package: percona-server-mongodb-mongos +Provides: mongodb-org-mongos, mongodb-enterprise-mongos Architecture: any -Breaks: percona-server-mongodb-mongos (< 4.4.0), percona-server-mongodb-32-mongos, percona-server-mongodb-34-mongos, percona-server-mongodb-36-mongos, mongodb-org-mongos, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen -Depends: ${shlibs:Depends}, ${misc:Depends} +Breaks: percona-server-mongodb-mongos (< 4.4.0), percona-server-mongodb-32-mongos, percona-server-mongodb-34-mongos, percona-server-mongodb-36-mongos, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-nightly, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-database-tools +Depends: ${shlibs:Depends}, ${misc:Depends}, percona-telemetry-agent +Conflicts: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg +Replaces: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg Description: This package contains mongos - the Percona Server for MongoDB sharded cluster query router Percona Server for MongoDB is a drop-in high-performance replacement for MongoDB from Percona Package: percona-server-mongodb-server +Provides: mongodb-org-server, mongodb-enterprise-server Architecture: any -Breaks: percona-server-mongodb-server (< 4.4.0), percona-server-mongodb-32-server, percona-server-mongodb-34-server, percona-server-mongodb-36-server, mongodb-org-server, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen -Depends: ${shlibs:Depends}, ${misc:Depends}, percona-server-mongodb-shell +Breaks: percona-server-mongodb-server (< 4.4.0), percona-server-mongodb-32-server, percona-server-mongodb-34-server, percona-server-mongodb-36-server, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-nightly, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-database-tools +Depends: ${shlibs:Depends}, ${misc:Depends}, percona-mongodb-mongosh, curl, percona-telemetry-agent +Conflicts: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg +Replaces: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg Description: This package contains the Percona Server for MongoDB server software, default configuration files and init.d scripts Percona Server for MongoDB is a drop-in high-performance replacement for MongoDB from Percona Package: percona-server-mongodb-shell +Provides: mongodb-org-shell, mongodb-enterprise-shell Architecture: any -Breaks: percona-server-mongodb-shell (< 4.4.0), percona-server-mongodb-32-shell, percona-server-mongodb-34-shell, percona-server-mongodb-36-shell, mongodb-org-shell, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen +Breaks: percona-server-mongodb-shell (< 4.4.0), percona-server-mongodb-32-shell, percona-server-mongodb-34-shell, percona-server-mongodb-36-shell, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongod-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-nightly, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-database-tools Depends: ${shlibs:Depends}, ${misc:Depends} Description: This package contains the Percona Server for MongoDB shell Percona Server for MongoDB is a drop-in high-performance replacement for MongoDB from Percona + Package: percona-server-mongodb-tools +Provides: mongodb-org-tools, mongodb-enterprise-tools Architecture: any -Breaks: percona-server-mongodb-tools (< 4.4.0), percona-server-mongodb-32-tools, percona-server-mongodb-34-tools, percona-server-mongodb-36-tools, mongodb-org-tools, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen +Breaks: percona-server-mongodb-tools (< 4.4.0), percona-server-mongodb-32-tools, percona-server-mongodb-34-tools, percona-server-mongodb-36-tools, mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-nightly, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-database-tools Depends: ${shlibs:Depends}, ${misc:Depends} Description: Mongo tools for high-performance MongoDB fork from Percona Percona Server for MongoDB is a drop-in high-performance replacement for MongoDB from Percona @@ -64,6 +76,8 @@ Architecture: any Breaks: percona-server-mongodb-dbg(< 4.4.0), percona-server-mongodb-32-dbg, percona-server-mongodb-34-dbg, percona-server-mongodb-36-dbg Section: debug Depends: percona-server-mongodb (= ${binary:Version}), ${misc:Depends} +Conflicts: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg +Replaces: percona-server-mongodb-pro, percona-server-mongodb-mongos-pro, percona-server-mongodb-server-pro, percona-server-mongodb-pro-dbg Description: Debugging package for Percona Server for MongoDB Percona Server for MongoDB is a drop-in high-performance replacement for MongoDB from Percona diff --git a/percona-packaging/debian/percona-server-mongodb-mongos.postinst b/percona-packaging/debian/percona-server-mongodb-mongos.postinst new file mode 100644 index 0000000000000..7e72b0afe2052 --- /dev/null +++ b/percona-packaging/debian/percona-server-mongodb-mongos.postinst @@ -0,0 +1,17 @@ +#!/bin/bash +# postinst script for Percona Server for MongoDB sharded cluster query router +# +# see: dh_installdeb(1) + + +set -e + +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + +if [ -d /usr/local/percona/telemetry ]; then + install -d -m 2775 -o mongod -g percona-telemetry /usr/local/percona/telemetry/psmdbs +fi + +exit 0 diff --git a/percona-packaging/debian/percona-server-mongodb-mongos.postrm b/percona-packaging/debian/percona-server-mongodb-mongos.postrm new file mode 100644 index 0000000000000..97149f3654205 --- /dev/null +++ b/percona-packaging/debian/percona-server-mongodb-mongos.postrm @@ -0,0 +1,31 @@ +#!/bin/bash +# postrm script for Percona Server for MongoDB sharded cluster query router +# + +set -e + +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + +case "$1" in + + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument '$1'" 1>&2 + exit 1 + ;; + +esac + +if [ "$1" = "remove" ]; then + if [ -d /usr/local/percona/telemetry/psmdbs ]; then + rm -rf /usr/local/percona/telemetry/psmdbs + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/percona-packaging/debian/percona-server-mongodb-mongos.preinst b/percona-packaging/debian/percona-server-mongodb-mongos.preinst new file mode 100644 index 0000000000000..6fd6330b478b2 --- /dev/null +++ b/percona-packaging/debian/percona-server-mongodb-mongos.preinst @@ -0,0 +1,14 @@ +#!/bin/sh +# preinst script for mongos +# +# see: dh_installdeb(1) + +# create a mongodb group and user + +if ! getent passwd mongod >/dev/null 2>&1; then + adduser --system --group mongod +fi + +#DEBHELPER# + +exit 0 diff --git a/percona-packaging/debian/percona-server-mongodb-server.conffiles b/percona-packaging/debian/percona-server-mongodb-server.conffiles index 115b19c18e1e7..69efca73320ed 100644 --- a/percona-packaging/debian/percona-server-mongodb-server.conffiles +++ b/percona-packaging/debian/percona-server-mongodb-server.conffiles @@ -1,2 +1,2 @@ -etc/mongod.conf -etc/default/mongod +/etc/mongod.conf +/etc/default/mongod diff --git a/percona-packaging/debian/percona-server-mongodb-server.postinst b/percona-packaging/debian/percona-server-mongodb-server.postinst index f57feba01aeca..24f151fdecad2 100644 --- a/percona-packaging/debian/percona-server-mongodb-server.postinst +++ b/percona-packaging/debian/percona-server-mongodb-server.postinst @@ -114,4 +114,18 @@ else fi fi +if [ -d /usr/local/percona/telemetry ]; then + install -d -m 2775 -o mongod -g percona-telemetry /usr/local/percona/telemetry/psmdb +fi + +cat << EOF +** Join Percona Squad! ** + +Participate in monthly SWAG raffles, get early access to new product features, +invite-only ”ask me anything” sessions with database performance experts. + +Interested? Fill in the form at https://squad.percona.com/mongodb + +EOF + exit 0 diff --git a/percona-packaging/debian/percona-server-mongodb-server.postrm b/percona-packaging/debian/percona-server-mongodb-server.postrm index f0093a4d6f327..58b68043a680f 100644 --- a/percona-packaging/debian/percona-server-mongodb-server.postrm +++ b/percona-packaging/debian/percona-server-mongodb-server.postrm @@ -25,6 +25,12 @@ case "$1" in esac +if [ "$1" = "remove" ]; then + if [ -d /usr/local/percona/telemetry/psmdb ]; then + rm -rf /usr/local/percona/telemetry/psmdb + fi +fi + if [ "$1" = "purge" ]; then db_input high percona-server-mongodb-server/postrm_remove_databases || true db_go || true @@ -32,9 +38,12 @@ if [ "$1" = "purge" ]; then if [ "$RET" = "true" ]; then rm -rf /var/lib/mongodb rm -rf /var/log/mongodb - rm -f /var/run/mongod.pid + rm -rf /var/run/mongod.pid userdel mongod || true fi + if [ -d /usr/local/percona/telemetry/psmdb ]; then + rm -rf /usr/local/percona/telemetry/psmdb + fi fi #DEBHELPER# diff --git a/percona-packaging/debian/percona-server-mongodb-shell.dirs b/percona-packaging/debian/percona-server-mongodb-shell.dirs index 1e881eda3a544..e77248175524d 100644 --- a/percona-packaging/debian/percona-server-mongodb-shell.dirs +++ b/percona-packaging/debian/percona-server-mongodb-shell.dirs @@ -1 +1 @@ -usr/bin \ No newline at end of file +usr/bin diff --git a/percona-packaging/debian/percona-server-mongodb-shell.manpages b/percona-packaging/debian/percona-server-mongodb-shell.manpages index 629ea7085f5b2..ee0cbda67e0cc 100644 --- a/percona-packaging/debian/percona-server-mongodb-shell.manpages +++ b/percona-packaging/debian/percona-server-mongodb-shell.manpages @@ -1 +1 @@ -manpages/mongo.1 \ No newline at end of file +manpages/mongo.1 diff --git a/percona-packaging/debian/rules b/percona-packaging/debian/rules index 8bd6a932f03d2..2cdb7efd42b34 100755 --- a/percona-packaging/debian/rules +++ b/percona-packaging/debian/rules @@ -3,7 +3,7 @@ export DH_VERBOSE=1 export DEB_BUILD_HARDENING=1 export NJOBS=$(shell grep -c processor /proc/cpuinfo) -export PSM_TARGETS=install-mongod install-mongos install-mongo install-perconadecrypt install-mongobridge +export PSM_TARGETS=install-mongod install-mongos install-mongo install-perconadecrypt build/install/bin/mongobridge export PSMSRC=$(CURDIR) export MONGOTOOLS=bsondump mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop export INSTALLDIR=/usr/local @@ -11,26 +11,30 @@ export TOOLS_TAGS=ssl sasl export PORTABLE=1 export USE_SSE=1 export PATH := /usr/local/go/bin:$(PATH) +export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 -B/opt/mongodbtoolchain/v4/bin" + +$(info GLIBC_TUNABLES is $(GLIBC_TUNABLES)) CC = gcc-5 CXX = g++-5 # %: dh $@ +override_dh_builddeb: + dh_builddeb -- -Zgzip + override_dh_auto_clean: dh_auto_clean rm -fr $(PSMSRC)/bin + cd $(PSMSRC); \ + bazel clean --expunge || true + rm -rf $(PSMSRC)/bin build resmoke.ini #rm -fr $(INSTALLDIR) - buildscripts/scons.py CC=$(CC) CXX=$(CXX) -C $(PSMSRC) -c --disable-warnings-as-errors --audit --release --ssl --opt -j$(NJOBS) --use-sasl-client CPPPATH=$(INSTALLDIR)/include \ - LIBPATH=$(INSTALLDIR)/lib LINKFLAGS="$(LINKFLAGS)" --wiredtiger --inmemory --hotbackup $(PSM_TARGETS) || exit $? rm -fr build resmoke.ini find $(PSMSRC) -name '*.pyc' -delete -# Finally PSfMDB percona-server-mongodb: - buildscripts/scons.py CC=${CC} CXX=${CXX} --disable-warnings-as-errors --audit --release --ssl --opt=on -j$(NJOBS) \ - --use-sasl-client --wiredtiger --inmemory --hotbackup \ - CPPPATH=${INSTALLDIR}/include LIBPATH=${INSTALLDIR}/lib LINKFLAGS="${LINKFLAGS}" ${PSM_TARGETS} || exit $? + bazel build --config=psmdb_opt_release --define=MONGO_VERSION=$(PSMDB_VERSION) --define=GIT_COMMIT_HASH=$(PSMDB_GIT_HASH) install-dist-test compile-mongo-tools: mkdir $(PSMSRC)/bin || true; @@ -41,23 +45,25 @@ compile-mongo-tools: export PATH="/usr/local/go/bin:$(PATH):$(GOPATH)"; \ export GOBINPATH="/usr/local/go/bin" cd $(PSMSRC)/../src/github.com/mongodb/mongo-tools; \ - sed -i '12d' buildscript/build.go; \ - sed -i '167,176d' buildscript/build.go; \ + sed -i '14d' buildscript/build.go; \ + sed -i '226,234d' buildscript/build.go; \ sed -i "s:versionStr,:\"$(PSMDB_TOOLS_REVISION)\",:" buildscript/build.go; \ sed -i "s:gitCommit):\"$(PSMDB_TOOLS_COMMIT_HASH)\"):" buildscript/build.go; \ ./make build; cp -av $(PSMSRC)/../src/github.com/mongodb/mongo-tools/bin/* $(PSMSRC)/bin; \ cd $(PSMSRC); +# Finally PSMDB + build: percona-server-mongodb compile-mongo-tools override_dh_auto_install: dh_auto_install - cp -av build/install/bin/mongos debian/percona-server-mongodb-mongos/usr/bin/mongos - cp -av build/install/bin/mongo debian/percona-server-mongodb-shell/usr/bin/mongo - cp -av build/install/bin/mongod debian/percona-server-mongodb-server/usr/bin/mongod - cp -av build/install/bin/perconadecrypt debian/percona-server-mongodb-server/usr/bin - cp -av build/install/bin/mongobridge debian/percona-server-mongodb-server/usr/bin/mongobridge + cp -aLv bazel-bin/install/bin/mongos debian/percona-server-mongodb-mongos/usr/bin/mongos + cp -aLv bazel-bin/install/bin/mongo debian/percona-server-mongodb-shell/usr/bin/mongo + cp -aLv bazel-bin/install/bin/mongod debian/percona-server-mongodb-server/usr/bin/mongod + cp -aLv bazel-bin/install/bin/perconadecrypt debian/percona-server-mongodb-server/usr/bin + cp -aLv bazel-bin/install/bin/mongobridge debian/percona-server-mongodb-server/usr/bin/mongobridge cp -av debian/percona-server-mongodb-helper.sh debian/percona-server-mongodb-server/usr/bin cp -av debian/percona-server-mongodb-enable-auth.sh debian/percona-server-mongodb-server/usr/bin cp -av debian/mongod.conf debian/percona-server-mongodb-server/etc/mongod.conf diff --git a/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh b/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh new file mode 100644 index 0000000000000..b10845ad60cec --- /dev/null +++ b/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh @@ -0,0 +1,163 @@ +#!/bin/bash +set -euo pipefail + +shell_quote_string() { + echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' +} + +usage () { + cat </dev/null; then + curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin +fi + +mkdir -p $CWD/psmdb_sbom + +# Generate full SBOM using db fallback +echo "Generating full SBOM via db..." +syft dir:/ --output cyclonedx-json > sbom-full-db.json + +# Filter PostgreSQL ${PSMDB_VERSION} components and preserve SBOM structure +jq '{ + "$schema": ."$schema", + "bomFormat": .bomFormat, + "specVersion": .specVersion, + "serialNumber": .serialNumber, + "version": .version, + "metadata": .metadata, + "components": [.components[] | select(.name | test("mongodb|percona"; "i"))] +}' sbom-full-db.json > $CWD/psmdb_sbom/sbom-percona-server-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json + +echo "✅ SBOM for Percona PostgreSQL ${PSMDB_VERSION} written to: $CWD/psmdb_sbom/sbom-percona-server-mongodb-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json" diff --git a/percona-packaging/redhat/percona-server-mongodb.spec.template b/percona-packaging/redhat/percona-server-mongodb.spec.template index 3c58ddd81a5c5..cd6740e6a1513 100644 --- a/percona-packaging/redhat/percona-server-mongodb.spec.template +++ b/percona-packaging/redhat/percona-server-mongodb.spec.template @@ -1,5 +1,26 @@ +%global __brp_strip_args --strip-debug +%global __find_debuginfo /usr/lib/rpm/find-debuginfo.sh -g + +# Disable the addition of mini debuginfo and gdb index options +%global _include_minidebuginfo %{nil} +%undefine _include_gdb_index + +# Optionally disable source extraction to avoid empty debugsourcefiles.list errors +%global __find_debugsource %{nil} + # %define mongo_home /var/lib/mongo +%define psmdb_telemetry /usr/local/percona/telemetry/psmdb +%define psmdbs_telemetry /usr/local/percona/telemetry/psmdbs + +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 8 +%undefine _debugsource_packages +%endif + +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 8 +%global _find_debuginfo_dwz_opts %{nil} +%endif + # Name: percona-server-mongodb Version: @@VERSION@@ @@ -17,8 +38,9 @@ Source4: percona-server-mongodb-helper.sh Source5: mongod.init Source6: mongod.pp Source7: percona-server-mongodb-enable-auth.sh +Source999: call-home.sh -%if 0%{?rhel} > 6 +%if 0%{?amzn} == 2023 || 0%{?rhel} > 6 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -33,27 +55,24 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release} %undefine _missing_build_ids_terminate_build %define _unpackaged_files_terminate_build 0 -%if 0%{?rhel} > 6 -%global _dwz_low_mem_die_limit 0 -%endif - %define src_dir @@SRC_DIR@@ BuildRequires: gcc, make, cmake, gcc-c++, openssl-devel, cyrus-sasl-devel BuildRequires: snappy-devel, zlib-devel, bzip2-devel, libpcap-devel, openldap-devel, xz-devel +%if 0%{?rhel} == 7 BuildRequires: /usr/bin/scons - -# %if 0%{?rhel} >= 6 -# BuildRequires: policycoreutils-python -# %endif +%endif +#%if 0%{?rhel} >= 8 +#BuildRequires: /usr/bin/scons-3 +#%endif Requires: %{name}-mongos = %{version}-%{release} Requires: %{name}-server = %{version}-%{release} -Requires: %{name}-shell = %{version}-%{release} Requires: %{name}-tools = %{version}-%{release} -Requires: numactl, openldap, cyrus-sasl-gssapi +Requires: percona-mongodb-mongosh +Requires: numactl, openldap, cyrus-sasl-gssapi, curl -Conflicts: Percona-Server-MongoDB < 4.4.0 +Conflicts: Percona-Server-MongoDB < 8.0.0 Conflicts: Percona-Server-MongoDB-32 Percona-Server-MongoDB-34 Percona-Server-MongoDB-36 mongodb-org %description @@ -78,43 +97,50 @@ This metapackage will install the mongo shell, import/export tools, other client %package mongos Group: Applications/Databases Summary: Percona Server for MongoDB sharded cluster query router +%if 0%{?amzn} == 2023 || 0%{?rhel} > 7 +Requires: percona-telemetry-agent +%endif +Conflicts: Percona-Server-MongoDB-mongos Percona-Server-MongoDB-32-mongos Percona-Server-MongoDB-34-mongos Percona-Server-MongoDB-36-mongos mongodb-org-mongos %description mongos This package contains mongos - the Percona Server for MongoDB sharded cluster query router -Conflicts: Percona-Server-MongoDB-mongos Percona-Server-MongoDB-32-mongos Percona-Server-MongoDB-34-mongos Percona-Server-MongoDB-36-mongos mongodb-org-mongos %package server Group: Applications/Databases Summary: Percona Server for MongoDB database server Requires: policycoreutils -Requires: %{name}-shell = %{version}-%{release} +Requires: percona-mongodb-mongosh +%if 0%{?amzn} == 2023 || 0%{?rhel} > 7 +Requires: percona-telemetry-agent +%endif +Conflicts: Percona-Server-MongoDB-server Percona-Server-MongoDB-32-server Percona-Server-MongoDB-34-server Percona-Server-MongoDB-36-server mongodb-org-server %description server This package contains the Percona Server for MongoDB server software, default configuration files and init.d scripts -Conflicts: Percona-Server-MongoDB-server Percona-Server-MongoDB-32-server Percona-Server-MongoDB-34-server Percona-Server-MongoDB-36-server mongodb-org-server %package shell Group: Applications/Databases Summary: Percona Server for MongoDB shell client Requires: cyrus-sasl-plain +Conflicts: Percona-Server-MongoDB-shell Percona-Server-MongoDB-32-shell Percona-Server-MongoDB-34-shell Percona-Server-MongoDB-36-shell mongodb-org-shell %description shell This package contains the Percona Server for MongoDB shell -Conflicts: Percona-Server-MongoDB-shell Percona-Server-MongoDB-32-shell Percona-Server-MongoDB-34-shell Percona-Server-MongoDB-36-shell mongodb-org-shell %package tools Group: Applications/Databases Summary: The tools package for Percona Server for MongoDB +Conflicts: Percona-Server-MongoDB-tools Percona-Server-MongoDB-32-tools Percona-Server-MongoDB-34-tools Percona-Server-MongoDB-36-tools mongodb-org-tools mongodb-database-tools %description tools This package contains various tools from MongoDB project, recompiled for Percona Server for MongoDB -Conflicts: Percona-Server-MongoDB-tools Percona-Server-MongoDB-32-tools Percona-Server-MongoDB-34-tools Percona-Server-MongoDB-36-tools mongodb-org-tools %prep %setup -q -n %{src_dir} +bazel clean --expunge || true %build export CC=${CC:-gcc} export CXX=${CXX:-g++} -export PSM_TARGETS="install-mongod install-mongos install-mongo install-perconadecrypt install-mongobridge" +export PSM_TARGETS="install-mongod install-mongos install-mongo install-perconadecrypt build/install/bin/mongobridge" export INSTALLDIR=$RPM_BUILD_DIR/install export INSTALLDIR_AWS=$RPM_BUILD_DIR/install_aws export AWS_LIBS="/usr/local" @@ -122,6 +148,12 @@ export TOOLS_TAGS="ssl sasl" export PORTABLE=1 export USE_SSE=1 export PATH=/usr/local/go/bin:$PATH +%if 0%{?amzn} == 2023 +export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1" +%else +export OPT_LINKFLAGS="${LINKFLAGS} -Wl,--build-id=sha1 -B/opt/mongodbtoolchain/v4/bin" +%endif +export GLIBC_TUNABLES=${GLIBC_TUNABLES} export PATH=/usr/local/go/bin:${PATH} export GOROOT="/usr/local/go/" @@ -132,11 +164,11 @@ export GOBINPATH="/usr/local/go/bin" #aws-sdk-cpp pushd $RPM_BUILD_DIR/%{src_dir}/aws-sdk-cpp pushd build -%if 0%{?rhel} >= 7 - cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" -DAUTORUN_UNIT_TESTS=OFF cmake --build . --target install %else - cmake3 CC=${CC} CXX=${CXX} .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" + cmake3 CC=${CC} CXX=${CXX} .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${INSTALLDIR_AWS}" -DAUTORUN_UNIT_TESTS=OFF cmake3 --build . --target install %endif @@ -149,12 +181,21 @@ mv ${INSTALLDIR_AWS}/lib*/* ${INSTALLDIR}/lib/ # Build PSfMDB with SCons pushd $RPM_BUILD_DIR/%{src_dir} -buildscripts/scons.py CC=${CC} CXX=${CXX} --disable-warnings-as-errors --audit --release --ssl --opt=on \ -%{?_smp_mflags} --use-sasl-client CPPPATH=${INSTALLDIR}/include LIBPATH="${INSTALLDIR}/lib ${AWS_LIBS}/lib ${AWS_LIBS}/lib64" \ ---wiredtiger --inmemory --hotbackup ${PSM_TARGETS} || exit $? +%if 0%{?amzn} == 2023 +poetry install --no-root --sync +%else +poetry env use /opt/mongodbtoolchain/v4/bin/python3 +poetry install --no-root --sync +%endif +bazel build --config=psmdb_opt_release --define=MONGO_VERSION=%{version}-@@RELEASE@@ --define=GIT_COMMIT_HASH=@@PSMDB_GIT_HASH@@ install-dist-test rm -fr resmoke.ini popd +#dirty hack for centos:7 + rpm 4.11(rpmlib absence of (LargeFiles) +%if 0%{?rhel} == 7 +eu-strip build/install/bin/mongod +%endif + # Mongo Tools compilation mkdir -p $RPM_BUILD_DIR/%{src_dir}/bin pushd $RPM_BUILD_DIR/ @@ -167,8 +208,8 @@ mkdir -p $GOPATH/src/github.com/mongodb cp -r $RPM_BUILD_DIR/%{src_dir}/mongo-tools ${GOPATH}/src/github.com/mongodb pushd ${GOPATH}/src/github.com/mongodb/mongo-tools . ./set_tools_revision.sh -sed -i '12d' buildscript/build.go -sed -i '167,176d' buildscript/build.go +sed -i '14d' buildscript/build.go +sed -i '226,234d' buildscript/build.go sed -i "s:versionStr,:\"$PSMDB_TOOLS_REVISION\",:" buildscript/build.go sed -i "s:gitCommit):\"$PSMDB_TOOLS_COMMIT_HASH\"):" buildscript/build.go ./make build @@ -196,7 +237,7 @@ install -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/mongod.conf sed -i 's|/var/lib/mongodb|/var/lib/mongo|' %{buildroot}/%{_sysconfdir}/mongod.conf sed -i 's|/var/log/mongodb/mongod.log|/var/log/mongo/mongod.log|' %{buildroot}/%{_sysconfdir}/mongod.conf # startup stuff -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 install -m 755 -d %{buildroot}/%{_unitdir} install -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}/mongod.service %else @@ -208,11 +249,11 @@ install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/mongod install -m 755 %{SOURCE4} %{buildroot}/%{_bindir}/ install -m 755 %{SOURCE7} %{buildroot}/%{_bindir}/ # -install -m 755 build/install/bin/mongo %{buildroot}/%{_bindir}/mongo -install -m 755 build/install/bin/mongod %{buildroot}/%{_bindir}/mongod -install -m 755 build/install/bin/mongos %{buildroot}/%{_bindir}/mongos -install -m 755 build/install/bin/perconadecrypt %{buildroot}/%{_bindir}/ -install -m 755 build/install/bin/mongobridge %{buildroot}/%{_bindir}/mongobridge +install -m 755 bazel-bin/install/bin/mongo %{buildroot}/%{_bindir}/mongo +install -m 755 bazel-bin/install/bin/mongod %{buildroot}/%{_bindir}/mongod +install -m 755 bazel-bin/install/bin/mongos %{buildroot}/%{_bindir}/mongos +install -m 755 bazel-bin/install/bin/perconadecrypt %{buildroot}/%{_bindir}/ +install -m 755 bazel-bin/install/bin/mongobridge %{buildroot}/%{_bindir}/mongobridge install -m 755 $RPM_BUILD_DIR/%{src_dir}/bin/* %{buildroot}/%{_bindir}/ @@ -233,7 +274,7 @@ install -m 644 $RPM_BUILD_DIR/%{src_dir}/manpages/* %{buildroot}/%{_mandir}/man1 %{_mandir}/man1/mongod.1.gz %{_bindir}/percona-server-mongodb-helper.sh %{_bindir}/percona-server-mongodb-enable-auth.sh -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 %{_unitdir}/mongod.service %else /etc/rc.d/init.d/mongod @@ -269,7 +310,6 @@ install -m 644 $RPM_BUILD_DIR/%{src_dir}/manpages/* %{buildroot}/%{_mandir}/man1 %{_mandir}/man1/mongodump.1.gz %{_bindir}/mongotop %{_mandir}/man1/mongotop.1.gz -#%{_bindir}/mongoreplay %pre server if [ $1 == 1 ]; then @@ -290,9 +330,17 @@ if [ $1 -gt 1 ]; then fi # +%pre mongos +if [ $1 == 1 ]; then + if ! getent passwd mongod > /dev/null 2>&1; then + /usr/sbin/groupadd -r mongod + /usr/sbin/useradd -M -r -g mongod -s /bin/false -c mongod mongod > /dev/null 2>&1 + fi +fi + %post server # -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 %systemd_post mongod.service if [ $1 == 1 ]; then /usr/bin/systemctl enable mongod >/dev/null 2>&1 || : @@ -302,7 +350,7 @@ fi /sbin/chkconfig --add mongod fi %endif -%if 0%{?rhel} > 5 +%if 0%{?amzn} == 2023 || 0%{?rhel} > 5 /usr/sbin/semodule -i /etc/selinux/targeted/modules/active/modules/mongod.pp %else /usr/sbin/semodule -i /etc/selinux/targeted/modules/active/modules/mongod.pp 2> /dev/null @@ -362,7 +410,8 @@ if [ $1 -gt 1 ]; then SERVER_TO_START='' fi if [ $SERVER_TO_START == 1 ]; then -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 + systemctl daemon-reload &>/dev/null || : /usr/sbin/service mongod restart %else if [ -x %{_sysconfdir}/init.d/mongod ] ; then @@ -371,9 +420,34 @@ fi %endif fi fi +%if 0%{?amzn} == 2023 || 0%{?rhel} > 7 +install -d -m 2775 -o mongod -g percona-telemetry /usr/local/percona/telemetry/psmdb +%endif +cp %SOURCE999 /tmp/ 2>/dev/null || : +bash /tmp/call-home.sh -f "PRODUCT_FAMILY_PSMDB" -v "@@VERSION@@-@@RELEASE@@" -d "PACKAGE" &>/dev/null || : +%if 0%{?amzn} == 2023 || 0%{?rhel} > 7 +chgrp percona-telemetry /usr/local/percona/telemetry_uuid &>/dev/null || : +chmod 664 /usr/local/percona/telemetry_uuid &>/dev/null || : +%endif +rm -f /tmp/call-home.sh + +cat << EOF +** Join Percona Squad! ** + +Participate in monthly SWAG raffles, get early access to new product features, +invite-only ”ask me anything” sessions with database performance experts. + +Interested? Fill in the form at https://squad.percona.com/mongodb + +EOF + +%post mongos +%if 0%{?amzn} == 2023 || 0%{?rhel} > 7 +install -d -m 2775 -o mongod -g percona-telemetry /usr/local/percona/telemetry/psmdbs +%endif %preun server -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 %systemd_preun mongod.service %else if [ -x %{_sysconfdir}/init.d/mongod ] ; then @@ -382,18 +456,21 @@ fi %endif %postun server -%if 0%{?rhel} >= 7 +%if 0%{?amzn} == 2023 || 0%{?rhel} >= 7 %systemd_postun mongod.service %endif -if [ $1 == 0 ]; then - if /usr/bin/id -g mongod > /dev/null 2>&1; then - /usr/sbin/userdel mongod > /dev/null 2>&1 - /usr/sbin/groupdel mongod > /dev/null 2>&1 || true - fi +if [ -d %{psmdb_telemetry} ]; then + rm -rf %{psmdb_telemetry} +fi +rm -f /var/run/mongod.pid + +%postun mongos +if [ -d %{psmdbs_telemetry} ]; then + rm -rf %{psmdbs_telemetry} fi # %changelog -* Thu Feb 27 2020 Oleksandr Miroshnychenko - 4.4 -- Initial RPM release for Percona Server for MongoDB 4.4 +* Mon Mar 9 2026 Oleksandr Miroshnychenko - 8.3 +- Initial RPM release for Percona Server for MongoDB 8.3 diff --git a/percona-packaging/scripts/test-build.sh b/percona-packaging/scripts/test-build.sh index be9b6ea4edeca..a0611d16a79c0 100644 --- a/percona-packaging/scripts/test-build.sh +++ b/percona-packaging/scripts/test-build.sh @@ -34,7 +34,7 @@ function install_deps { fi } -main() { +main () { DIRLIST="bin lib lib/private lib/plugin" @@ -62,7 +62,7 @@ main() { wget -O tests/big.json https://raw.githubusercontent.com/feliixx/mgodatagen/master/datagen/testdata/big.json tar -xvf $TMP_DIR/mgodatagen.tar.gz - ./bin/mongod --dbpath $TMP_DIR/db 2>&1 >status.log & + ./bin/mongod --dbpath $TMP_DIR/db 2>&1 > status.log & MONGOPID=$(echo $!) ./mgodatagen -f tests/big.json if [ $? -eq 0 ]; then @@ -77,9 +77,9 @@ main() { } case "$1" in ---install_deps) install_deps ;; ---test) main ;; ---help | *) + --install_deps) install_deps ;; + --test) main ;; + --help|*) cat < Date: Mon, 9 Mar 2026 14:52:18 +0200 Subject: [PATCH 3/5] Update psmdb_generate_sbom.sh --- .../psmdb_sbom/psmdb_generate_sbom.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh b/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh index b10845ad60cec..0f195073a7065 100644 --- a/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh +++ b/percona-packaging/psmdb_sbom/psmdb_generate_sbom.sh @@ -9,10 +9,10 @@ usage () { cat < sbom-full-db.json -# Filter PostgreSQL ${PSMDB_VERSION} components and preserve SBOM structure +# Filter PSMDB ${PSMDB_VERSION} components and preserve SBOM structure jq '{ "$schema": ."$schema", "bomFormat": .bomFormat, @@ -158,6 +158,6 @@ jq '{ "version": .version, "metadata": .metadata, "components": [.components[] | select(.name | test("mongodb|percona"; "i"))] -}' sbom-full-db.json > $CWD/psmdb_sbom/sbom-percona-server-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json +}' sbom-full-db.json > $CWD/psmdb_sbom/sbom-percona-server-mongodb-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json -echo "✅ SBOM for Percona PostgreSQL ${PSMDB_VERSION} written to: $CWD/psmdb_sbom/sbom-percona-server-mongodb-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json" +echo "✅ SBOM for Percona PSMDB ${PSMDB_VERSION} written to: $CWD/psmdb_sbom/sbom-percona-server-mongodb-${PSMDB_VERSION}-${PLATFORM}-${ARCH}.json" From b623c0469d213d8c19ebd3a3f8953fd3d27429fb Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnychenko Date: Mon, 9 Mar 2026 16:59:02 +0200 Subject: [PATCH 4/5] PSMDB-1946 psmdb-83: fix bazel installation on OLs(8) --- percona-packaging/scripts/psmdb_builder.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/percona-packaging/scripts/psmdb_builder.sh b/percona-packaging/scripts/psmdb_builder.sh index 80fe5b4a12309..b0efb9d7c1851 100755 --- a/percona-packaging/scripts/psmdb_builder.sh +++ b/percona-packaging/scripts/psmdb_builder.sh @@ -656,10 +656,6 @@ build_rpm(){ TARF=$(find . -name 'percona-server-mongodb*.tar.gz' | sort | tail -n1) tar vxzf ${TARF} --wildcards '*/etc' --strip=1 tar vxzf ${TARF} --wildcards '*/buildscripts' --strip=1 - python3 buildscripts/install_bazel.py - export PATH=\/root/.local/bin:$PATH >> ~/.bashrc - source ~/.bashrc - rm -rf install_bazel.py if [ x"$RHEL" = x7 ]; then if [ -f /opt/rh/devtoolset-9/enable ]; then source /opt/rh/devtoolset-9/enable @@ -687,7 +683,13 @@ build_rpm(){ PATH=/opt/mongodbtoolchain/v4/bin/:$PATH fi # PATH=/opt/mongodbtoolchain/v4/bin/:$PATH - pip install --upgrade pip + + python3 buildscripts/install_bazel.py + export PATH=\/root/.local/bin:$PATH >> ~/.bashrc + source ~/.bashrc + rm -rf install_bazel.py + + pip install --upgrade pip # PyYAML pkg installation fix, more info: https://github.com/yaml/pyyaml/issues/724 pip install pyyaml==5.4.1 --no-build-isolation From 9812b473f92a3141aebd03cca2dbeb77c111190f Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnychenko Date: Tue, 17 Mar 2026 08:59:02 +0100 Subject: [PATCH 5/5] PSMDB-2005: add missing version_impl dep to mongobridge BUILD.bazel The switch from version constants to VersionInfoInterface requires version_impl dependency in BUILD.bazel to prevent crashes on mongobridge --version invocation. --- src/mongo/tools/mongobridge_tool/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mongo/tools/mongobridge_tool/BUILD.bazel b/src/mongo/tools/mongobridge_tool/BUILD.bazel index 53c29c6b529aa..a9753a72b6a67 100644 --- a/src/mongo/tools/mongobridge_tool/BUILD.bazel +++ b/src/mongo/tools/mongobridge_tool/BUILD.bazel @@ -41,6 +41,7 @@ mongo_cc_binary( "//src/mongo/transport:session_manager", "//src/mongo/transport:transport_layer_manager", "//src/mongo/util:signal_handlers", + "//src/mongo/util:version_impl", "//src/mongo/util/net:network", "//src/mongo/util/options_parser:options_parser_init", ],