From 9d7bf9b3643b522dd4d0edb142af7c5236a3eeaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20F=C3=B6rster?= Date: Thu, 3 Oct 2024 23:34:50 +0200 Subject: [PATCH] [dev-db/mongodb] bump to 7 doesn't really work on clang, needs variant removal backport as 6 does --- dev-db/mongodb/Manifest | 1 + .../mongodb/files/mongodb-7.0.14-gcc-15.patch | 13 + .../files/mongodb-7.0.14-sconstruct.patch | 159 +++++++++ .../files/mongodb-7.0.14-system-boost.patch | 320 ++++++++++++++++++ dev-db/mongodb/mongodb-6.0.18.ebuild | 2 +- dev-db/mongodb/mongodb-7.0.14.ebuild | 265 +++++++++++++++ 6 files changed, 759 insertions(+), 1 deletion(-) create mode 100644 dev-db/mongodb/files/mongodb-7.0.14-gcc-15.patch create mode 100644 dev-db/mongodb/files/mongodb-7.0.14-sconstruct.patch create mode 100644 dev-db/mongodb/files/mongodb-7.0.14-system-boost.patch create mode 100644 dev-db/mongodb/mongodb-7.0.14.ebuild diff --git a/dev-db/mongodb/Manifest b/dev-db/mongodb/Manifest index 1b150f5..b89ab56 100644 --- a/dev-db/mongodb/Manifest +++ b/dev-db/mongodb/Manifest @@ -1,2 +1,3 @@ DIST mongodb-5.0.29.tar.gz 57306690 BLAKE2B 53560d7ae00f0940d127a869603a954ed87d11bf3884de5188d058a93a14502e3d2f7abef842ef443873231cd5b9acce3a519b45a173fe540887ff35a3219dc3 SHA512 086ad9c481f314d3409b75d3231b1d3e56eb292af980f1037e4e259bea7d07d0f075f3b9c91931341a187c20fda400cd38cf6d0a527c12cd3349a6270df66d56 DIST mongodb-6.0.18.tar.gz 87621559 BLAKE2B 3199184268de5d7c7ea15dd36b117a6039beda63629dec9c4931b80f43af1e9b94a673e81e0e2fe12e9a19328c4ddac2a82d05b9fe509b81a6f8957d00ce1cf4 SHA512 4861da8295937e7b0a48b190ff0465bd396dd056e55835243596b7aba0ff7e7eb7bbca8f2675fc999adb94d0804948cf74fb22159ab2daf55c7f0ddb2e43aefb +DIST mongodb-7.0.14.tar.gz 87128519 BLAKE2B ce4d3485ab1e332518dfa95ab887161497e4a5bc0a72635d68fe76334690bf790f0457cebdcabb20ab085dceb6ec8af315ba9839c32800c50935141359809b44 SHA512 1b86add0906da3d9a654dcd9dd286fda77a9e268dd5543a563559fb6e3a557affeaae88b4e0595430efbea7c66be4e366a2c8402016c6923c0d5f078bcf4e405 diff --git a/dev-db/mongodb/files/mongodb-7.0.14-gcc-15.patch b/dev-db/mongodb/files/mongodb-7.0.14-gcc-15.patch new file mode 100644 index 0000000..f029797 --- /dev/null +++ b/dev-db/mongodb/files/mongodb-7.0.14-gcc-15.patch @@ -0,0 +1,13 @@ +https://github.com/abseil/abseil-cpp/commit/809e5de7b92950849289236a5a09e9cb4f32c7b9 +diff --git a/src/third_party/abseil-cpp/dist/absl/container/internal/container_memory.h b/src/third_party/abseil-cpp/dist/absl/container/internal/container_memory.h +index e67529ecb6e..d777480d604 100644 +--- a/src/third_party/abseil-cpp/dist/absl/container/internal/container_memory.h ++++ b/src/third_party/abseil-cpp/dist/absl/container/internal/container_memory.h +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + #include + #include diff --git a/dev-db/mongodb/files/mongodb-7.0.14-sconstruct.patch b/dev-db/mongodb/files/mongodb-7.0.14-sconstruct.patch new file mode 100644 index 0000000..822bd81 --- /dev/null +++ b/dev-db/mongodb/files/mongodb-7.0.14-sconstruct.patch @@ -0,0 +1,159 @@ +diff --git a/SConstruct b/SConstruct +index 92d557b..80ee9e8 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -23,7 +23,6 @@ from pkg_resources import parse_version + + import SCons + import SCons.Script +-from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics + from site_scons.mongo import build_profiles + + # This must be first, even before EnsureSConsVersion, if +@@ -1649,13 +1648,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption + + # The placement of this is intentional. Here we setup an atexit method to store tooling metrics. + # We should only register this function after env, env_vars and the parser have been properly initialized. +-SConsToolingMetrics.register_metrics( +- utc_starttime=datetime.utcnow(), +- artifact_dir=env.Dir('$BUILD_DIR').get_abspath(), +- env_vars=env_vars, +- env=env, +- parser=_parser, +-) + + if get_option('build-metrics'): + env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR' +@@ -3026,7 +3018,6 @@ if env.TargetOSIs('posix'): + env.Append( + CCFLAGS=[ + "-fasynchronous-unwind-tables", +- "-g2" if not env.TargetOSIs('emscripten') else "-g", + "-Wall", + "-Wsign-compare", + "-Wno-unknown-pragmas", +@@ -3093,6 +3084,8 @@ if env.TargetOSIs('posix'): + + # env.Append( " -Wconversion" ) TODO: this doesn't really work yet + env.Append(CXXFLAGS=["-Woverloaded-virtual"]) ++ env.Append(CXXFLAGS=os.environ['CXXFLAGS']) ++ env.Append(LINKFLAGS=os.environ['LDFLAGS']) + + # On OS X, clang doesn't want the pthread flag at link time, or it + # issues warnings which make it impossible for us to declare link +@@ -3143,7 +3136,7 @@ if env.TargetOSIs('posix'): + ], ) + + #make scons colorgcc friendly +- for key in ('HOME', 'TERM'): ++ for key in ('HOME', 'TERM', 'PATH'): + try: + env['ENV'][key] = os.environ[key] + except KeyError: +@@ -3543,33 +3536,6 @@ def doConfigure(myenv): + myenv.AddMethod( + functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported") + +- if myenv.ToolchainIs('gcc', 'clang'): +- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker +- # because it is much faster. Don't use it if the user has already configured another linker +- # selection manually. +- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']): +- myenv.FatalError( +- f"Use the '--linker' option instead of modifying the LINKFLAGS directly.") +- +- linker_ld = get_option('linker') +- if linker_ld == 'auto': +- if not env.TargetOSIs('darwin', 'macOS'): +- if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'): +- myenv.FatalError( +- f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'." +- ) +- elif link_model.startswith("dynamic") and linker_ld == 'bfd': +- # BFD is not supported due to issues with it causing warnings from some of +- # the third party libraries that mongodb is linked with: +- # https://jira.mongodb.org/browse/SERVER-49465 +- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.") +- else: +- if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'): +- myenv.FatalError(f"Linker {linker_ld} could not be configured.") +- +- if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'): +- myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single']) +- + detectCompiler = Configure( + myenv, + help=False, +@@ -4621,43 +4587,6 @@ def doConfigure(myenv): + if optBuild == "off" and myenv.ToolchainIs('clang') and env.TargetOSIs('darwin'): + myenv.AddToLINKFLAGSIfSupported("-Wl,-no_deduplicate") + +- # Apply any link time optimization settings as selected by the 'lto' option. +- if has_option('lto'): +- if myenv.ToolchainIs('msvc'): +- # Note that this is actually more aggressive than LTO, it is whole program +- # optimization due to /GL. However, this is historically what we have done for +- # windows, so we are keeping it. +- # +- # /GL implies /LTCG, so no need to say it in CCFLAGS, but we do need /LTCG on the +- # link flags. +- myenv.Append(CCFLAGS=['/GL']) +- myenv.Append(LINKFLAGS=['/LTCG']) +- myenv.Append(ARFLAGS=['/LTCG']) +- elif myenv.ToolchainIs('gcc', 'clang'): +- # For GCC and clang, the flag is -flto, and we need to pass it both on the compile +- # and link lines. +- if not myenv.AddToCCFLAGSIfSupported('-flto') or \ +- not myenv.AddToLINKFLAGSIfSupported('-flto'): +- myenv.ConfError("Link time optimization requested, " +- "but selected compiler does not honor -flto") +- +- if myenv.TargetOSIs('darwin'): +- myenv.AddToLINKFLAGSIfSupported('-Wl,-object_path_lto,${TARGET}.lto') +- else: +- # According to intel benchmarks -fno-plt increases perf +- # See PM-2215 +- if linker_ld != "gold": +- myenv.ConfError("lto compilation currently only works with the --linker=gold") +- if link_model != "object": +- myenv.ConfError( +- "lto compilation currently only works with the --link-model=object") +- if not myenv.AddToCCFLAGSIfSupported('-fno-plt') or \ +- not myenv.AddToLINKFLAGSIfSupported('-fno-plt'): +- myenv.ConfError("-fno-plt is not supported by the compiler") +- +- else: +- myenv.ConfError("Don't know how to enable --lto on current toolchain") +- + if get_option('runtime-hardening') == "on" and optBuild != "off": + # Older glibc doesn't work well with _FORTIFY_SOURCE=2. Selecting 2.11 as the minimum was an + # emperical decision, as that is the oldest non-broken glibc we seem to require. It is possible +@@ -5120,17 +5049,13 @@ def doConfigure(myenv): + "BOOST_LOG_NO_SHORTHAND_NAMES", + "BOOST_LOG_USE_NATIVE_SYSLOG", + "BOOST_LOG_WITHOUT_THREAD_ATTR", ++ "BOOST_LOG_DYN_LINK", + "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS", + "BOOST_SYSTEM_NO_DEPRECATED", + "BOOST_THREAD_USES_DATETIME", + ("BOOST_THREAD_VERSION", "5"), + ]) + +- if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk': +- conf.env.AppendUnique(CPPDEFINES=[ +- "BOOST_LOG_DYN_LINK", +- ]) +- + if use_system_version_of_library("boost"): + if not conf.CheckCXXHeader("boost/filesystem/operations.hpp"): + myenv.ConfError("can't find boost headers") +@@ -5327,6 +5252,9 @@ def doConfigure(myenv): + + mongoc_mode = get_option('use-system-mongo-c') + conf.env['MONGO_HAVE_LIBMONGOC'] = False ++ conf.env.ParseConfig('pkg-config libbson-1.0 libmongoc-1.0 --cflags') ++ conf.env['LIBDEPS_LIBBSON_SYSLIBDEP'] = 'bson-1.0' ++ + if mongoc_mode != 'off': + if conf.CheckLibWithHeader( + ["mongoc-1.0"], diff --git a/dev-db/mongodb/files/mongodb-7.0.14-system-boost.patch b/dev-db/mongodb/files/mongodb-7.0.14-system-boost.patch new file mode 100644 index 0000000..74c9749 --- /dev/null +++ b/dev-db/mongodb/files/mongodb-7.0.14-system-boost.patch @@ -0,0 +1,320 @@ +diff -u -r a/src/mongo/client/sdam/sdam_json_test_runner.cpp b/src/mongo/client/sdam/sdam_json_test_runner.cpp +--- a/src/mongo/client/sdam/sdam_json_test_runner.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/client/sdam/sdam_json_test_runner.cpp 2024-09-08 13:38:28.557633361 +0800 +@@ -33,6 +33,7 @@ + + #include + #include ++#include + #include + #include + #include +diff -u -r a/src/mongo/client/sdam/server_selection_json_test_runner.cpp b/src/mongo/client/sdam/server_selection_json_test_runner.cpp +--- a/src/mongo/client/sdam/server_selection_json_test_runner.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/client/sdam/server_selection_json_test_runner.cpp 2024-09-08 13:38:28.557633361 +0800 +@@ -33,6 +33,7 @@ + + #include + #include ++#include + #include + #include + +diff -u -r a/src/mongo/db/ftdc/file_manager.cpp b/src/mongo/db/ftdc/file_manager.cpp +--- a/src/mongo/db/ftdc/file_manager.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/ftdc/file_manager.cpp 2024-09-08 13:38:28.560966720 +0800 +@@ -33,6 +33,7 @@ + #include "mongo/db/ftdc/file_manager.h" + + #include ++#include + #include + #include + +diff -u -r a/src/mongo/db/ftdc/ftdc_test.cpp b/src/mongo/db/ftdc/ftdc_test.cpp +--- a/src/mongo/db/ftdc/ftdc_test.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/ftdc/ftdc_test.cpp 2024-09-08 13:38:28.560966720 +0800 +@@ -32,6 +32,7 @@ + #include "mongo/db/ftdc/ftdc_test.h" + + #include ++#include + #include + + #include "mongo/base/data_type_validated.h" +diff -u -r a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp +--- a/src/mongo/db/initialize_server_global_state.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/initialize_server_global_state.cpp 2024-09-08 13:44:23.743647036 +0800 +@@ -33,6 +33,7 @@ + #include "mongo/db/initialize_server_global_state.h" + #include "mongo/db/initialize_server_global_state_gen.h" + ++#include + #include + #include + #include +@@ -310,7 +311,7 @@ + << "\" should name a file, not a directory."); + } + +- if (!serverGlobalParams.logAppend && boost::filesystem::is_regular(absoluteLogpath)) { ++ if (!serverGlobalParams.logAppend && boost::filesystem::is_regular_file(absoluteLogpath)) { + std::string renameTarget = absoluteLogpath + "." + terseCurrentTimeForFilename(); + boost::system::error_code ec; + boost::filesystem::rename(absoluteLogpath, renameTarget, ec); +diff -u -r a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp +--- a/src/mongo/db/sorter/sorter_test.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/sorter/sorter_test.cpp 2024-09-08 13:38:28.564300078 +0800 +@@ -32,6 +32,7 @@ + #include "mongo/platform/basic.h" + + #include ++#include + #include + #include + +diff -u -r a/src/mongo/db/startup_recovery.cpp b/src/mongo/db/startup_recovery.cpp +--- a/src/mongo/db/startup_recovery.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/startup_recovery.cpp 2024-09-08 13:38:28.567633437 +0800 +@@ -29,6 +29,8 @@ + + #include "mongo/db/startup_recovery.h" + ++#include ++ + #include "mongo/db/catalog/collection_write_path.h" + #include "mongo/db/catalog/create_collection.h" + #include "mongo/db/catalog/database_holder.h" +diff -u -r a/src/mongo/db/startup_warnings_mongod.cpp b/src/mongo/db/startup_warnings_mongod.cpp +--- a/src/mongo/db/startup_warnings_mongod.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/startup_warnings_mongod.cpp 2024-09-08 13:40:57.852092056 +0800 +@@ -32,6 +32,7 @@ + + #include "mongo/db/startup_warnings_mongod.h" + ++#include + #include + #include + #ifndef _WIN32 +diff -u -r a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +--- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp 2024-09-08 13:45:35.370855295 +0800 +@@ -57,7 +57,7 @@ + // if called without a fully qualified path it asserts; that makes mongoperf fail. + // so make a warning. need a better solution longer term. + // massert(40389, str::stream() << "Couldn't find parent dir for file: " << file.string(),); +- if (!file.has_branch_path()) { ++ if (!file.has_parent_path()) { + LOGV2(22274, + "warning flushMyDirectory couldn't find parent dir for file: {file}", + "flushMyDirectory couldn't find parent dir for file", +@@ -66,7 +66,7 @@ + } + + +- boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts ++ boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts + + LOGV2_DEBUG(22275, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string()); + +diff -u -r a/src/mongo/db/storage/storage_engine_lock_file_test.cpp b/src/mongo/db/storage/storage_engine_lock_file_test.cpp +--- a/src/mongo/db/storage/storage_engine_lock_file_test.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/storage/storage_engine_lock_file_test.cpp 2024-09-08 13:38:28.570966795 +0800 +@@ -30,6 +30,7 @@ + #include "mongo/platform/basic.h" + + #include ++#include + #include + #include + +diff -u -r a/src/mongo/db/storage/storage_engine_metadata.cpp b/src/mongo/db/storage/storage_engine_metadata.cpp +--- a/src/mongo/db/storage/storage_engine_metadata.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/storage/storage_engine_metadata.cpp 2024-09-08 13:46:14.344483426 +0800 +@@ -222,7 +222,7 @@ + // if called without a fully qualified path it asserts; that makes mongoperf fail. + // so make a warning. need a better solution longer term. + // massert(13652, str::stream() << "Couldn't find parent dir for file: " << file.string(),); +- if (!file.has_branch_path()) { ++ if (!file.has_parent_path()) { + LOGV2(22283, + "warning flushMyDirectory couldn't find parent dir for file: {file}", + "flushMyDirectory couldn't find parent dir for file", +@@ -231,7 +231,7 @@ + } + + +- boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts ++ boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts + + LOGV2_DEBUG(22284, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string()); + +diff -u -r a/src/mongo/db/storage/wiredtiger/wiredtiger_c_api_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_c_api_test.cpp +--- a/src/mongo/db/storage/wiredtiger/wiredtiger_c_api_test.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_c_api_test.cpp 2024-09-08 13:38:28.570966795 +0800 +@@ -28,6 +28,7 @@ + */ + + #include ++#include + #include + #include + #include +diff -u -r a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 2024-09-08 13:38:28.574300153 +0800 +@@ -31,6 +31,7 @@ + #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" + + #include ++#include + #include + + #include "mongo/base/simple_string_data_comparator.h" +diff -u -r a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp +--- a/src/mongo/dbtests/framework_options.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/dbtests/framework_options.cpp 2024-09-08 13:41:53.502512039 +0800 +@@ -33,6 +33,8 @@ + + #include "mongo/dbtests/framework_options.h" + ++#include ++#include + #include + #include + +diff -u -r a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp +--- a/src/mongo/scripting/engine.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/scripting/engine.cpp 2024-09-08 13:38:28.577633512 +0800 +@@ -33,6 +33,7 @@ + #include "mongo/scripting/engine.h" + + #include ++#include + #include + + #include "mongo/base/string_data.h" +diff -u -r a/src/mongo/scripting/mozjs/module_loader.cpp b/src/mongo/scripting/mozjs/module_loader.cpp +--- a/src/mongo/scripting/mozjs/module_loader.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/scripting/mozjs/module_loader.cpp 2024-09-08 13:38:28.577633512 +0800 +@@ -28,6 +28,7 @@ + */ + + #include ++#include + + #include "mongo/logv2/log.h" + #include "mongo/scripting/mozjs/implscope.h" +diff -u -r a/src/mongo/shell/shell_utils_extended.cpp b/src/mongo/shell/shell_utils_extended.cpp +--- a/src/mongo/shell/shell_utils_extended.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/shell/shell_utils_extended.cpp 2024-09-08 13:42:27.456101736 +0800 +@@ -36,6 +36,8 @@ + #endif + + #include ++#include ++#include + #include + #include + #include +diff -u -r a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp +--- a/src/mongo/shell/shell_utils_launcher.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/shell/shell_utils_launcher.cpp 2024-09-08 13:47:56.188587429 +0800 +@@ -31,6 +31,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include +@@ -316,26 +318,26 @@ + boost::filesystem::directory_iterator i(from); + while (i != end) { + boost::filesystem::path p = *i; +- if (p.leaf() == "metrics.interim" || p.leaf() == "metrics.interim.temp") { ++ if (p.filename() == "metrics.interim" || p.filename() == "metrics.interim.temp") { + // Ignore any errors for metrics.interim* files as these may disappear during copy + boost::system::error_code ec; +- boost::filesystem::copy_file(p, to / p.leaf(), ec); ++ boost::filesystem::copy_file(p, to / p.filename(), ec); + if (ec) { + LOGV2_INFO(22814, + "Skipping copying of file from '{from}' to " + "'{to}' due to: {error}", + "Skipping copying of file due to error" + "from"_attr = p.generic_string(), +- "to"_attr = (to / p.leaf()).generic_string(), ++ "to"_attr = (to / p.filename()).generic_string(), + "error"_attr = ec.message()); + } +- } else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") { ++ } else if (p.filename() != "mongod.lock" && p.filename() != "WiredTiger.lock") { + if (boost::filesystem::is_directory(p)) { +- boost::filesystem::path newDir = to / p.leaf(); ++ boost::filesystem::path newDir = to / p.filename(); + boost::filesystem::create_directory(newDir); + copyDir(p, newDir); + } else { +- boost::filesystem::copy_file(p, to / p.leaf()); ++ boost::filesystem::copy_file(p, to / p.filename()); + } + } + ++i; +diff -u -r a/src/mongo/shell/shell_utils_launcher.h b/src/mongo/shell/shell_utils_launcher.h +--- a/src/mongo/shell/shell_utils_launcher.h 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/shell/shell_utils_launcher.h 2024-09-08 13:43:55.856769586 +0800 +@@ -29,7 +29,6 @@ + + #pragma once + +-#include + #include + #include + #include +diff -u -r a/src/mongo/unittest/golden_test_base.cpp b/src/mongo/unittest/golden_test_base.cpp +--- a/src/mongo/unittest/golden_test_base.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/unittest/golden_test_base.cpp 2024-09-08 13:48:19.232095193 +0800 +@@ -95,7 +95,7 @@ + fs::path outputRoot; + if (opts.outputRootPattern) { + fs::path pattern(*opts.outputRootPattern); +- outputRoot = pattern.parent_path() / fs::unique_path(pattern.leaf()); ++ outputRoot = pattern.parent_path() / fs::unique_path(pattern.filename()); + } else { + outputRoot = fs::temp_directory_path() / fs::unique_path("out-%%%%-%%%%-%%%%-%%%%"); + } +diff -u -r a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp +--- a/src/mongo/util/processinfo_linux.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/util/processinfo_linux.cpp 2024-09-08 13:43:30.446577565 +0800 +@@ -53,6 +53,7 @@ + #endif + + #include ++#include + #include + #include + #include +diff -u -r a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp +--- a/src/mongo/util/procparser.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/util/procparser.cpp 2024-09-08 13:38:28.584300228 +0800 +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -u -r a/src/mongo/util/stacktrace_threads.cpp b/src/mongo/util/stacktrace_threads.cpp +--- a/src/mongo/util/stacktrace_threads.cpp 2024-08-15 04:38:09.000000000 +0800 ++++ b/src/mongo/util/stacktrace_threads.cpp 2024-09-08 13:38:28.584300228 +0800 +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/dev-db/mongodb/mongodb-6.0.18.ebuild b/dev-db/mongodb/mongodb-6.0.18.ebuild index df09c0e..6b14395 100644 --- a/dev-db/mongodb/mongodb-6.0.18.ebuild +++ b/dev-db/mongodb/mongodb-6.0.18.ebuild @@ -3,7 +3,7 @@ EAPI=8 -LLVM_COMPAT=( 18 ) +LLVM_COMPAT=( {18..19} ) LLVM_OPTIONAL=1 PYTHON_COMPAT=( python3_{10..13} ) diff --git a/dev-db/mongodb/mongodb-7.0.14.ebuild b/dev-db/mongodb/mongodb-7.0.14.ebuild new file mode 100644 index 0000000..dd1f211 --- /dev/null +++ b/dev-db/mongodb/mongodb-7.0.14.ebuild @@ -0,0 +1,265 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( 18 ) +LLVM_OPTIONAL=1 + +PYTHON_COMPAT=( python3_{10..13} ) + +SCONS_MIN_VERSION="3.3.1" +CHECKREQS_DISK_BUILD="2400M" +CHECKREQS_DISK_USR="512M" +CHECKREQS_MEMORY="1024M" + +inherit check-reqs flag-o-matic llvm-r1 multiprocessing optfeature pax-utils python-any-r1 \ + scons-utils systemd tmpfiles toolchain-funcs + +MY_PV=r${PV/_rc/-rc} +MY_P=mongo-${MY_PV} + +DESCRIPTION="A high-performance, open source, schema-free document-oriented database" +HOMEPAGE="https://www.mongodb.com" +SRC_URI="https://github.com/mongodb/mongo/archive/refs/tags/${MY_PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="Apache-2.0 SSPL-1" +SLOT="0" +KEYWORDS="~amd64 ~arm64 -riscv" +CPU_FLAGS="cpu_flags_x86_avx" +IUSE="clang debug kerberos ssl ${CPU_FLAGS}" + +# https://github.com/mongodb/mongo/wiki/Test-The-Mongodb-Server +# resmoke needs python packages not yet present in Gentoo +RESTRICT="test" + +RDEPEND="acct-group/mongodb + acct-user/mongodb + >=app-arch/snappy-1.1.7:= + app-arch/zstd:= + >=dev-cpp/yaml-cpp-0.6.2:= + dev-libs/boost:=[nls] + >=dev-libs/libpcre2-10.40:= + dev-libs/snowball-stemmer:= + net-misc/curl + >=sys-libs/zlib-1.2.12:= + clang? ( + $(llvm_gen_dep " + sys-devel/clang:\${LLVM_SLOT} + ") + ) + kerberos? ( dev-libs/cyrus-sasl[kerberos] ) + ssl? ( + >=dev-libs/openssl-1.0.1g:0= + )" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + sys-libs/ncurses:0= + sys-libs/readline:0= + debug? ( dev-debug/valgrind )" +BDEPEND=" + $(python_gen_any_dep ' + >=dev-build/scons-3.1.1[${PYTHON_USEDEP}] + dev-python/cheetah3[${PYTHON_USEDEP}] + dev-python/psutil[${PYTHON_USEDEP}] + dev-python/pymongo[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/regex[${PYTHON_USEDEP}] + dev-python/typing-extensions[${PYTHON_USEDEP}] + ') +" + +PATCHES=( + "${FILESDIR}/${PN}-5.0.2-no-compass.patch" + "${FILESDIR}/${PN}-5.0.2-skip-reqs-check.patch" + "${FILESDIR}/${PN}-7.0.14-sconstruct.patch" + "${FILESDIR}/${PN}-4.4.29-no-enterprise.patch" + "${FILESDIR}/${PN}-7.0.14-system-boost.patch" + "${FILESDIR}/${PN}-7.0.14-gcc-15.patch" +) + +python_check_deps() { + python_has_version -b ">=dev-build/scons-3.1.1[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/cheetah3[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/psutil[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/pymongo[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/pyyaml[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/regex[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/typing-extensions[${PYTHON_USEDEP}]" +} + +pkg_pretend() { + # Bug 809692 + 890294 + if use amd64 && ! use cpu_flags_x86_avx; then + ewarn "MongoDB 7.0 requires use of the AVX instruction set." + ewarn "This ebuild will use --experimental-optimization=-sandybridge which" + ewarn "will result in an experimental build of MongoDB as per upstream." + ewarn "https://docs.mongodb.com/v7.0/administration/production-notes/" + fi + + if [[ -n ${REPLACING_VERSIONS} ]]; then + if ver_test "$REPLACING_VERSIONS" -lt 6.0; then + ewarn "To upgrade from a version earlier than the 6.0-series, you must" + ewarn "successively upgrade major releases until you have upgraded" + ewarn "to 6.0-series. Then upgrade to 7.0 series." + else + ewarn "Be sure to set featureCompatibilityVersion to 6.0 before upgrading." + fi + fi +} + +pkg_setup() { + python-any-r1_pkg_setup + if use clang; then + llvm-r1_pkg_setup + llvm_fix_tool_path CC CXX + fi +} + +src_prepare() { + default + + # remove bundled libs + rm -r src/third_party/{boost,pcre2,snappy-*,yaml-cpp,zlib} || die + + # remove compass + rm -r src/mongo/installer/compass || die +} + +src_configure() { + # --use-system-tcmalloc is strongly NOT recommended: + # for MONGO_GIT_HASH use GitOrigin-RevId from the commit of the tag + scons_opts=( + VERBOSE=1 + VARIANT_DIR=gentoo + MONGO_VERSION="${PV}" + MONGO_GIT_HASH="ce59cfc6a3c5e5c067dca0d30697edd68d4f5188" + + --disable-warnings-as-errors + --force-jobs # Reapply #906897, fix #935274 + --jobs="$(makeopts_jobs)" + --use-system-boost + --use-system-pcre2 + --use-system-snappy + --use-system-stemmer + --use-system-yaml + --use-system-zlib + --use-system-zstd + ) + + local have_switched_compiler= + if use clang && ! tc-is-clang; then + # Force clang + local version_clang=$(clang --version 2>/dev/null | grep -F -- 'clang version' | awk '{ print $3 }') + [[ -n ${version_clang} ]] && version_clang=$(ver_cut 1 "${version_clang}") + [[ -z ${version_clang} ]] && die "Failed to read clang version!" + + if tc-is-gcc; then + have_switched_compiler=yes + fi + + AR=llvm-ar + CC=${CHOST}-clang-${version_clang} + CXX=${CHOST}-clang++-${version_clang} + + scons_opts+=( + AR="$(get_llvm_prefix)/bin/${AR}" + CC="$(get_llvm_prefix)/bin/${CC}" + CXX="$(get_llvm_prefix)/bin/${CXX}" + ) + elif ! use clang && ! tc-is-gcc ; then + # Force gcc + have_switched_compiler=yes + AR=gcc-ar + CC=${CHOST}-gcc + CXX=${CHOST}-g++ + scons_opts+=( + AR="${AR}" + CC="${CC}" + CXX="${CXX}" + ) + else + scons_opts+=( + AR="$(tc-getAR)" + CC="$(tc-getCC)" + CXX="$(tc-getCXX)" + ) + fi + + if [[ -n "${have_switched_compiler}" ]] ; then + # Because we switched active compiler we have to ensure + # that no unsupported flags are set + strip-unsupported-flags + scons_opts+=( + CCFLAGS="${CXXFLAGS}" + ) + fi + + use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300 + use amd64 && scons_opts+=( --experimental-optimization=-sandybridge ) # Bug 890294 + use debug && scons_opts+=( --dbg=on ) + use kerberos && scons_opts+=( --use-sasl-client ) + + scons_opts+=( --ssl=$(usex ssl on off) ) + + # Needed to avoid forcing FORTIFY_SOURCE + # Gentoo's toolchain applies these anyway + scons_opts+=( --runtime-hardening=off ) + + # gold is an option here but we don't really do that anymore + if tc-ld-is-lld; then + scons_opts+=( --linker=lld ) + else + scons_opts+=( --linker=bfd ) + fi + + # respect mongoDB upstream's basic recommendations + # see bug #536688 and #526114 + if ! use debug; then + filter-flags '-m*' + filter-flags '-O?' + fi + + default +} + +src_compile() { + PREFIX="${EPREFIX}/usr" ./buildscripts/scons.py "${scons_opts[@]}" install-devcore || die +} + +src_install() { + dobin build/install/bin/{mongo,mongod,mongos} + + doman debian/mongo*.{1,5} + dodoc README.md docs/building.md + + newinitd "${FILESDIR}/${PN}.initd-r3" ${PN} + newconfd "${FILESDIR}/${PN}.confd-r3" ${PN} + newinitd "${FILESDIR}/mongos.initd-r3" mongos + newconfd "${FILESDIR}/mongos.confd-r3" mongos + + insinto /etc + newins "${FILESDIR}/${PN}.conf-r4" ${PN}.conf + newins "${FILESDIR}/mongos.conf-r3" mongos.conf + + systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service" + + newtmpfiles "${FILESDIR}"/mongodb.tmpfiles mongodb.conf + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/${PN}.logrotate" ${PN} + + # see bug #526114 + pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos} +} + +pkg_postinst() { + tmpfiles_process mongodb.conf + + ewarn "Make sure to read the release notes and follow the upgrade process:" + ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/" + ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures" + optfeature "MongoDB Shell" app-admin/mongosh-bin + optfeature "MongoDB tools (mongoimport, mongodump...)" app-admin/mongo-tools +}