Skip to content

Commit c0595c4

Browse files
authored
Use uvx for CMake and Server Toolchain for Ninja (#2097)
1 parent cdeb33d commit c0595c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3107
-853
lines changed

.evergreen/config_generator/components/abi_compliance_check.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
from shrub.v3.evg_command import s3_put
33
from shrub.v3.evg_task import EvgTask
44

5-
from config_generator.components.funcs.set_cache_dir import SetCacheDir
5+
from config_generator.components.funcs.install_uv import InstallUV
66

77
from config_generator.etc.function import Function
88
from config_generator.etc.utils import bash_exec
99

1010

1111
class CheckABICompliance(Function):
1212
name = 'abi-compliance-check'
13-
commands = SetCacheDir.commands + [
13+
commands = [
1414
bash_exec(
1515
command_type=EvgCommandType.SETUP,
1616
working_dir='mongoc',
1717
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
18-
script='.evergreen/scripts/abi-compliance-check-setup.sh'
18+
script='.evergreen/scripts/abi-compliance-check-setup.sh',
1919
),
2020
bash_exec(
2121
command_type=EvgCommandType.TEST,
2222
add_expansions_to_env=True,
2323
working_dir='mongoc',
24-
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
25-
script='.evergreen/scripts/abi-compliance-check.sh'
24+
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR', 'UV_INSTALL_DIR'],
25+
script='.evergreen/scripts/abi-compliance-check.sh',
2626
),
2727
s3_put(
2828
command_type=EvgCommandType.SYSTEM,
@@ -57,6 +57,9 @@ def tasks():
5757
return [
5858
EvgTask(
5959
name=CheckABICompliance.name,
60-
commands=[CheckABICompliance.call()],
60+
commands=[
61+
InstallUV.call(),
62+
CheckABICompliance.call(),
63+
],
6164
)
6265
]

.evergreen/config_generator/components/c_std_compile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from shrub.v3.evg_command import EvgCommandType
33
from shrub.v3.evg_task import EvgTask, EvgTaskRef
44

5-
from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
5+
from config_generator.components.funcs.install_uv import InstallUV
66

77
from config_generator.etc.distros import find_large_distro
88
from config_generator.etc.distros import make_distro_str
@@ -96,7 +96,7 @@ def tasks():
9696
run_on=distro.name,
9797
tags=tags + [f'std-c{std}'],
9898
commands=[
99-
FindCMakeLatest.call(),
99+
InstallUV.call(),
100100
StdCompile.call(vars=compile_vars | with_std)
101101
],
102102
)

.evergreen/config_generator/components/clang_format.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from shrub.v3.evg_task import EvgTask
44
from shrub.v3.evg_task import EvgTaskRef
55

6+
from config_generator.components.funcs.install_uv import InstallUV
67
from config_generator.etc.distros import find_small_distro
78
from config_generator.etc.function import Function
89
from config_generator.etc.utils import bash_exec
@@ -20,7 +21,7 @@ class ClangFormat(Function):
2021
env={
2122
"DRYRUN": "1",
2223
},
23-
script="uv run --frozen --only-group=format tools/format.py --mode=check",
24+
script='PATH="${UV_INSTALL_DIR}:$PATH" uv run --frozen --only-group=format tools/format.py --mode=check',
2425
),
2526
]
2627

@@ -33,7 +34,10 @@ def tasks():
3334
yield EvgTask(
3435
name=TAG,
3536
tags=[TAG],
36-
commands=[ClangFormat.call()],
37+
commands=[
38+
InstallUV.call(),
39+
ClangFormat.call(),
40+
],
3741
)
3842

3943

.evergreen/config_generator/components/funcs/fetch_det.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,6 @@ class FetchDET(Function):
2323
working_dir="drivers-evergreen-tools",
2424
script='find .evergreen -type f -name "*.sh" -exec chmod +rx "{}" \;',
2525
),
26-
27-
# python is used frequently enough by many tasks that it is worth
28-
# running find_python3 once here and reusing the result.
29-
bash_exec(
30-
command_type=EvgCommandType.SETUP,
31-
script='''\
32-
set -o errexit
33-
. drivers-evergreen-tools/.evergreen/find-python3.sh
34-
echo "PYTHON3_BINARY: $(find_python3)" >|python3_binary.yml
35-
''',
36-
),
37-
expansions_update(
38-
command_type=EvgCommandType.SETUP,
39-
file='python3_binary.yml',
40-
),
4126
]
4227

4328

.evergreen/config_generator/components/funcs/find_cmake_latest.py

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
from config_generator.components.funcs.set_cache_dir import SetCacheDir
2+
3+
from config_generator.etc.function import Function
4+
from config_generator.etc.utils import bash_exec
5+
6+
from shrub.v3.evg_command import EvgCommandType, expansions_update
7+
8+
9+
class InstallUV(Function):
10+
name = 'install-uv'
11+
commands = SetCacheDir.commands + [
12+
bash_exec(
13+
command_type=EvgCommandType.SETUP,
14+
script='''\
15+
set -o errexit
16+
set -o pipefail
17+
18+
version="0.8.13"
19+
20+
if [[ ! -n "${MONGO_C_DRIVER_CACHE_DIR}" ]]; then
21+
echo "MONGO_C_DRIVER_CACHE_DIR is not defined!" 1>&2
22+
exit 1
23+
fi
24+
25+
uv_install_dir="${MONGO_C_DRIVER_CACHE_DIR}/uv-$version"
26+
mkdir -p "$uv_install_dir"
27+
28+
if ! command -v "$uv_install_dir/uv" 2>/dev/null; then
29+
script="$(mktemp)"
30+
cp -f mongoc/.evergreen/scripts/uv-installer.sh "$script"
31+
chmod +x "$script"
32+
(
33+
. mongoc/.evergreen/scripts/patch-uv-installer.sh
34+
patch_uv_installer "$script" "$version"
35+
)
36+
env \\
37+
UV_INSTALL_DIR="$uv_install_dir" \\
38+
UV_UNMANAGED_INSTALL=1 \\
39+
INSTALLER_PRINT_VERBOSE=1 \\
40+
"$script"
41+
fi
42+
43+
PATH="$uv_install_dir:$PATH" command -V uv
44+
PATH="$uv_install_dir:$PATH" uv --version
45+
46+
printf "UV_INSTALL_DIR: %s\\n" "$uv_install_dir" >|expansions.uv.yml
47+
''',
48+
),
49+
expansions_update(
50+
command_type=EvgCommandType.SETUP,
51+
file='expansions.uv.yml',
52+
),
53+
]
54+
55+
56+
def functions():
57+
return InstallUV.defn()

.evergreen/config_generator/components/funcs/run_simple_http_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class RunSimpleHTTPServer(Function):
1212
command_type=command_type,
1313
background=True,
1414
working_dir='mongoc',
15+
include_expansions_in_env=['UV_INSTALL_DIR'],
1516
script='''\
1617
set -o errexit
1718
echo "Starting simple HTTP server..."
18-
command -V "${PYTHON3_BINARY}" >/dev/null
19-
"${PYTHON3_BINARY}" .evergreen/scripts/simple_http_server.py
19+
PATH="${UV_INSTALL_DIR}:$PATH" uvx python .evergreen/scripts/simple_http_server.py
2020
echo "Starting simple HTTP server... done."
2121
''',
2222
),

.evergreen/config_generator/components/loadbalanced.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from config_generator.components.funcs.bootstrap_mongo_orchestration import BootstrapMongoOrchestration
66
from config_generator.components.funcs.fetch_build import FetchBuild
77
from config_generator.components.funcs.fetch_det import FetchDET
8-
from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
8+
from config_generator.components.funcs.install_uv import InstallUV
99
from config_generator.components.funcs.run_simple_http_server import RunSimpleHTTPServer
1010
from config_generator.components.funcs.run_tests import RunTests
1111
from config_generator.components.funcs.upload_build import UploadBuild
@@ -56,6 +56,7 @@ def make_test_task(auth: bool, ssl: bool, server_version: str):
5656
'TOPOLOGY': 'sharded_cluster',
5757
'LOAD_BALANCER': 'on',
5858
}),
59+
InstallUV.call(),
5960
RunSimpleHTTPServer.call(),
6061
FunctionCall(func='start-load-balancer', vars={
6162
'MONGODB_URI': 'mongodb://localhost:27017,localhost:27018'
@@ -77,14 +78,15 @@ def tasks():
7778
run_on=find_large_distro(_DISTRO_NAME).name,
7879
tags=['loadbalanced', _DISTRO_NAME, _COMPILER],
7980
commands=[
80-
FindCMakeLatest.call(),
81+
InstallUV.call(),
8182
bash_exec(
8283
command_type=EvgCommandType.TEST,
8384
env={
8485
'CC': _COMPILER,
8586
'CFLAGS': '-fno-omit-frame-pointer',
8687
'SSL': 'OPENSSL'
8788
},
89+
include_expansions_in_env=['distro_id', 'UV_INSTALL_DIR'],
8890
working_dir='mongoc',
8991
script='.evergreen/scripts/compile.sh',
9092
),

.evergreen/config_generator/components/make_docs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from shrub.v3.evg_command import s3_put
33
from shrub.v3.evg_task import EvgTask
44

5-
from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
5+
from config_generator.components.funcs.install_uv import InstallUV
66

77
from config_generator.etc.function import Function
88
from config_generator.etc.function import merge_defns
@@ -18,7 +18,7 @@ class MakeDocs(Function):
1818
include_expansions_in_env=["distro_id"],
1919
script="""\
2020
# See SphinxBuild.cmake for EVG_DOCS_BUILD reasoning
21-
uv run --frozen --only-group docs env EVG_DOCS_BUILD=1 .evergreen/scripts/build-docs.sh
21+
PATH="${UV_INSTALL_DIR}:$PATH" uv run --frozen --only-group docs env EVG_DOCS_BUILD=1 .evergreen/scripts/build-docs.sh
2222
""",
2323
),
2424
]
@@ -120,7 +120,7 @@ def tasks():
120120
EvgTask(
121121
name="make-docs",
122122
commands=[
123-
FindCMakeLatest.call(),
123+
InstallUV.call(),
124124
MakeDocs.call(),
125125
UploadDocs.call(),
126126
UploadManPages.call(),

.evergreen/config_generator/components/mock_server.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from shrub.v3.evg_command import EvgCommandType
33
from shrub.v3.evg_task import EvgTask, EvgTaskRef
44

5-
from config_generator.components.funcs.fetch_det import FetchDET
6-
from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
5+
from config_generator.components.funcs.install_uv import InstallUV
76
from config_generator.components.funcs.run_simple_http_server import RunSimpleHTTPServer
87
from config_generator.etc.utils import bash_exec
98

@@ -13,10 +12,8 @@ def tasks():
1312
name="mock-server-test",
1413
run_on="ubuntu2204-small",
1514
commands=[
16-
# Call fetch-det to define PYTHON3_BINARY expansion required for run-simple-http-server.
17-
FetchDET.call(),
15+
InstallUV.call(),
1816
RunSimpleHTTPServer.call(),
19-
FindCMakeLatest.call(),
2017
bash_exec(
2118
command_type=EvgCommandType.TEST,
2219
add_expansions_to_env=True,

0 commit comments

Comments
 (0)