git: 540a0eda8cfe - main - databases/mongodb80: build fix for python 3.14

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 13:46:06 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=540a0eda8cfecf01aa192540877f74732d2341e7

commit 540a0eda8cfecf01aa192540877f74732d2341e7
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2026-09-15 13:41:23 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2026-09-15 13:45:57 +0000

    databases/mongodb80: build fix for python 3.14
    
    Based on the fix for databases/mongodb70.
    
    No portrevision bump as it does not affect the default build.
    
    PR:     298510
    Reported by:    peter.sopko
    Tested by:      peter.sopko
---
 databases/mongodb80/Makefile                       |  1 +
 .../d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch | 81 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/databases/mongodb80/Makefile b/databases/mongodb80/Makefile
index 4af9448f6803..54bc6fa6aede 100644
--- a/databases/mongodb80/Makefile
+++ b/databases/mongodb80/Makefile
@@ -157,6 +157,7 @@ MOZJS_ARCH=	${ARCH}
 post-extract:
 # Verify we downloaded the proper mozjs git tag.
 	${SH} -xc "test \"X`grep -E '^LIB_GIT_REVISION=' ${MOZJS_WRKSRC}/get-sources.sh`\" = \"XLIB_GIT_REVISION=${MOZJS_TAG}\""
+	${PATCH} -d ${WRKDIR}/spidermonkey-${MOZJS_TAG} -p1 < ${PATCHDIR}/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch
 
 pre-configure:
 # Replacement of ${WRKSRC}/src/third_party/mozjs/get-sources.sh
diff --git a/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch b/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch
new file mode 100644
index 000000000000..62a81a051d65
--- /dev/null
+++ b/databases/mongodb80/files/d497aa4f770ca02f6083e93b94996a8fe32c2ff4.patch
@@ -0,0 +1,81 @@
+!!! This patch is a modified version of the phabricator mention !!!
+!!! You can diff them to see the difference !!!
+
+From d497aa4f770ca02f6083e93b94996a8fe32c2ff4 Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh+mozilla@glandium.org>
+Date: Tue, 19 Aug 2025 05:09:09 +0000
+Subject: [PATCH] Bug 1969769 - Change uses of ast.Str with ast.Constant.
+ r=firefox-build-system-reviewers,ahochheiden
+
+ast.Str was deprecated in python 3.12 and removed in 3.14. It inherited
+from ast.Constant, `Str.s` was equivalent to `Constant.value`, so we can
+use the latter on both old and newer python versions.
+
+Differential Revision: https://phabricator.services.mozilla.com/D261512
+---
+ python/mozbuild/mozbuild/frontend/reader.py        | 14 +++++++-------
+ .../mozbuild/mozbuild/vendor/rewrite_mozbuild.py   |  6 ++----
+ 2 files changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py
+index 9f6292cb909de..89bf9995c1768 100644
+--- a/python/mozbuild/mozbuild/frontend/reader.py
++++ b/python/mozbuild/mozbuild/frontend/reader.py
+@@ -470,7 +470,7 @@
+             return c(
+                 ast.Subscript(
+                     value=c(ast.Name(id=self._global_name, ctx=ast.Load())),
+-                    slice=c(ast.Index(value=c(ast.Str(s=node.id)))),
++                    slice=c(ast.Index(value=c(ast.Constant(value=node.id)))),
+                     ctx=node.ctx,
+                 )
+             )
+@@ -1035,8 +1035,8 @@
+                 else:
+                     # Others
+                     assert isinstance(target.slice, ast.Index)
+-                    assert isinstance(target.slice.value, ast.Str)
+-                    key = target.slice.value.s
++                    assert isinstance(target.slice.value, ast.Constant)
++                    key = target.slice.value.value
+ 
+             return name, key
+ 
+@@ -1044,11 +1044,11 @@
+             value = node.value
+             if isinstance(value, ast.List):
+                 for v in value.elts:
+-                    assert isinstance(v, ast.Str)
+-                    yield v.s
++                    assert isinstance(v, ast.Constant)
++                    yield v.value
+             else:
+-                assert isinstance(value, ast.Str)
+-                yield value.s
++                assert isinstance(value, ast.Constant)
++                yield value.value
+ 
+         assignments = []
+
+diff --git a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py
+index cfcc0f18b9a9a..de06b58819b6a 100644
+--- a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py	2026-04-26 13:55:23.117672000 -0500
++++ a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py	2026-04-26 13:55:54.618049000 -0500
+@@ -327,15 +327,13 @@
+     """
+     if isinstance(node.value, ast.List) and "elts" in node.value._fields:
+         for f in node.value.elts:
+-            if not isinstance(f, ast.Constant) and not isinstance(f, ast.Str):
++            if not isinstance(f, ast.Constant):
+                 log(
+                     "Found non-constant source file name in list: ",
+                     ast_get_source_segment(code, f),
+                 )
+                 return []
+-        return [
+-            f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts
+-        ]
++        return [f.value for f in node.value.elts]
+     elif isinstance(node.value, ast.ListComp):
+         # SOURCES += [f for f in foo if blah]
+         log("Could not find the files for " + ast_get_source_segment(code, node.value))