git: 8b702c041feb - main - databases/mongodb70: add do-test and update to 7.0.12

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Sun, 07 Jul 2024 10:51:44 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8b702c041febcdfaa90e7cfa38bebf3eacac8450

commit 8b702c041febcdfaa90e7cfa38bebf3eacac8450
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2024-07-01 17:09:50 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2024-07-07 10:50:08 +0000

    databases/mongodb70: add do-test and update to 7.0.12
    
    Changes:
    https://www.mongodb.com/docs/manual/release-notes/7.0/#7.0.12---jun-28--2024
    
    The port has had situations in which the code compiled, but the
    executables did not work. Try to catch this early with make test.
    
    - new mozjs version
    - autoconf is unused now
    - pet portclippy, portfmt, portlint
    - pkg-message: use default mongo portnr instead of portnr used by unifi.
---
 databases/mongodb70/Makefile                       | 34 ++++++++++++----------
 databases/mongodb70/distinfo                       | 10 +++----
 databases/mongodb70/files/make.test.sh             | 31 ++++++++++++++++++++
 databases/mongodb70/files/patch-SConstruct         | 10 +++----
 ...tch-src_mongo_db_exec_document__value_value.cpp |  4 +--
 ..._libbson_dist_src_libbson_src_bson_bson-error.c | 11 +++++++
 databases/mongodb70/pkg-message                    |  2 +-
 7 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/databases/mongodb70/Makefile b/databases/mongodb70/Makefile
index 72426165f2d2..917f7e412e63 100644
--- a/databases/mongodb70/Makefile
+++ b/databases/mongodb70/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	mongodb
 DISTVERSIONPREFIX=	r
-DISTVERSION=	7.0.11
-PORTREVISION=	1
+DISTVERSION=	7.0.12
 CATEGORIES=	databases net
 PKGNAMESUFFIX=	${DISTVERSION:R:S/.//}
 
@@ -25,7 +24,7 @@ BUILD_DEPENDS=	${PY_SETUPTOOLS} \
 		${PYTHON_PKGNAMEPREFIX}pymongo>0:databases/py-pymongo@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pyyaml>=3.11:devel/py-pyyaml@${PY_FLAVOR}
 # build depends used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh
-BUILD_DEPENDS+=	autoconf2.13:devel/autoconf2.13 \
+BUILD_DEPENDS+=	gm4:devel/m4 \
 		gsed:textproc/gsed
 LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libpcre2-8.so:devel/pcre2 \
@@ -40,7 +39,7 @@ USES=		compiler:c++20-lang cpe python:build scons shebangfix
 USES+=		gmake pkgconfig
 
 # mozjs tag comes from ${WRKSRC}/src/third_party/mozjs/get-sources.sh
-MOZJS_TAG=	82aac6af18abcd5bf188afbc821779ccb0ca0902
+MOZJS_TAG=	22954e1ce6bf72c7cf36f3a29ef030fff4ff6d33
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	mongodb mongodb-forks:mozjs
@@ -51,15 +50,7 @@ USE_RC_SUBR=	mongod
 SHEBANG_FILES=	buildscripts/scons.py
 python_OLD_CMD=	@python_interpreter@
 
-EXTRACT_AFTER_ARGS=	--exclude src/third_party/pcre2 \
-			--exclude src/third_party/snappy-* \
-			--exclude src/third_party/libstemmer_c \
-			--exclude src/third_party/unwind \
-			--exclude src/third_party/yaml-cpp \
-			--exclude src/third_party/zlib-* \
-			--exclude src/third_party/zstandard \
-			--no-same-owner --no-same-permissions
-
+CONFIGURE_ENV+=	M4=${LOCALBASE}/bin/gm4
 MAKE_ARGS=	--allocator=system \
 		--cxx-std=20 \
 		--disable-warnings-as-errors \
@@ -81,12 +72,21 @@ CFLAGS+=	-DBOOST_NO_CXX98_FUNCTION_BASE
 
 CONFLICTS_INSTALL=	mongodb[0-9][0-9]
 
+EXTRACT_AFTER_ARGS=	--exclude src/third_party/pcre2 \
+			--exclude src/third_party/snappy-* \
+			--exclude src/third_party/libstemmer_c \
+			--exclude src/third_party/unwind \
+			--exclude src/third_party/yaml-cpp \
+			--exclude src/third_party/zlib-* \
+			--exclude src/third_party/zstandard \
+			--no-same-owner --no-same-permissions
+
 USERS=		mongodb
 GROUPS=		mongodb
 
-OPTIONS_DEFINE=		LTO SASL SSL NOAVX
+OPTIONS_DEFINE=		LTO NOAVX SASL SSL
 OPTIONS_DEFINE_aarch64=	ARMV80A
-OPTIONS_DEFAULT=	SASL SSL NOAVX
+OPTIONS_DEFAULT=	NOAVX SASL SSL
 
 # MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream.
 # Can give corruption on high concurrency.
@@ -134,7 +134,6 @@ post-patch:
 do-configure:
 # Replacement of ${WRKSRC}/src/third_party/mozjs/get-sources.sh
 	${LN} -sF ${WRKDIR}/spidermonkey-${MOZJS_TAG} ${WRKSRC}/src/third_party/mozjs/mozilla-release
-	cd ${WRKSRC}/src/third_party/mozjs/mozilla-release/js/src && ${LOCALBASE}/bin/autoconf2.13
 	cd ${WRKSRC}/src/third_party/mozjs && PYTHON3="${PYTHON_CMD}" ${SH} ./gen-config.sh ${MOZJS_ARCH} freebsd
 
 do-build:
@@ -151,4 +150,7 @@ do-install:
 .endfor
 	${RM} ${STAGEDIR}${PREFIX}/bin/resmoke.py
 
+do-test:
+	${SH} ${FILESDIR}/make.test.sh "${STAGEDIR}${PREFIX}/bin"
+
 .include <bsd.port.post.mk>
diff --git a/databases/mongodb70/distinfo b/databases/mongodb70/distinfo
index 8a148b9530dc..ee12ec55c045 100644
--- a/databases/mongodb70/distinfo
+++ b/databases/mongodb70/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1716674894
-SHA256 (mongodb-mongo-r7.0.11_GH0.tar.gz) = 3138a4cfae5efdf5f36daeeb51c54d988f3e633834fcbf1f672803896203640b
-SIZE (mongodb-mongo-r7.0.11_GH0.tar.gz) = 113797403
-SHA256 (mongodb-forks-spidermonkey-82aac6af18abcd5bf188afbc821779ccb0ca0902_GH0.tar.gz) = a365bf54ef4e4fd6a136cf6afa9c620ba0c8982402473b9bfac38928a688a9e0
-SIZE (mongodb-forks-spidermonkey-82aac6af18abcd5bf188afbc821779ccb0ca0902_GH0.tar.gz) = 141291901
+TIMESTAMP = 1720045558
+SHA256 (mongodb-mongo-r7.0.12_GH0.tar.gz) = 267a396bd8ab6a114c932e9cb2c65565d3556852473015c88ffddda3693b25c3
+SIZE (mongodb-mongo-r7.0.12_GH0.tar.gz) = 86343146
+SHA256 (mongodb-forks-spidermonkey-22954e1ce6bf72c7cf36f3a29ef030fff4ff6d33_GH0.tar.gz) = b0ba41c3cb2f387afaef9fd8771b1250176680cbc7625836e545e0dec436e85d
+SIZE (mongodb-forks-spidermonkey-22954e1ce6bf72c7cf36f3a29ef030fff4ff6d33_GH0.tar.gz) = 164690006
diff --git a/databases/mongodb70/files/make.test.sh b/databases/mongodb70/files/make.test.sh
new file mode 100755
index 000000000000..3d74258a446a
--- /dev/null
+++ b/databases/mongodb70/files/make.test.sh
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+set -e
+
+usage() {
+	echo "Usage: $0 <path>"
+	echo "<path>    path to the executables"
+}
+
+test "$#" -eq 1 || ( usage && exit 1 )
+
+set -x
+
+PATH="$1:$PATH"
+
+DBDIR=$( mktemp -d -t tmp.mongodb )
+
+trap 'rm -rf "$DBDIR"' EXIT
+
+# Trivial check if the binaries execute at all.
+mongod -version
+mongos -version
+
+# Check if an empty database can be created.
+mkdir "$DBDIR/db"
+tail -F "$DBDIR/log" | ( grep -qFe "Waiting for connections" && kill $(cat "$DBDIR/pid") ) &
+script -eF "$DBDIR/log" \
+	timeout -s TERM -k 30s 60s \
+	mongod --dbpath "$DBDIR/db" --pidfilepath "$DBDIR/pid"
+
+echo "Test successful"
diff --git a/databases/mongodb70/files/patch-SConstruct b/databases/mongodb70/files/patch-SConstruct
index a6da48e57114..816aa6946300 100644
--- a/databases/mongodb70/files/patch-SConstruct
+++ b/databases/mongodb70/files/patch-SConstruct
@@ -1,4 +1,4 @@
---- SConstruct.orig	2023-06-07 17:07:38 UTC
+--- SConstruct.orig	2024-06-19 03:26:19 UTC
 +++ SConstruct
 @@ -23,7 +23,6 @@ import SCons.Script
  
@@ -8,7 +8,7 @@
  from site_scons.mongo import build_profiles
  
  # This must be first, even before EnsureSConsVersion, if
-@@ -1655,16 +1654,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(n
+@@ -1653,16 +1652,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(n
  del envDict
  env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption')
  
@@ -25,7 +25,7 @@
  if get_option('build-metrics'):
      env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR'
      env.Tool('build_metrics')
-@@ -1801,9 +1790,9 @@ if has_option('variables-help'):
+@@ -1799,9 +1788,9 @@ if has_option('variables-help'):
      print(env_vars.GenerateHelpText(env))
      Exit(0)
  
@@ -38,7 +38,7 @@
  
  install_actions.setup(env, get_option('install-action'))
  
-@@ -3026,7 +3015,7 @@ if env.TargetOSIs('posix'):
+@@ -3024,7 +3013,7 @@ if env.TargetOSIs('posix'):
              # If runtime hardening is requested, then build anything
              # destined for an executable with the necessary flags for PIE.
              env.AppendUnique(
@@ -47,7 +47,7 @@
                  PROGLINKFLAGS=['-pie'],
              )
  
-@@ -3034,7 +3023,6 @@ if env.TargetOSIs('posix'):
+@@ -3032,7 +3021,6 @@ if env.TargetOSIs('posix'):
      env.Append(
          CCFLAGS=[
              "-fasynchronous-unwind-tables",
diff --git a/databases/mongodb70/files/patch-src_mongo_db_exec_document__value_value.cpp b/databases/mongodb70/files/patch-src_mongo_db_exec_document__value_value.cpp
index 194db618f3b2..3deb7c743027 100644
--- a/databases/mongodb70/files/patch-src_mongo_db_exec_document__value_value.cpp
+++ b/databases/mongodb70/files/patch-src_mongo_db_exec_document__value_value.cpp
@@ -1,6 +1,6 @@
---- src/mongo/db/exec/document_value/value.cpp.orig	2023-06-15 22:07:57 UTC
+--- src/mongo/db/exec/document_value/value.cpp.orig	2024-06-19 03:26:19 UTC
 +++ src/mongo/db/exec/document_value/value.cpp
-@@ -59,6 +59,12 @@ using namespace std::string_literals;
+@@ -60,6 +60,12 @@ using namespace std::string_literals;
  using std::vector;
  using namespace std::string_literals;
  
diff --git a/databases/mongodb70/files/patch-src_third__party_libbson_dist_src_libbson_src_bson_bson-error.c b/databases/mongodb70/files/patch-src_third__party_libbson_dist_src_libbson_src_bson_bson-error.c
new file mode 100644
index 000000000000..4ee39110eefd
--- /dev/null
+++ b/databases/mongodb70/files/patch-src_third__party_libbson_dist_src_libbson_src_bson_bson-error.c
@@ -0,0 +1,11 @@
+--- src/third_party/libbson/dist/src/libbson/src/bson/bson-error.c.orig	2024-07-04 10:59:36 UTC
++++ src/third_party/libbson/dist/src/libbson/src/bson/bson-error.c
+@@ -130,7 +130,7 @@ bson_strerror_r (int err_code,                    /* I
+    // required) by the POSIX spec (see:
+    // https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html#tag_16_574_08).
+    (void) strerror_r (err_code, buf, buflen);
+-#elif defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700
++#elif defined(__FreeBSD__) || ( defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700 )
+    // The behavior (of `strerror_l`) is undefined if the locale argument to
+    // `strerror_l()` is the special locale object LC_GLOBAL_LOCALE or is not a
+    // valid locale object handle.
diff --git a/databases/mongodb70/pkg-message b/databases/mongodb70/pkg-message
index 9587fa26b3f3..fb041b1ff931 100644
--- a/databases/mongodb70/pkg-message
+++ b/databases/mongodb70/pkg-message
@@ -9,7 +9,7 @@ MongoDB 6.0 and up do not include the 'mongo' CLI shell anymore. You can
 use the MongoDB Shell (https://github.com/mongodb-js/mongosh).
 # pkg install npm
 $ npm install mongosh
-$ npx mongosh mongodb://127.0.0.1:27117/
+$ npx mongosh mongodb://127.0.0.1:27017/
 
 EOM
 }