From d0414b7994432d732ca1daea52ee319c17d8c741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20F=C3=B6rster?= Date: Sun, 14 Sep 2025 14:38:00 +0200 Subject: [PATCH] [dev-libs/mongo-c-driver] migrate to ctest, verify-sig, cmake4 --- dev-libs/mongo-c-driver/Manifest | 1 + .../files/mongo-c-driver-1.30.5-cmake4.patch | 170 ++++++++++++++++++ dev-libs/mongo-c-driver/files/skip-tests.txt | 38 ---- .../mongo-c-driver-1.30.5-r1.ebuild | 55 +++++- .../mongo-c-driver-1.30.5.ebuild | 55 +++++- 5 files changed, 273 insertions(+), 46 deletions(-) create mode 100644 dev-libs/mongo-c-driver/files/mongo-c-driver-1.30.5-cmake4.patch delete mode 100644 dev-libs/mongo-c-driver/files/skip-tests.txt diff --git a/dev-libs/mongo-c-driver/Manifest b/dev-libs/mongo-c-driver/Manifest index cbc3c70..3c6f558 100644 --- a/dev-libs/mongo-c-driver/Manifest +++ b/dev-libs/mongo-c-driver/Manifest @@ -1 +1,2 @@ DIST mongo-c-driver-1.30.5.tar.gz 7434294 BLAKE2B 910a3929481625add6578f26cddacdbda788a8c6a6828ca7d6c2abc9a4350edc5f0ee13003197f93bb01cbd42e07330344f8a7c8d194ad86525665e23469e3d8 SHA512 3740f91a6d72d400057ecd0920740579ff664f230815bbf2cad1d0a0a268de99b40be3f05cdfe22759ca789d938cf7d3bbd439c431867b82d83c3d1690df3f68 +DIST mongo-c-driver-1.30.5.tar.gz.asc 833 BLAKE2B f92098b9946a0eb0b633ae5e8b7c444d5c0085fc5980993a25910802289def5cd04e19a0aba077ea9f4c954a65c06769cf63cb6f7961813bfd95c66101072b52 SHA512 5d7cc4037a5a145ed53e8e60d18d47f3d7b867320f08b3c755e00fe11a8305c7f449b30b31e59310577344495406aaeca78b2cd843d7c31c02e03200e55e0bf6 diff --git a/dev-libs/mongo-c-driver/files/mongo-c-driver-1.30.5-cmake4.patch b/dev-libs/mongo-c-driver/files/mongo-c-driver-1.30.5-cmake4.patch new file mode 100644 index 0000000..5a3d391 --- /dev/null +++ b/dev-libs/mongo-c-driver/files/mongo-c-driver-1.30.5-cmake4.patch @@ -0,0 +1,170 @@ +https://jira.mongodb.org/browse/CDRIVER-6059 +https://github.com/mongodb/mongo-c-driver/pull/2066 +https://github.com/mongodb/mongo-c-driver/commit/e8ea70127f7bbbb4bcdb450026f059d8459b98db + +Removed non cmake changes + +From e8ea70127f7bbbb4bcdb450026f059d8459b98db Mon Sep 17 00:00:00 2001 +From: Ezra Chung <88335979+eramongodb@users.noreply.github.com> +Date: Tue, 22 Jul 2025 15:47:09 -0500 +Subject: [PATCH] CDRIVER-6059 Set CMake max policy version to 4.0 (#2066) + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.15) ++cmake_minimum_required (VERSION 3.15...4.0) + + list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/build/cmake") + # Defines BUILD_VERSION, which we use throughout: +@@ -402,11 +402,6 @@ set (CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) + # Install libs with names like @rpath/libmongoc-1.0.0.dylib, not bare names. + set (CMAKE_MACOSX_RPATH ON) + +-# https://cmake.org/cmake/help/v3.11/policy/CMP0042.html +-# Enable a CMake 3.0+ policy that sets CMAKE_MACOSX_RPATH by default, and +-# silence a CMake 3.11 warning that the old behavior is deprecated. +-cmake_policy (SET CMP0042 NEW) +- + # By default, ensure conformance with a minimum C standard. + # Required extensions to the language (i.e. POSIX) are (re)enabled further below. + if (NOT DEFINED CMAKE_C_STANDARD) +--- a/build/cmake/GenerateUninstaller.cmake ++++ b/build/cmake/GenerateUninstaller.cmake +@@ -1,5 +1,3 @@ +-cmake_policy(VERSION 3.15) +- + if(NOT CMAKE_SCRIPT_MODE_FILE) + # We are being included from within a project, so we should generate the install rules + # The script name is "uninstall" by default: +--- a/src/libbson/CMakeLists.txt ++++ b/src/libbson/CMakeLists.txt +@@ -11,7 +11,7 @@ + # 888 + # 888 + +-cmake_minimum_required (VERSION 3.15) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (libbson + LANGUAGES C +--- a/src/libbson/examples/cmake-deprecated/find_package/CMakeLists.txt ++++ b/src/libbson/examples/cmake-deprecated/find_package/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libbson. + +-cmake_minimum_required (VERSION 2.8) ++cmake_minimum_required (VERSION 3.15) + + project (hello_bson LANGUAGES C) + +--- a/src/libbson/examples/cmake-deprecated/find_package_static/CMakeLists.txt ++++ b/src/libbson/examples/cmake-deprecated/find_package_static/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libbson. + +-cmake_minimum_required (VERSION 2.8) ++cmake_minimum_required (VERSION 3.15) + + project (hello_bson LANGUAGES C) + +--- a/src/libbson/examples/cmake/find_package/CMakeLists.txt ++++ b/src/libbson/examples/cmake/find_package/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libbson. + +-cmake_minimum_required (VERSION 3.0) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (hello_bson LANGUAGES C) + +--- a/src/libbson/examples/cmake/find_package_static/CMakeLists.txt ++++ b/src/libbson/examples/cmake/find_package_static/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libbson. + +-cmake_minimum_required (VERSION 2.8) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (hello_bson LANGUAGES C) + +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.15) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (libmongoc + LANGUAGES C +--- a/src/libmongoc/examples/cmake-deprecated/find_package/CMakeLists.txt ++++ b/src/libmongoc/examples/cmake-deprecated/find_package/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libmongoc. + +-cmake_minimum_required (VERSION 2.8) ++cmake_minimum_required (VERSION 3.15) + + project (hello_mongoc LANGUAGES C) + +--- a/src/libmongoc/examples/cmake-deprecated/find_package_static/CMakeLists.txt ++++ b/src/libmongoc/examples/cmake-deprecated/find_package_static/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libmongoc. + +-cmake_minimum_required (VERSION 2.8) ++cmake_minimum_required (VERSION 3.15) + + project (hello_mongoc LANGUAGES C) + +--- a/src/libmongoc/examples/cmake/find_package/CMakeLists.txt ++++ b/src/libmongoc/examples/cmake/find_package/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libmongoc. + +-cmake_minimum_required (VERSION 3.0) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (hello_mongoc LANGUAGES C) + +--- a/src/libmongoc/examples/cmake/find_package_static/CMakeLists.txt ++++ b/src/libmongoc/examples/cmake/find_package_static/CMakeLists.txt +@@ -15,7 +15,7 @@ + # Demonstrates how to use the CMake 'find_package' mechanism to locate + # and build against libmongoc. + +-cmake_minimum_required (VERSION 3.0) ++cmake_minimum_required (VERSION 3.15...4.0) + + project (hello_mongoc LANGUAGES C) + +--- a/src/libmongoc/examples/cmake/vcpkg/CMakeLists.txt ++++ b/src/libmongoc/examples/cmake/vcpkg/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.15) ++cmake_minimum_required (VERSION 3.15...4.0) + project(vcpkg-example-project) + + find_package(mongoc CONFIG REQUIRED) +--- a/src/libmongoc/tests/cmake-import/CMakeLists.txt ++++ b/src/libmongoc/tests/cmake-import/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.15) ++cmake_minimum_required (VERSION 3.15...4.0) + project(ImportTestProject) + + include(CTest) +--- a/src/zlib-1.3.1/CMakeLists.txt ++++ b/src/zlib-1.3.1/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.4.4...3.15.0) ++cmake_minimum_required(VERSION 3.15.0) + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + + project(zlib C) diff --git a/dev-libs/mongo-c-driver/files/skip-tests.txt b/dev-libs/mongo-c-driver/files/skip-tests.txt deleted file mode 100644 index 0e3df23..0000000 --- a/dev-libs/mongo-c-driver/files/skip-tests.txt +++ /dev/null @@ -1,38 +0,0 @@ -# This file lists known failing or flaky tests that for some reason or another -# cannot be fixed and rather should be skipped in Evergreen builds. Note that -# listing a test in this file will result in the test being skipped on all -# platforms, build variants, tasks, etc. -# -# The format of this file is as follows: -# - one test per line, with an optional comment (total lines in file < 1,000) -# - comments begin with a hash (#) character and continue to the end of the line -# - lines starting with the comment character and blank lines are ignored -# - specify test names as they are known to the test runner (e.g., /some/test) -# - specify sub-tests of spec tests by an additional slash (/) and the quoted description -# (e.g., /some/spec/test/"sub-test 1") -# - placing a comment at the end of a line will cause the test runner to output -# the comment text as the skip reason when the test is skipped -# -# Example entries: -# /skip/entire/test # this will be output by the runner as the skip reason -# /skip/part/of/spec/test/"sub-test description" # this will also be output - -#/change_stream/live/track_resume_token # (CDRIVER-4344) Condition 'bson_compare (resume_token, &doc2_rt) == 0' failed -#/ClientPool/pop_timeout # (CDRIVER-4348) precondition failed: duration_usec / 1000 >= 1990 - -#/change_streams/legacy/change-streams # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] -#/change_streams/legacy/change-streams-resume-allowlist # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] -#/change_streams/legacy/change-streams-resume-errorLabels # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] -#/unified/entity-find-cursor # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] -#/change_streams/legacy/change-streams-errors # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] (on ASAN Tests Ubuntu 18.04 build variant) - -#/transactions/legacy/mongos-recovery-token/"commitTransaction retry fails on new mongos" # fails with server selection timeout (CDRIVER-4268) -#/transactions/legacy/pin-mongos/"unpin after transient error within a transaction and commit" # (CDRIVER-4351) server selection timeout (on ASAN Tests Ubuntu 18.04 build variant) -#/Samples # (CDRIVER-4352) strange "heartbeat failed" error - -#/client_side_encryption/bypass_spawning_mongocryptd/mongocryptdBypassSpawn # Fails if crypt_shared is visible - -/MongoDB/handshake/null_args #potentially gcc14 related - -/http/get # we dont run simplehttp on gentoo -/http/post # we dont run simplehttp on gentoo diff --git a/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5-r1.ebuild b/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5-r1.ebuild index d7ec832..d1dc1ac 100644 --- a/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5-r1.ebuild +++ b/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5-r1.ebuild @@ -4,12 +4,18 @@ EAPI=8 PYTHON_COMPAT=( python3_{11..14} pypy3_11 ) +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/mongo-c-driver.asc -inherit cmake dot-a python-any-r1 +inherit cmake dot-a python-any-r1 verify-sig DESCRIPTION="Client library written in C for MongoDB" HOMEPAGE="https://github.com/mongodb/mongo-c-driver" -SRC_URI="https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/${P}.tar.gz" +SRC_URI=" + https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/${P}.tar.gz + verify-sig? ( + https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/mongo-c-driver-${PV}.tar.gz.asc + ) +" LICENSE="Apache-2.0" SLOT="0" @@ -47,8 +53,14 @@ BDEPEND=" $(python_gen_any_dep ' dev-python/sphinx[${PYTHON_USEDEP}] ') + verify-sig? ( sec-keys/openpgp-keys-mongo-c-driver ) " +PATCHES=( + "${FILESDIR}"/mongo-c-driver-1.30.5-cmake4.patch +) + + python_check_deps() { python_has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" } @@ -60,6 +72,7 @@ src_prepare() { if use test; then mkdir -p src/libbson/tests/bson || die cp src/libbson/src/bson/bson-*.h src/libbson/tests/bson/ || die + cp src/libbson/src/bson/validate-private.h src/libbson/tests/bson/ || die fi # remove doc files @@ -69,6 +82,12 @@ src_prepare() { sed -i '/message (STATUS "disabling test-libmongoc since using system libbson")/{d}' CMakeLists.txt || die sed -i '/SET (ENABLE_TESTS OFF)/{d}' CMakeLists.txt || die sed -i 's##"bson/bson-private.h"#' src/libbson/tests/test-bson.c || die + sed -i 's##"bson/validate-private.h"#' src/libbson/tests/test-bson.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-iso8601.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-json.c || die + sed -i 's##"bson/bson-json-private.h"#' src/libbson/tests/test-json.c || die + sed -i 's##"bson/bson-context-private.h"#' src/libbson/tests/test-oid.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-oid.c || die } src_configure() { @@ -97,7 +116,33 @@ src_configure() { cmake_src_configure } +src_compile() { + cmake_src_compile + if use test; then + cmake_build mongo_c_driver_tests + cmake_build mongo_c_driver_examples + fi +} + src_test() { + local CMAKE_SKIP_TESTS=( + # FIXME needs setup + "mongoc/fixtures/fake_kms_provider_server/start" + # segfaults + "mongoc/Topology/invalidate_server/*" + # needs certificates + "mongoc/unified/kmsProviders*" + # depends on AWS + "mongoc/client_side_encryption/unified/*" + # Install test + "mongoc/CMake/*" + "mongoc/pkg-config/*" + # Condition 'count <= 1' failed. + "mongoc/Client/ipv6/single" + # error: "Failed to connect to: localhost" + "mongoc/azure/imds/http/talk" + "mongoc/gcp/http/talk" + ) export MONGOC_TEST_OFFLINE=on export MONGOC_TEST_SKIP_MOCK=on if ! use test-full; then @@ -113,8 +158,10 @@ src_test() { --logpath="${T}/mongod.log" || die fi - ../mongo-c-driver-${PV}_build/src/libmongoc/test-libmongoc \ - --skip-tests "${FILESDIR}/skip-tests.txt" || die +# ../mongo-c-driver-${PV}_build/src/libmongoc/test-libmongoc \ +# --skip-tests "${FILESDIR}/skip-tests.txt" || die + # parallel tests cause failures. + cmake_src_test -j1 kill $(<"${T}/mongod.lock") } diff --git a/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5.ebuild b/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5.ebuild index c4b7dd6..969afd7 100644 --- a/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5.ebuild +++ b/dev-libs/mongo-c-driver/mongo-c-driver-1.30.5.ebuild @@ -4,12 +4,18 @@ EAPI=8 PYTHON_COMPAT=( python3_{11..14} pypy3_11 ) +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/mongo-c-driver.asc -inherit cmake dot-a python-any-r1 +inherit cmake dot-a python-any-r1 verify-sig DESCRIPTION="Client library written in C for MongoDB" HOMEPAGE="https://github.com/mongodb/mongo-c-driver" -SRC_URI="https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/${P}.tar.gz" +SRC_URI=" + https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/${P}.tar.gz + verify-sig? ( + https://github.com/mongodb/mongo-c-driver/releases/download/${PV}/mongo-c-driver-${PV}.tar.gz.asc + ) +" LICENSE="Apache-2.0" SLOT="0" @@ -44,8 +50,14 @@ BDEPEND=" $(python_gen_any_dep ' dev-python/sphinx[${PYTHON_USEDEP}] ') + verify-sig? ( sec-keys/openpgp-keys-mongo-c-driver ) " +PATCHES=( + "${FILESDIR}"/mongo-c-driver-1.30.5-cmake4.patch +) + + python_check_deps() { python_has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" } @@ -57,6 +69,7 @@ src_prepare() { if use test; then mkdir -p src/libbson/tests/bson || die cp src/libbson/src/bson/bson-*.h src/libbson/tests/bson/ || die + cp src/libbson/src/bson/validate-private.h src/libbson/tests/bson/ || die fi # remove doc files @@ -66,6 +79,12 @@ src_prepare() { sed -i '/message (STATUS "disabling test-libmongoc since using system libbson")/{d}' CMakeLists.txt || die sed -i '/SET (ENABLE_TESTS OFF)/{d}' CMakeLists.txt || die sed -i 's##"bson/bson-private.h"#' src/libbson/tests/test-bson.c || die + sed -i 's##"bson/validate-private.h"#' src/libbson/tests/test-bson.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-iso8601.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-json.c || die + sed -i 's##"bson/bson-json-private.h"#' src/libbson/tests/test-json.c || die + sed -i 's##"bson/bson-context-private.h"#' src/libbson/tests/test-oid.c || die + sed -i 's##"bson/bson-iso8601-private.h"#' src/libbson/tests/test-oid.c || die } src_configure() { @@ -94,7 +113,33 @@ src_configure() { cmake_src_configure } +src_compile() { + cmake_src_compile + if use test; then + cmake_build mongo_c_driver_tests + cmake_build mongo_c_driver_examples + fi +} + src_test() { + local CMAKE_SKIP_TESTS=( + # FIXME needs setup + "mongoc/fixtures/fake_kms_provider_server/start" + # segfaults + "mongoc/Topology/invalidate_server/*" + # needs certificates + "mongoc/unified/kmsProviders*" + # depends on AWS + "mongoc/client_side_encryption/unified/*" + # Install test + "mongoc/CMake/*" + "mongoc/pkg-config/*" + # Condition 'count <= 1' failed. + "mongoc/Client/ipv6/single" + # error: "Failed to connect to: localhost" + "mongoc/azure/imds/http/talk" + "mongoc/gcp/http/talk" + ) export MONGOC_TEST_OFFLINE=on export MONGOC_TEST_SKIP_MOCK=on if ! use test-full; then @@ -110,8 +155,10 @@ src_test() { --logpath="${T}/mongod.log" || die fi - ../mongo-c-driver-${PV}_build/src/libmongoc/test-libmongoc \ - --skip-tests "${FILESDIR}/skip-tests.txt" || die +# ../mongo-c-driver-${PV}_build/src/libmongoc/test-libmongoc \ +# --skip-tests "${FILESDIR}/skip-tests.txt" || die + # parallel tests cause failures. + cmake_src_test -j1 kill $(<"${T}/mongod.lock") }