mongodb: backport fixes to wrynose from master
cover mongodb: backport fixes to wrynose from master
From: Awais B <[email protected]>
These commits are backported from master to allow building mongodb on wrynose cleanly.
Awais Belal (2):
mongodb: fix build with python 3.12
mongodb: update to 4.4.29
Gyorgy Sarvari (2):
mongodb: upgrade 4.4.29 -> 4.4.30
mongodb: ignore CVE-2025-14911
Khem Raj (3):
mongodb: Fix build with current python, SCons, clang and OpenSSL
mongodb: Backport fix for SERVER-49099
mongodb: Keep build paths out of buildInfo
...stead-of-pkg_resources-for-version-p.patch | 51 +++++ ...001-free_mon-Include-missing-cstdint.patch | 28 --- ...econfig.py-python-3.12-compatibility.patch | 57 ++++++ ...call-to-CheckLibWithHeader-as-a-keyw.patch | 56 ++++++ .../0003-boost-Fix-build-with-clang-23.patch | 176 ++++++++++++++++++ .../0004-ssl-Fix-build-with-OpenSSL-4.patch | 117 ++++++++++++ ...ove-the-Node-swap-function-in-Biggie.patch | 58 ++++++ .../mongodb/mongodb/oe-buildinfo.vars | 11 ++ .../recipes-dbs/mongodb/mongodb_git.bb | 20 +- 9 files changed, 539 insertions(+), 35 deletions(-) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-packaging-instead-of-pkg_resources-for-version-p.patch delete mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-SConstruct-Pass-call-to-CheckLibWithHeader-as-a-keyw.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-boost-Fix-build-with-clang-23.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-ssl-Fix-build-with-OpenSSL-4.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0005-SERVER-49099-Remove-the-Node-swap-function-in-Biggie.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/oe-buildinfo.vars
Signature · 1 line
2.34.1
PATCH 1/7 mongodb: fix build with python 3.12
The moduleconfig.py build script uses the 'imp' module which is deprecated in favor of 'importlib' in python 3.12. This fixes the build issue by replacing the affected portion of the code and the package now builds fine on hosts with python 3.12.
--- ...econfig.py-python-3.12-compatibility.patch | 57 +++++++++++++++++++ .../recipes-dbs/mongodb/mongodb_git.bb | 3 +- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch new file +57 -0
@@ -0,0 +1,57 @@ +From 37580777bc5294d606584f3731d9f5f5425bb587 Mon Sep 17 00:00:00 2001 +From: Awais B <[email protected]> +Date: Tue, 4 Mar 2025 11:27:10 +0000 +Subject: [PATCH] moduleconfig.py: python 3.12 compatibility + +The imp module was deprecated in python 3.4 and is dropped +with python 3.12. We now need to use importlib for the +purpose of manipulating/loading modules. + +Upstream-Status: Pending +Signed-off-by: Awais B <[email protected]> +--- + buildscripts/moduleconfig.py | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/buildscripts/moduleconfig.py b/buildscripts/moduleconfig.py +index b4d0bba0490..69dd91ab30d 100644 +--- a/buildscripts/moduleconfig.py ++++ b/buildscripts/moduleconfig.py +@@ -27,7 +27,8 @@ MongoDB SConscript files do. + __all__ = ('discover_modules', 'discover_module_directories', 'configure_modules', + 'register_module_test') # pylint: disable=undefined-all-variable + +-import imp ++import importlib ++import sys + import inspect + import os + +@@ -71,12 +72,18 @@ def discover_modules(module_root, allowed_modules): + print("adding module: %s" % (name)) + fp = open(build_py, "r") + try: +- module = imp.load_module("module_" + name, fp, build_py, +- (".py", "r", imp.PY_SOURCE)) +- if getattr(module, "name", None) is None: +- module.name = name +- found_modules.append(module) +- found_module_names.append(name) ++ module_name = "module_" + name ++ module_spec = importlib.util.spec_from_file_location(module_name, build_py) ++ ++ if module_spec is not None: ++ module = importlib.util.module_from_spec(module_spec) ++ sys.modules[module_name] = module ++ module_spec.loader.exec_module(module) ++ ++ if not hasattr(module, "name"): ++ module.name = name ++ found_modules.append(module) ++ found_module_names.append(name) + finally: + fp.close() + except (FileNotFoundError, IOError): +-- +2.34.1 +
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -2
@@ -36,6 +36,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0001-apply-msvc-workaround-for-clang-16.patch \ file://0001-Fix-type-mismatch-on-32bit-arches.patch \ file://0001-Fix-build-on-32bit.patch \ + file://0001-moduleconfig.py-python-3.12-compatibility.patch \ " SRC_URI:append:libc-musl = "\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
@@ -140,5 +141,3 @@ SYSTEMD_SERVICE:${PN} = "mongod.service" FILES:${PN} += "${nonarch_libdir}/tmpfiles.d" RDEPENDS:${PN} += "tzdata-core" - -SKIP_RECIPE[mongodb] ?= "Needs porting to python 3.12"
Signature · 1 line
2.34.1
PATCH 2/7 mongodb: update to 4.4.29
In reply to Awais BelalMove on to 4.4.29 and drop a patch that is not applicable anymore.
--- ...001-free_mon-Include-missing-cstdint.patch | 28 ------------------- .../recipes-dbs/mongodb/mongodb_git.bb | 7 ++--- 2 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch deleted +0 -28
@@ -1,28 +0,0 @@ -From 5d8218b8a1b5bc71e2a0cf543a000e194daba599 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sun, 29 Jan 2023 17:15:30 -0800 -Subject: [PATCH] free_mon: Include missing <cstdint> - -gcc 13 moved some includes around and as a result <cstdint> is no -longer transitively included [1]. Explicitly include it -for uintXX_t. - -[1] https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes - -Signed-off-by: Khem Raj <[email protected]> - -Upstream-Status: Pending ---- - src/mongo/db/free_mon/free_mon_options.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/src/mongo/db/free_mon/free_mon_options.h -+++ b/src/mongo/db/free_mon/free_mon_options.h -@@ -29,6 +29,7 @@ - - #pragma once - -+#include <cstdint> - #include <string> - #include <vector> -
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +3 -4
@@ -11,9 +11,9 @@ DEPENDS = "openssl libpcap zlib boost curl python3 \ inherit scons dos2unix siteinfo python3native systemd useradd -PV = "4.4.24" -#v4.4.24 -SRCREV = "0b86b9b7b42ad9970c5f818c527dd86c0634243a" +PV = "4.4.29" +#v4.4.29 +SRCREV = "89d6ffe6fc67b36fd47aff6425087003966588e3" SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ file://0001-Use-long-long-instead-of-int64_t.patch \
@@ -32,7 +32,6 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0001-add-explict-static_cast-size_t-to-maxMemoryUsageByte.patch \ file://0001-server-Adjust-the-cache-alignment-assumptions.patch \ file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \ - file://0001-free_mon-Include-missing-cstdint.patch \ file://0001-apply-msvc-workaround-for-clang-16.patch \ file://0001-Fix-type-mismatch-on-32bit-arches.patch \ file://0001-Fix-build-on-32bit.patch \
Signature · 1 line
2.34.1
PATCH 3/7 mongodb: upgrade 4.4.29 -> 4.4.30
In reply to Awais BelalFrom: Gyorgy Sarvari <[email protected]>
This is a security release to fix CVE-2025-14847:
https://nvd.nist.gov/vuln/detail/CVE-2025-14847
--- .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +3 -3
@@ -11,9 +11,9 @@ DEPENDS = "openssl libpcap zlib boost curl python3 \ inherit scons dos2unix siteinfo python3native systemd useradd -PV = "4.4.29" -#v4.4.29 -SRCREV = "89d6ffe6fc67b36fd47aff6425087003966588e3" +PV = "4.4.30" +#v4.4.30 +SRCREV = "1ae4c9990dbc5711f3500748f0c3f8b5d375d8c0" SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ file://0001-Use-long-long-instead-of-int64_t.patch \
Signature · 1 line
2.34.1
PATCH 4/7 mongodb: ignore CVE-2025-14911
In reply to Awais BelalFrom: Gyorgy Sarvari <[email protected]>
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-14911
The CVE is currently tracked without valid CPE. The vulnerability affects mongo-c-driver component, not mongodb. They are also stored in different repositories.
Due to this, ignore this CVE.
--- .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 1 + 1 file changed, 1 insertion(+)
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -0
@@ -51,6 +51,7 @@ SRC_URI:append:toolchain-clang = "\ CVE_STATUS[CVE-2014-8180] = "not-applicable-config: Not affecting our configuration so it can be safely ignored." CVE_STATUS[CVE-2017-2665] = "not-applicable-config: Not affecting our configuration so it can be safely ignored." +CVE_STATUS[CVE-2025-14911] = "cpe-incorrect: The vulnerability is about mongo-c-driver application, not mongodb" COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
Signature · 1 line
2.34.1
PATCH 5/7 mongodb: Fix build with current python, SCons, clang and OpenSSL
In reply to Awais BelalFrom: Khem Raj <[email protected]>
mongodb was re-enabled after having been skipped, and no longer builds with the current toolchain and dependencies:
- setuptools 84 does not provide pkg_resources anymore; use packaging.version to parse versions
- SCons 4.11 added an extra_libs parameter ahead of call in CheckLibWithHeader(), so the positional call snippet was split into bogus -l options and the OpenSSL check failed; pass call as a keyword
- clang 23 rejects out of range enum values in the bundled Boost 1.70 mpl::integral_c uses and a typo in Boost.Thread; backport the fixes from newer Boost
- OpenSSL 4 makes ASN1_STRING opaque and removes ASN1_STRING_data() and ERR_remove_state(); use the accessors available since OpenSSL 1.1
AI-Generated: Uses Claude Code
--- ...stead-of-pkg_resources-for-version-p.patch | 51 +++++ ...call-to-CheckLibWithHeader-as-a-keyw.patch | 56 ++++++ .../0003-boost-Fix-build-with-clang-23.patch | 176 ++++++++++++++++++ .../0004-ssl-Fix-build-with-OpenSSL-4.patch | 117 ++++++++++++ .../recipes-dbs/mongodb/mongodb_git.bb | 6 +- 5 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-packaging-instead-of-pkg_resources-for-version-p.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-SConstruct-Pass-call-to-CheckLibWithHeader-as-a-keyw.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-boost-Fix-build-with-clang-23.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-ssl-Fix-build-with-OpenSSL-4.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-packaging-instead-of-pkg_resources-for-version-p.patch new file +51 -0
@@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Mon, 9 Nov 2026 07:45:00 -0800 +Subject: [PATCH] Use packaging instead of pkg_resources for version parsing + +pkg_resources has been removed from setuptools, so SConstruct fails to +load with: + + ModuleNotFoundError: No module named 'pkg_resources' + +Use parse() from the packaging module instead. + +Upstream-Status: Inappropriate [v4.4 branch is EOL] +Signed-off-by: Khem Raj <[email protected]> +--- +diff --git a/SConstruct b/SConstruct +--- a/SConstruct ++++ b/SConstruct +@@ -16,7 +16,7 @@ + import uuid + from glob import glob + +-from pkg_resources import parse_version ++from packaging.version import parse as parse_version + + import SCons + +diff --git a/site_scons/site_tools/ccache.py b/site_scons/site_tools/ccache.py +--- a/site_scons/site_tools/ccache.py ++++ b/site_scons/site_tools/ccache.py +@@ -26,7 +26,7 @@ + import subprocess + + import SCons +-from pkg_resources import parse_version ++from packaging.version import parse as parse_version + + # This is the oldest version of ccache that offers support for -gsplit-dwarf + _ccache_version_min = parse_version("3.2.3") +diff --git a/site_scons/site_tools/icecream.py b/site_scons/site_tools/icecream.py +--- a/site_scons/site_tools/icecream.py ++++ b/site_scons/site_tools/icecream.py +@@ -25,7 +25,7 @@ + import subprocess + import urllib + +-from pkg_resources import parse_version ++from packaging.version import parse as parse_version + + import SCons +
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-SConstruct-Pass-call-to-CheckLibWithHeader-as-a-keyw.patch new file +56 -0
56 lines not on this page · raw message
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-boost-Fix-build-with-clang-23.patch new file +176 -0
176 lines not on this page · raw message
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-ssl-Fix-build-with-OpenSSL-4.patch new file +117 -0
117 lines not on this page · raw message
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +5 -1
@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://LICENSE-Community.txt;md5=3a865f27f11f43ecbe542d9ea38 file://APACHE-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" DEPENDS = "openssl libpcap zlib boost curl python3 \ - python3-setuptools-native \ + python3-packaging-native python3-setuptools-native \ python3-pyyaml-native python3-cheetah-native \ python3-psutil-native python3-regex-native \ "
@@ -36,6 +36,10 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0001-Fix-type-mismatch-on-32bit-arches.patch \ file://0001-Fix-build-on-32bit.patch \ file://0001-moduleconfig.py-python-3.12-compatibility.patch \ + file://0001-Use-packaging-instead-of-pkg_resources-for-version-p.patch \ + file://0002-SConstruct-Pass-call-to-CheckLibWithHeader-as-a-keyw.patch \ + file://0003-boost-Fix-build-with-clang-23.patch \ + file://0004-ssl-Fix-build-with-OpenSSL-4.patch \ " SRC_URI:append:libc-musl = "\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
Signature · 1 line
2.34.1
PATCH 6/7 mongodb: Backport fix for SERVER-49099
In reply to Awais BelalFrom: Khem Raj <[email protected]>
The Node and Head swap() friends and the copy-and-swap assignment operators in Biggie store.h are unused and refer to members that do not exist. Backport the upstream removal.
AI-Generated: Uses Claude Code
--- ...ove-the-Node-swap-function-in-Biggie.patch | 58 +++++++++++++++++++ .../recipes-dbs/mongodb/mongodb_git.bb | 1 + 2 files changed, 59 insertions(+) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0005-SERVER-49099-Remove-the-Node-swap-function-in-Biggie.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0005-SERVER-49099-Remove-the-Node-swap-function-in-Biggie.patch new file +58 -0
@@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yuhong Zhang <[email protected]> +Date: Thu, 9 Jul 2020 15:43:33 +0000 +Subject: [PATCH] SERVER-49099 Remove the Node::swap() function in Biggie + +The Node and Head swap() friends and the copy-and-swap assignment +operators built on them are unused and do not compile: Node::swap() +does not exist and Node has no trieKey, depth, data or children +members (they are _-prefixed). This went unnoticed because they are +in a class template that never instantiates them. + +Upstream-Status: Backport [https://github.com/mongodb/mongo/commit/77ffbcb4f5673b154fe64872cba9f34ce97bc55d] +Signed-off-by: Khem Raj <[email protected]> +--- + src/mongo/db/storage/biggie/store.h | 21 --------------------- + 1 file changed, 21 deletions(-) + +diff --git a/src/mongo/db/storage/biggie/store.h b/src/mongo/db/storage/biggie/store.h +index a09b5b4..aeaa337 100644 +--- a/src/mongo/db/storage/biggie/store.h ++++ b/src/mongo/db/storage/biggie/store.h +@@ -809,18 +809,6 @@ private: + + virtual ~Node() = default; + +- friend void swap(Node& first, Node& second) { +- std::swap(first.trieKey, second.trieKey); +- std::swap(first.depth, second.depth); +- std::swap(first.data, second.data); +- std::swap(first.children, second.children); +- } +- +- Node& operator=(const Node other) { +- swap(*this, other); +- return *this; +- } +- + bool isLeaf() const { + for (auto child : _children) { + if (child != nullptr) +@@ -855,17 +843,8 @@ private: + _nextVersion->_hasPreviousVersion = false; + } + +- friend void swap(Head& first, Head& second) { +- Node::swap(first, second); +- } +- + Head(Head&& other) : Node(std::move(other)) {} + +- Head& operator=(const Head other) { +- swap(*this, other); +- return *this; +- } +- + bool hasPreviousVersion() const { + return _hasPreviousVersion; + }
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -0
@@ -40,6 +40,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0002-SConstruct-Pass-call-to-CheckLibWithHeader-as-a-keyw.patch \ file://0003-boost-Fix-build-with-clang-23.patch \ file://0004-ssl-Fix-build-with-OpenSSL-4.patch \ + file://0005-SERVER-49099-Remove-the-Node-swap-function-in-Biggie.patch \ " SRC_URI:append:libc-musl = "\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
Signature · 1 line
2.34.1
PATCH 7/7 mongodb: Keep build paths out of buildInfo
In reply to Awais BelalFrom: Khem Raj <[email protected]>
By default buildInfo embeds the compiler version string and CCFLAGS, CXXFLAGS and LINKFLAGS, which carry --sysroot and -ffile-prefix-map paths into mongod and mongos and trigger buildpaths QA warnings. Pass a variables file that drops those entries from MONGO_BUILDINFO_ENVIRONMENT_DATA.
--- .../recipes-dbs/mongodb/mongodb/oe-buildinfo.vars | 11 +++++++++++ .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/oe-buildinfo.vars
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/oe-buildinfo.vars new file +11 -0
@@ -0,0 +1,11 @@ +# Keep the compiler and its flags, which carry build paths, out of +# the buildInfo command and --version output +from mongo.generators import default_buildinfo_environment_data + +MONGO_BUILDINFO_ENVIRONMENT_DATA = { + k: v for k, v in default_buildinfo_environment_data().items() + if k not in ('cc', 'ccflags', 'cxx', 'cxxflags', 'linkflags') +} + +# SConstruct rejects unknown names left in a variables file +del default_buildinfo_environment_data
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +2 -0
@@ -41,6 +41,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4;protocol=https \ file://0003-boost-Fix-build-with-clang-23.patch \ file://0004-ssl-Fix-build-with-OpenSSL-4.patch \ file://0005-SERVER-49099-Remove-the-Node-swap-function-in-Biggie.patch \ + file://oe-buildinfo.vars \ " SRC_URI:append:libc-musl = "\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
@@ -87,6 +88,7 @@ EXTRA_OESCONS = "PREFIX=${prefix} \ TARGET_ARCH=${MONGO_ARCH} \ MONGO_VERSION=${PV} \ OBJCOPY=${OBJCOPY} \ + --variables-files=${UNPACKDIR}/oe-buildinfo.vars \ --ssl \ --disable-warnings-as-errors \ --use-system-zlib \
Signature · 1 line
2.34.1