Skip to content

[CDRIVER-4637] A config settings command #1289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b131314
New config settings code and defaults.
vector-of-bool May 10, 2023
6c1703c
Aside: message() cleanup
vector-of-bool May 24, 2023
4f67917
Use new CMake in more build tasks
vector-of-bool May 10, 2023
5979a33
Don't use Batch scripts to compile for MinGW
vector-of-bool May 25, 2023
947b91e
Redundant ENABLE_SHM_COUNTERS logic
vector-of-bool May 31, 2023
8d3854f
Comment and message tweaks
vector-of-bool Jun 2, 2023
c4f81a8
Update the "Ask for Help" section
vector-of-bool Jun 5, 2023
026a86a
Remove AUDIT defaults
vector-of-bool Jun 5, 2023
3074a0b
Don't enable tracing as a default
vector-of-bool Jun 5, 2023
5f02e41
Tweak default of ENABLE_AUTOMATIC_INIT_AND_CLEANUP
vector-of-bool Jun 5, 2023
af82494
More thorough boolean checks
vector-of-bool Jun 5, 2023
c682aac
No longer applicable SASL checks
vector-of-bool Jun 5, 2023
d297655
Merge branch 'master' into CDRIVER-4637-settings-command
vector-of-bool Jun 5, 2023
fc15e01
Remove ENABLE_BSON, as its purpose is confusing.
vector-of-bool Jun 6, 2023
988bca3
EVG has an option for that
vector-of-bool Jun 6, 2023
31a0bf9
Many PR comments and wording tweaks. Remove some unneeded bits
vector-of-bool Jun 7, 2023
04ec48e
New toolchain for the build
vector-of-bool Jun 8, 2023
b9f9f69
Move that to the deprecated section
vector-of-bool Jun 8, 2023
2c2f7b4
Don't inject the toolchain SSL into LD_LIBRARY_PATH
vector-of-bool Jun 9, 2023
1116cd8
Merge branch 'master' into CDRIVER-4637-settings-command
vector-of-bool Jun 9, 2023
da33f9c
Fix error with CMake genex parsing
vector-of-bool Jun 9, 2023
6a425ba
More CMake updates
vector-of-bool Jun 9, 2023
70cf917
Coverage link options are usage requirements
vector-of-bool Jun 9, 2023
d042041
More Bash, less Sh
vector-of-bool Jun 9, 2023
d47bd59
More bash, more CMake updates
vector-of-bool Jun 9, 2023
4e47388
Don't depend on distro_id
vector-of-bool Jun 9, 2023
d82678a
Fix macOS and Windows
vector-of-bool Jun 12, 2023
16bbf80
Fix setup scripts
vector-of-bool Jun 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ReleaseArchive(Function):
'MONGOC_TEST_SKIP_LIVE': 'on',
'MONGOC_TEST_SKIP_SLOW': 'on',
},
include_expansions_in_env=['distro_id'],
script='''\
set -o errexit
bash tools/poetry.sh install --with=docs
Expand Down
24 changes: 18 additions & 6 deletions .evergreen/config_generator/etc/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from importlib import import_module
from pathlib import Path
from textwrap import dedent
from typing import Sequence
from typing import Sequence, Iterable, Mapping

import yaml

from shrub.v3.evg_project import EvgProject
from shrub.v3.evg_task import EvgTask
from shrub.v3.evg_command import subprocess_exec
from shrub.v3.evg_command import subprocess_exec, EvgCommandType


# Equivalent to EvgTask but defines additional properties.
Expand All @@ -23,11 +23,23 @@ class Task(EvgTask):


# Automatically formats the provided script and invokes it in Bash.
def bash_exec(script, **kwargs):
def bash_exec(
script,
*,
include_expansions_in_env: Iterable[str] | None = None,
working_dir: str | None = None,
command_type: EvgCommandType | None = None,
env: Mapping[str, str] | None = None,
**kwargs,
):
return subprocess_exec(
binary='bash',
args=['-c', dedent(script)],
**kwargs
binary="bash",
args=["-c", dedent(script)],
include_expansions_in_env=list(include_expansions_in_env) if include_expansions_in_env else None,
working_dir=working_dir,
command_type=command_type,
env=dict(env) if env else None,
**kwargs,
)


Expand Down
1 change: 0 additions & 1 deletion .evergreen/etc/mongo-c-driver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ Documentation: http://mongoc.org/libbson/%{version}/

%build
%cmake \
-DENABLE_BSON:STRING=ON \
-DENABLE_MONGOC:BOOL=ON \
-DENABLE_SHM_COUNTERS:BOOL=ON \
-DENABLE_SSL:STRING=OPENSSL \
Expand Down
2 changes: 2 additions & 0 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ functions:
MONGOC_TEST_FUTURE_TIMEOUT_MS: "30000"
MONGOC_TEST_SKIP_LIVE: "on"
MONGOC_TEST_SKIP_SLOW: "on"
include_expansions_in_env:
- distro_id
args:
- -c
- |
Expand Down
62 changes: 48 additions & 14 deletions .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ functions:
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
Expand All @@ -95,29 +97,33 @@ functions:
export BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=${BUILD_SAMPLE_WITH_CMAKE_DEPRECATED}
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
LINK_STATIC= sh .evergreen/scripts/link-sample-program.sh
LINK_STATIC=1 sh .evergreen/scripts/link-sample-program.sh
LINK_STATIC= bash .evergreen/scripts/link-sample-program.sh
LINK_STATIC=1 bash .evergreen/scripts/link-sample-program.sh
link sample program bson:
- command: shell.exec
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
# Compile a program that links dynamically or statically to libbson,
# using variables from pkg-config or from CMake's find_package command.
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
link sample program MSVC:
- command: shell.exec
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
Expand All @@ -126,24 +132,34 @@ functions:
# find_package command.
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
LINK_STATIC= cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc.cmd
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc.cmd
link sample program mingw:
- command: shell.exec
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
# Build libmongoc with CMake and compile a program that links
# dynamically to it, using variables from pkg-config.exe.
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-mingw.cmd
link sample program MSVC bson:
- command: shell.exec
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
Expand All @@ -152,6 +168,9 @@ functions:
# find_package command.
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
LINK_STATIC= cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc-bson.cmd
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc-bson.cmd
link sample program mingw bson:
Expand All @@ -164,6 +183,9 @@ functions:
set -o errexit
# Build libmongoc with CMake and compile a program that links
# dynamically to it, using variables from pkg-config.exe.
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-mingw-bson.cmd
update codecov.io:
- command: shell.exec
Expand Down Expand Up @@ -201,7 +223,7 @@ functions:
set -o errexit
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
bash .evergreen/atlas_data_lake/build-mongohouse-local.sh
run mongohouse:
- command: shell.exec
type: test
Expand All @@ -212,7 +234,7 @@ functions:
set -o errexit
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/run-mongohouse-local.sh
bash .evergreen/atlas_data_lake/run-mongohouse-local.sh
test mongohouse:
- command: shell.exec
type: test
Expand Down Expand Up @@ -962,9 +984,13 @@ tasks:
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(find_cmake_latest)"
export CC="C:/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin/gcc.exe"
BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd
cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd
Expand All @@ -977,9 +1003,13 @@ tasks:
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(find_cmake_latest)"
export CC="Visual Studio 14 2015 Win64"
BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd
cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd
Expand All @@ -992,12 +1022,16 @@ tasks:
type: test
params:
working_dir: mongoc
include_expansions_in_env:
- distro_id
shell: bash
script: |-
set -o errexit
DESTDIR="$(pwd)/dest" sh ./.evergreen/scripts/install-uninstall-check.sh
BSON_ONLY=1 sh ./.evergreen/scripts/install-uninstall-check.sh
sh ./.evergreen/scripts/install-uninstall-check.sh
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(find_cmake_latest)"
DESTDIR="$(pwd)/dest" bash ./.evergreen/scripts/install-uninstall-check.sh
BSON_ONLY=1 bash ./.evergreen/scripts/install-uninstall-check.sh
bash ./.evergreen/scripts/install-uninstall-check.sh
- name: debug-compile-with-warnings
commands:
- command: shell.exec
Expand Down Expand Up @@ -1049,7 +1083,7 @@ tasks:
params:
aws_key: ${toolchain_aws_key}
aws_secret: ${toolchain_aws_secret}
remote_file: mongo-c-toolchain/${distro_id}/mongo-c-toolchain.tar.gz
remote_file: mongo-c-toolchain/${distro_id}/2023/06/07/mongo-c-toolchain.tar.gz
bucket: mongo-c-toolchain
local_file: mongo-c-toolchain.tar.gz
- command: shell.exec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from collections import OrderedDict as OD
from textwrap import dedent
from typing import Iterable

from evergreen_config_generator import ConfigObject

Expand Down Expand Up @@ -67,6 +68,7 @@ def shell_exec(
background: bool = False,
add_expansions_to_env: bool = False,
redirect_standard_error_to_output: bool = False,
include_expansions_in_env: Iterable[str] = (),
) -> ValueMapping:
dedented = ""
if errexit:
Expand Down Expand Up @@ -99,6 +101,9 @@ def shell_exec(
if redirect_standard_error_to_output:
command["params"]["redirect_standard_error_to_output"] = True

if include_expansions_in_env:
command["params"]["include_expansions_in_env"] = list(include_expansions_in_env)

command["params"]["shell"] = "bash"
command["params"]["script"] = dedented
return command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Iterable
from evergreen_config_generator.functions import shell_exec


Expand All @@ -25,6 +26,7 @@ def shell_mongoc(
background: bool = False,
add_expansions_to_env: bool = False,
redirect_standard_error_to_output: bool = False,
include_expansions_in_env: Iterable[str] = (),
):
return shell_exec(
script,
Expand All @@ -36,5 +38,6 @@ def shell_mongoc(
continue_on_err=continue_on_err,
background=background,
add_expansions_to_env=add_expansions_to_env,
include_expansions_in_env=include_expansions_in_env,
redirect_standard_error_to_output=redirect_standard_error_to_output,
)
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,23 @@
export BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=${BUILD_SAMPLE_WITH_CMAKE_DEPRECATED}
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
LINK_STATIC= sh .evergreen/scripts/link-sample-program.sh
LINK_STATIC=1 sh .evergreen/scripts/link-sample-program.sh
'''),
LINK_STATIC= bash .evergreen/scripts/link-sample-program.sh
LINK_STATIC=1 bash .evergreen/scripts/link-sample-program.sh
''',
include_expansions_in_env=['distro_id']),
)),
('link sample program bson', Function(
shell_mongoc(r'''
# Compile a program that links dynamically or statically to libbson,
# using variables from pkg-config or from CMake's find_package command.
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC= sh .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC=1 sh .evergreen/scripts/link-sample-program-bson.sh
'''),
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE= BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED= LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC= bash .evergreen/scripts/link-sample-program-bson.sh
BUILD_SAMPLE_WITH_CMAKE=1 BUILD_SAMPLE_WITH_CMAKE_DEPRECATED=1 LINK_STATIC=1 bash .evergreen/scripts/link-sample-program-bson.sh
''',
include_expansions_in_env=['distro_id']),
)),
('link sample program MSVC', Function(
shell_mongoc(r'''
Expand All @@ -93,16 +95,24 @@
# find_package command.
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
LINK_STATIC= cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc.cmd
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc.cmd
'''),
''',
include_expansions_in_env=['distro_id']),
)),
('link sample program mingw', Function(
shell_mongoc(r'''
# Build libmongoc with CMake and compile a program that links
# dynamically to it, using variables from pkg-config.exe.
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-mingw.cmd
'''),
''',
include_expansions_in_env=['distro_id']),
)),
('link sample program MSVC bson', Function(
shell_mongoc(r'''
Expand All @@ -111,14 +121,21 @@
# find_package command.
export ENABLE_SSL=${ENABLE_SSL}
export ENABLE_SNAPPY=${ENABLE_SNAPPY}
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
LINK_STATIC= cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc-bson.cmd
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-msvc-bson.cmd
'''),
''',
include_expansions_in_env=['distro_id']),
)),
('link sample program mingw bson', Function(
shell_mongoc(r'''
# Build libmongoc with CMake and compile a program that links
# dynamically to it, using variables from pkg-config.exe.
. .evergreen/scripts/use-tools.sh paths
. .evergreen/scripts/find-cmake-latest.sh
export CMAKE="$(native-path "$(find_cmake_latest)")"
cmd.exe /c .\\.evergreen\\scripts\\link-sample-program-mingw-bson.cmd
'''),
)),
Expand All @@ -145,14 +162,14 @@
shell_exec(r'''
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
bash .evergreen/atlas_data_lake/build-mongohouse-local.sh
'''),
)),
('run mongohouse', Function(
shell_exec(r'''
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/run-mongohouse-local.sh
bash .evergreen/atlas_data_lake/run-mongohouse-local.sh
''', background=True),
)),
('test mongohouse', Function(
Expand Down
Loading