Skip to content

Commit 5759e8d

Browse files
authored
MONGOCRYPT-872 Use uv tool to obtain CMake, Ninja, and Python (#1153)
* Add install-build-tools.sh * Install uv in all Earthly environments * Apply workarounds for RHEL 6 and RHEL 7 (zSeries)
1 parent f2d29ee commit 5759e8d

14 files changed

Lines changed: 2380 additions & 391 deletions

.evergreen/benchmark-python.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,26 @@ fi
99

1010
MONGOCRYPT_INSTALL_PREFIX=$LIBMONGOCRYPT_DIR/.install
1111

12+
. "$(dirname "${BASH_SOURCE[0]}")/install-build-tools.sh"
13+
install_build_tools
14+
1215
# Install libmongocrypt.
1316
build_dir="$LIBMONGOCRYPT_DIR/cmake-build"
14-
run_cmake \
17+
cmake \
1518
-DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX" \
1619
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
1720
-B"$build_dir"
18-
run_cmake --build "$build_dir" --target install
21+
cmake --build "$build_dir" --target install
1922

2023
# Run Python benchmarks.
2124
# Include path to installed libmongocrypt.so
2225
export LD_LIBRARY_PATH="$MONGOCRYPT_INSTALL_PREFIX/lib64"
2326
cd bindings/python/
2427

25-
/opt/mongodbtoolchain/v4/bin/python3 -m venv venv
28+
uv venv venv
2629
. ./venv/bin/activate
27-
python -m pip install --prefer-binary -r requirements-test.txt
28-
python -m pip install -e .
30+
uv pip install -r requirements-test.txt
31+
uv pip install -e .
2932

3033
export OUTPUT_FILE=results.json
3134

.evergreen/build_all.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ BUILD_TESTING="${BUILD_TESTING-TRUE}"
3535
LIBMONGOCRYPT_BUILD_VARIANTS="${LIBMONGOCRYPT_BUILD_VARIANTS:-TRUE}"
3636

3737
# Accumulate arguments that are passed to CMake
38-
cmake_args=(
39-
--fresh
38+
cmake_args=()
39+
40+
# Temporary workarounds for rhel-62-64-bit and rhel72-zseries-test. To be removed.
41+
if cmake --help | grep -q -- '--fresh'; then
42+
cmake_args+=(--fresh)
43+
fi
44+
45+
cmake_args+=(
4046
# Set the build type. CMake 3.22 recognizes this via environment variable
4147
-D CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
4248
# Set the install prefix. CMake 3.29 recognizes this via environment variable
@@ -67,19 +73,15 @@ for suffix in "dll" "dylib" "so"; do
6773
fi
6874
done
6975

70-
if test "${CMAKE_GENERATOR-}" = Ninja; then
71-
export NINJA_EXE
72-
: "${NINJA_EXE:="$BINARY_DIR/ninja$EXE_SUFFIX"}"
73-
cmake_args+=(-DCMAKE_MAKE_PROGRAM="$NINJA_EXE")
74-
bash "$EVG_DIR/ensure-ninja.sh"
75-
fi
76+
. "$(dirname "${BASH_SOURCE[0]}")/install-build-tools.sh"
77+
install_build_tools
7678

7779
# A command that prepends our custom compile flags for any CMake execution
7880
_cmake_with_env() {
7981
# Prepend our custom C and CXX flags for any possible CMake builds
8082
CFLAGS="$LIBMONGOCRYPT_COMPILE_FLAGS ${CFLAGS-}" \
8183
CXXFLAGS="$LIBMONGOCRYPT_COMPILE_FLAGS ${CXXFLAGS-}" \
82-
run_cmake "$@"
84+
cmake "$@"
8385
}
8486

8587
# Build and install libmongocrypt.
@@ -113,7 +115,7 @@ if [[ "$release_os_arch" == *glibc* ]]; then
113115
echo "glibc version check passed: $actual_glibc"
114116
fi
115117

116-
run_chdir "$BINARY_DIR" run_ctest
118+
run_chdir "$BINARY_DIR" ctest
117119

118120
# MONGOCRYPT-372, ensure macOS universal builds contain both x86_64 and arm64 architectures.
119121
if test "${CMAKE_OSX_ARCHITECTURES-}" != ''; then
@@ -143,12 +145,12 @@ _cmake_with_env "${cmake_args[@]}" \
143145
-DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/nocrypto" \
144146
-B "$BINARY_DIR" -S "$LIBMONGOCRYPT_DIR"
145147
_cmake_with_env --build "$BINARY_DIR" --target install
146-
run_chdir "$BINARY_DIR" run_ctest
148+
run_chdir "$BINARY_DIR" ctest
147149

148150
# Build and install libmongocrypt without statically linking libbson
149151
_cmake_with_env "${cmake_args[@]}" \
150152
-DUSE_SHARED_LIBBSON=ON \
151153
-DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/sharedbson" \
152154
-B "$BINARY_DIR" -S "$LIBMONGOCRYPT_DIR"
153155
_cmake_with_env --build "$BINARY_DIR" --target install
154-
run_chdir "$BINARY_DIR" run_ctest
156+
run_chdir "$BINARY_DIR" ctest

.evergreen/cmake.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.evergreen/config.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ functions:
116116
export LSAN_OPTIONS="suppressions=$LIBMONGOCRYPT_DIR/.lsan-suppressions"
117117
export VS_VERSION=${vs_version|}
118118
export VS_TARGET_ARCH=${vs_target_arch|amd64}
119-
export CMAKE_GENERATOR=${CMAKE_GENERATOR|Ninja}
119+
export CMAKE_GENERATOR=${CMAKE_GENERATOR|Ninja} # Even on Windows.
120120
export release_os_arch=${release_os_arch}
121121
env ${compile_env|} \
122122
bash "$EVG_DIR/env-run.sh" \
@@ -169,7 +169,6 @@ functions:
169169
- command: "shell.exec"
170170
params:
171171
script: |-
172-
if test "$OS_NAME" != "windows"; then export CMAKE_GENERATOR=${CMAKE_GENERATOR|Ninja}; fi
173172
env ${compile_env|} CONFIGURE_ONLY=ON ${clang_env|CC=clang CXX=clang++} \
174173
bash libmongocrypt/.evergreen/build_all.sh
175174
./libmongocrypt/.evergreen/clang-tidy.sh
@@ -502,7 +501,7 @@ tasks:
502501
- func: "fetch source"
503502
- func: "earthly"
504503
vars:
505-
args: +create-deb-packages-and-repos --env=${earthly_env} --packager_distro=${packager_distro} --packager_arch=${packager_arch} --ninja_version=${ninja_version}
504+
args: +create-deb-packages-and-repos --env=${earthly_env} --packager_distro=${packager_distro} --packager_arch=${packager_arch}
506505
- func: "upload packages and repos"
507506

508507
- name: publish-deb-packages-with-earthly
@@ -1059,7 +1058,7 @@ tasks:
10591058
set -o errexit
10601059
10611060
. .evergreen/init.sh
1062-
libmongocrypt_release_version=$(run_python ./etc/calc_release_version.py)
1061+
libmongocrypt_release_version=$(uvx python ./etc/calc_release_version.py)
10631062
case "$libmongocrypt_release_version" in
10641063
*+*)
10651064
# Not a tagged release. Use full release version suffix.
@@ -1985,8 +1984,6 @@ buildvariants:
19851984
compile_env: >-
19861985
CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
19871986
CMAKE=/opt/homebrew/bin/cmake
1988-
# Disable Ninja to work around error "Bad CPU type in executable"
1989-
CMAKE_GENERATOR: ''
19901987
release_os_arch: macos-universal
19911988
tasks:
19921989
- build-and-test-and-upload
@@ -2052,7 +2049,6 @@ buildvariants:
20522049
packager_distro: debian13
20532050
packager_arch: arm64
20542051
earthly_env: deb13
2055-
ninja_version: 1.12.1
20562052
tasks:
20572053
- name: build-deb-packages-with-earthly
20582054
# Use an arm64 distro to match the intended target architecture of .deb packages.

.evergreen/ctest.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.evergreen/ensure-cmake.sh

Lines changed: 0 additions & 170 deletions
This file was deleted.

0 commit comments

Comments
 (0)