From c6a95c4abea2001c697898bb8363df19bf046758 Mon Sep 17 00:00:00 2001 From: Awais Belal Date: Thu, 6 Mar 2025 21:47:25 +0500 Subject: [PATCH 1/2] 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. Signed-off-by: Awais Belal --- ...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 diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch new file mode 100644 index 00000000000..51926b9d2e9 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-moduleconfig.py-python-3.12-compatibility.patch @@ -0,0 +1,57 @@ +From 37580777bc5294d606584f3731d9f5f5425bb587 Mon Sep 17 00:00:00 2001 +From: Awais B +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 +--- + 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 + diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb index ee5c77a85db..f7fd8817136 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb @@ -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 \ @@ -145,5 +146,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" From dcd8fc225eea955e75499ab8b36d0c2a0604e004 Mon Sep 17 00:00:00 2001 From: Awais Belal Date: Thu, 6 Mar 2025 21:51:48 +0500 Subject: [PATCH 2/2] mongodb: update to 4.4.29 Move on to 4.4.29 and drop a patch that is not applicable anymore. Signed-off-by: Awais Belal --- ...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 diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch deleted file mode 100644 index 8cee14889fd..00000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-free_mon-Include-missing-cstdint.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5d8218b8a1b5bc71e2a0cf543a000e194daba599 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 29 Jan 2023 17:15:30 -0800 -Subject: [PATCH] free_mon: Include missing - -gcc 13 moved some includes around and as a result 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 - -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 - #include - #include - diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb index f7fd8817136..5d904dd4f95 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb @@ -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 \