Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -32,10 +32,10 @@ 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 \
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 \
Expand Down Expand Up @@ -145,5 +145,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"