FreeBSD Bugzilla – Attachment 251215 Details for
Bug 279519
[NEW PORT] databases/mongosh: mongodb official Shell CLI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
New port patch
0001-mongosh-2.2.5.patch (text/plain), 16.25 KB, created by
Fabien Amelinck
on 2024-06-04 14:31:54 UTC
(
hide
)
Description:
New port patch
Filename:
MIME Type:
Creator:
Fabien Amelinck
Created:
2024-06-04 14:31:54 UTC
Size:
16.25 KB
patch
obsolete
>From 2e732f5f26a81295a99fd4e84e1bdd1742b092ed Mon Sep 17 00:00:00 2001 >From: Fabien Amelinck <fabien.amelinck@advens.fr> >Date: Tue, 4 Jun 2024 16:23:01 +0200 >Subject: [PATCH] New mongosh port > >--- > databases/Makefile | 1 + > databases/mongosh/Makefile | 78 +++++++++++++++++++ > databases/mongosh/distinfo | 3 + > .../mongosh/files/node-patches/004-openssl3 | 15 ++++ > .../files/node-patches/005-src_cares__wrap.h | 11 +++ > .../node__modules_boxednode_lib_index.js | 11 +++ > .../patch-node__modules_kerberos_binding.gyp | 35 +++++++++ > ...e__modules_kerberos_src_kerberos__common.h | 11 +++ > ...ules_mongodb-client-encryption_binding.gyp | 18 +++++ > ...les_mongodb-client-encryption_package.json | 11 +++ > ...ch-node__modules_os-dns-native_binding.gyp | 13 ++++ > databases/mongosh/files/patch-package.json | 18 +++++ > .../files/patch-scripts_prep-fle-addon.sh | 20 +++++ > .../files/patch-scripts_sort-workspaces.js | 11 +++ > databases/mongosh/pkg-descr | 2 + > databases/mongosh/pkg-plist | 1 + > 16 files changed, 259 insertions(+) > create mode 100644 databases/mongosh/Makefile > create mode 100644 databases/mongosh/distinfo > create mode 100644 databases/mongosh/files/node-patches/004-openssl3 > create mode 100644 databases/mongosh/files/node-patches/005-src_cares__wrap.h > create mode 100644 databases/mongosh/files/node-patches/node__modules_boxednode_lib_index.js > create mode 100644 databases/mongosh/files/patch-node__modules_kerberos_binding.gyp > create mode 100644 databases/mongosh/files/patch-node__modules_kerberos_src_kerberos__common.h > create mode 100644 databases/mongosh/files/patch-node__modules_mongodb-client-encryption_binding.gyp > create mode 100644 databases/mongosh/files/patch-node__modules_mongodb-client-encryption_package.json > create mode 100644 databases/mongosh/files/patch-node__modules_os-dns-native_binding.gyp > create mode 100644 databases/mongosh/files/patch-package.json > create mode 100644 databases/mongosh/files/patch-scripts_prep-fle-addon.sh > create mode 100644 databases/mongosh/files/patch-scripts_sort-workspaces.js > create mode 100644 databases/mongosh/pkg-descr > create mode 100644 databases/mongosh/pkg-plist > >diff --git a/databases/Makefile b/databases/Makefile >index 18d63772ec5f..458f321df4d0 100644 >--- a/databases/Makefile >+++ b/databases/Makefile >@@ -187,6 +187,7 @@ > SUBDIR += mongodb50 > SUBDIR += mongodb60 > SUBDIR += mongodb70 >+ SUBDIR += mongosh > SUBDIR += movine > SUBDIR += mroonga > SUBDIR += mtop >diff --git a/databases/mongosh/Makefile b/databases/mongosh/Makefile >new file mode 100644 >index 000000000000..713dad22336a >--- /dev/null >+++ b/databases/mongosh/Makefile >@@ -0,0 +1,78 @@ >+PORTNAME= mongosh >+DISTVERSION= 2.2.5 >+CATEGORIES= databases net >+ >+MAINTAINER= fabien.amelinck@advens.fr >+COMMENT= MongoDB Shell CLI REPL >+WWW= https://github.com/mongodb-js/mongosh/ >+ >+LICENSE= APACHE20 >+ >+PATCH_DEPENDS= npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX} >+BUILD_DEPENDS= bash>0:shells/bash \ >+ git>0:devel/git \ >+ brotli>=1.0.9,1:archivers/brotli \ >+ c-ares>=1.17.2:dns/c-ares \ >+ libnghttp2>=1.45.1:www/libnghttp2 \ >+ libuv>=1.42.0:devel/libuv \ >+ objdump:devel/binutils \ >+ ${PREFIX}/include/gssapi/gssapi_generic.h:security/krb5 >+RUN_DEPENDS= ca_root_nss>=0:security/ca_root_nss >+LIB_DEPENDS= libmongocrypt.so:databases/libmongocrypt \ >+ libbrotlidec.so:archivers/brotli \ >+ libcares.so:dns/c-ares \ >+ libnghttp2.so:www/libnghttp2 \ >+ libuv.so:devel/libuv >+ >+USES= compiler:c++11-lib gmake localbase pkgconfig nodejs:20,build python:build ssl >+ >+USE_GITHUB= yes >+GH_ACCOUNT= mongodb-js >+GH_PROJECT= mongosh >+GH_TAGNAME= v${DISTVERSION} >+ >+MPROTECT_DISABLE= bin/mongosh >+ >+CUSTOM_ENV= SEGMENT_API_KEY=dummy BUILD_TYPE=dynamic >+CONFIGURE_ENV= ${CUSTOM_ENV} >+MAKE_ENV= ${CUSTOM_ENV} BOXEDNODE_CONFIGURE_ARGS="--shared-brotli,--shared-cares,--shared-libuv,--shared-nghttp2,--shared-zlib,--shared-openssl,--openssl-use-def-ca-store,--without-npm" >+ >+post-fetch: >+.if !exists(${DISTDIR}/mongodb-client-encryption-6.0.0.tgz) >+ ${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-6.0.0.tgz >+ ${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/kerberos/-/kerberos-2.1.0.tgz >+ ${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/os-dns-native/-/os-dns-native-1.2.0.tgz >+ # ${MKDIR} -v /tmp/boxednode/${PORTNAME} >+ # ${FETCH_CMD} -o /tmp/boxednode/${PORTNAME} https://nodejs.org/dist/v20.14.0/node-v20.14.0.tar.gz >+.endif >+ >+post-extract: >+ ${MKDIR} -v ${WRKSRC}/node_modules/mongodb-client-encryption ${WRKSRC}/node_modules/kerberos ${WRKSRC}/node_modules/os-dns-native >+ ${TAR} -xzf ${DISTDIR}/mongodb-client-encryption-6.0.0.tgz -C ${WRKSRC}/node_modules/mongodb-client-encryption --strip-components 1 >+ ${TAR} -xzf ${DISTDIR}/kerberos-2.1.0.tgz -C ${WRKSRC}/node_modules/kerberos --strip-components 1 >+ ${TAR} -xzf ${DISTDIR}/os-dns-native-1.2.0.tgz -C ${WRKSRC}/node_modules/os-dns-native --strip-components 1 >+ >+post-patch: >+ cd ${WRKSRC} && npx cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install >+ >+ ${PATCH} -d ${WRKSRC} < ${FILESDIR}/node-patches/node__modules_boxednode_lib_index.js >+ ${FIND} ${WRKSRC}/scripts/ -name "*.orig" -delete >+ ${CP} -vf ${FILESDIR}/node-patches/00* ${WRKSRC}/scripts/nodejs-patches >+ >+do-configure: >+.for module in mongodb-client-encryption kerberos os-dns-native >+ cd ${WRKSRC}/node_modules/${module} && ${CONFIGURE_ENV} node-gyp configure >+.endfor >+ ${RM} -r ${WRKDIR}/.cache/node-gyp/20.12.2/include/node/openssl >+ >+do-build: >+.for module in mongodb-client-encryption kerberos os-dns-native >+ cd ${WRKSRC}/node_modules/${module} && ${MAKE_CMD} BUILDTYPE=Release -C build -d >+.endfor >+ ${REINPLACE_CMD} 's/"version": "0.0.0-dev.0"/"version": "${DISTVERSION}"/g' ${WRKSRC}/packages/cli-repl/package.json >+ cd ${WRKSRC} && ${MAKE_ENV} npm run compile-exec >+ >+do-install: >+ ${INSTALL_PROGRAM} ${WRKSRC}/dist/mongosh ${STAGEDIR}${PREFIX}/bin >+ >+.include <bsd.port.mk> >diff --git a/databases/mongosh/distinfo b/databases/mongosh/distinfo >new file mode 100644 >index 000000000000..5961566ecafa >--- /dev/null >+++ b/databases/mongosh/distinfo >@@ -0,0 +1,3 @@ >+TIMESTAMP = 1715006095 >+SHA256 (mongodb-js-mongosh-2.2.5-v2.2.5_GH0.tar.gz) = 38fd3c21433d2b8d371161941843a3c6a6652e41c4a9d3cfa3917164630f3928 >+SIZE (mongodb-js-mongosh-2.2.5-v2.2.5_GH0.tar.gz) = 8653615 >diff --git a/databases/mongosh/files/node-patches/004-openssl3 b/databases/mongosh/files/node-patches/004-openssl3 >new file mode 100644 >index 000000000000..6b1f10fb4a83 >--- /dev/null >+++ b/databases/mongosh/files/node-patches/004-openssl3 >@@ -0,0 +1,15 @@ >+--- a/src/crypto/crypto_util.cc 2023-05-16 06:58:21 UTC >++++ b/src/crypto/crypto_util.cc >+@@ -205,10 +205,12 @@ void InitCryptoOnce() { >+ // No-op with OPENSSL_NO_COMP builds of OpenSSL. >+ sk_SSL_COMP_zero(SSL_COMP_get_compression_methods()); >+ >++#if OPENSSL_VERSION_MAJOR < 3 >+ #ifndef OPENSSL_NO_ENGINE >+ ERR_load_ENGINE_strings(); >+ ENGINE_load_builtin_engines(); >+ #endif // !OPENSSL_NO_ENGINE >++#endif >+ } >+ >+ void GetFipsCrypto(const FunctionCallbackInfo<Value>& args) { >diff --git a/databases/mongosh/files/node-patches/005-src_cares__wrap.h b/databases/mongosh/files/node-patches/005-src_cares__wrap.h >new file mode 100644 >index 000000000000..80c07e6aab7a >--- /dev/null >+++ b/databases/mongosh/files/node-patches/005-src_cares__wrap.h >@@ -0,0 +1,11 @@ >+--- a/src/cares_wrap.h 2023-05-16 06:58:21 UTC >++++ b/src/cares_wrap.h >+@@ -23,7 +23,7 @@ >+ # include <netdb.h> >+ #endif // __POSIX__ >+ >+-# include <ares_nameser.h> >++# include <arpa/nameser.h> >+ >+ namespace node { >+ namespace cares_wrap { >diff --git a/databases/mongosh/files/node-patches/node__modules_boxednode_lib_index.js b/databases/mongosh/files/node-patches/node__modules_boxednode_lib_index.js >new file mode 100644 >index 000000000000..e9f62a9dc33d >--- /dev/null >+++ b/databases/mongosh/files/node-patches/node__modules_boxednode_lib_index.js >@@ -0,0 +1,11 @@ >+--- node_modules/boxednode/lib/index.js.orig 2024-05-15 15:56:00 UTC >++++ node_modules/boxednode/lib/index.js >+@@ -194,7 +196,7 @@ async function compileNode(sourcePath, linkedJSModules >+ await fs_1.promises.writeFile(target, 'utf8'); >+ } >+ } >+- const make = ['make', ...makeArgs]; >++ const make = ['gmake', ...makeArgs]; >+ if (!make.some((arg) => /^-j/.test(arg))) { >+ make.push(`-j${cpus}`); >+ } >diff --git a/databases/mongosh/files/patch-node__modules_kerberos_binding.gyp b/databases/mongosh/files/patch-node__modules_kerberos_binding.gyp >new file mode 100644 >index 000000000000..3731dd7bfb21 >--- /dev/null >+++ b/databases/mongosh/files/patch-node__modules_kerberos_binding.gyp >@@ -0,0 +1,35 @@ >+--- node_modules/kerberos/binding.gyp.orig 2024-05-13 15:16:38 UTC >++++ node_modules/kerberos/binding.gyp >+@@ -34,16 +34,21 @@ >+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden >+ } >+ }], >+- ['OS=="mac" or OS=="linux"', { >++ ['OS=="mac" or OS=="linux" or OS=="freebsd"', { >+ 'sources': [ >+ 'src/unix/base64.cc', >+ 'src/unix/kerberos_gss.cc', >+ 'src/unix/kerberos_unix.cc' >+ ] >+ }], >+- ['(OS=="mac" or OS=="linux") and (kerberos_use_rtld!="true")', { >++ ['(OS=="mac" or OS=="linux" or OS=="freebsd") and (kerberos_use_rtld!="true")', { >++ 'defines': ['NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT'], >++ 'include_dirs': [ >++ '/usr/local/include' >++ ], >+ 'link_settings': { >+ 'libraries': [ >++ '-L/usr/lib', >+ '-lkrb5', >+ '-lgssapi_krb5' >+ ] >+@@ -58,7 +63,7 @@ >+ }] >+ ] >+ }], >+- ['(OS=="mac" or OS=="linux") and (kerberos_use_rtld=="true")', { >++ ['(OS=="mac" or OS=="linux" or OS=="freebsd") and (kerberos_use_rtld=="true")', { >+ 'defines': ['KERBEROS_USE_RTLD=1'], >+ 'link_settings': { >+ 'libraries': [ >diff --git a/databases/mongosh/files/patch-node__modules_kerberos_src_kerberos__common.h b/databases/mongosh/files/patch-node__modules_kerberos_src_kerberos__common.h >new file mode 100644 >index 000000000000..ca2ad82d6d29 >--- /dev/null >+++ b/databases/mongosh/files/patch-node__modules_kerberos_src_kerberos__common.h >@@ -0,0 +1,11 @@ >+--- node_modules/kerberos/src/kerberos_common.h.orig 2024-05-13 16:09:25 UTC >++++ node_modules/kerberos/src/kerberos_common.h >+@@ -1,7 +1,7 @@ >+ #ifndef KERBEROS_COMMON_H >+ #define KERBEROS_COMMON_H >+ >+-#if defined(__linux__) || defined(__APPLE__) >++#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) >+ #include "unix/kerberos_gss.h" >+ >+ namespace node_kerberos { >diff --git a/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_binding.gyp b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_binding.gyp >new file mode 100644 >index 000000000000..6067f0cd4494 >--- /dev/null >+++ b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_binding.gyp >@@ -0,0 +1,18 @@ >+--- node_modules/mongodb-client-encryption/binding.gyp.orig 2024-05-13 14:10:24 UTC >++++ node_modules/mongodb-client-encryption/binding.gyp >+@@ -38,9 +38,14 @@ >+ } >+ }], >+ ['build_type=="dynamic"', { >++ 'defines': [ 'NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT' ], >++ 'include_dirs': [ >++ '/usr/include', >++ '/usr/local/include' >++ ], >+ 'link_settings': { >+ 'libraries': [ >+- '-lmongocrypt' >++ '-L/usr/local/lib -lmongocrypt' >+ ] >+ } >+ }], >diff --git a/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_package.json b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_package.json >new file mode 100644 >index 000000000000..63545e891861 >--- /dev/null >+++ b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_package.json >@@ -0,0 +1,11 @@ >+--- node_modules/mongodb-client-encryption/package.json.orig 2024-05-13 13:50:11 UTC >++++ node_modules/mongodb-client-encryption/package.json >+@@ -16,7 +16,7 @@ >+ "lib": "lib" >+ }, >+ "scripts": { >+- "install": "prebuild-install --runtime napi --tag-prefix node-v || node-gyp rebuild", >++ "install": "prebuild-install --runtime napi --tag-prefix node-v || BUILD_TYPE=dynamic node-gyp rebuild", >+ "build:ts": "tsc", >+ "clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*", >+ "check:eslint": "eslint src test", >diff --git a/databases/mongosh/files/patch-node__modules_os-dns-native_binding.gyp b/databases/mongosh/files/patch-node__modules_os-dns-native_binding.gyp >new file mode 100644 >index 000000000000..340a86450dc4 >--- /dev/null >+++ b/databases/mongosh/files/patch-node__modules_os-dns-native_binding.gyp >@@ -0,0 +1,13 @@ >+--- node_modules/os-dns-native/binding.gyp.orig 2024-05-13 16:56:54 UTC >++++ node_modules/os-dns-native/binding.gyp >+@@ -19,10 +19,6 @@ >+ "link_settings": { >+ "libraries": ["-ldnsapi"] >+ } >+- }, { >+- "link_settings": { >+- "libraries": ["-lresolv"] >+- } >+ }] >+ ] >+ }] >diff --git a/databases/mongosh/files/patch-package.json b/databases/mongosh/files/patch-package.json >new file mode 100644 >index 000000000000..8770987c6e82 >--- /dev/null >+++ b/databases/mongosh/files/patch-package.json >@@ -0,0 +1,18 @@ >+--- package.json.orig 2024-05-15 14:01:43 UTC >++++ package.json >+@@ -59,7 +59,6 @@ >+ "create-vulnerability-tickets": "mongodb-sbom-tools generate-vulnerability-report --snyk-reports=.sbom/snyk-test-result.json,.sbom/node-js-vuln.json --dependencies=.sbom/dependencies.json,.sbom/node-js-dep.json --create-jira-issues", >+ "where": "monorepo-where", >+ "reformat": "npm run reformat --workspaces --if-present", >+- "prepare": "husky install", >+ "precommit": "precommit", >+ "preinstall": "node scripts/sort-workspaces.js" >+ }, >+@@ -101,7 +100,6 @@ >+ "duplexpair": "^1.0.2", >+ "find-up": "^5.0.0", >+ "glob": "^10.3.12", >+- "husky": "^8.0.3", >+ "mocha": "^10.2.0", >+ "mongodb": "^6.5.0", >+ "mongodb-runner": "^5.4.6", >diff --git a/databases/mongosh/files/patch-scripts_prep-fle-addon.sh b/databases/mongosh/files/patch-scripts_prep-fle-addon.sh >new file mode 100644 >index 000000000000..7c6719bc90ce >--- /dev/null >+++ b/databases/mongosh/files/patch-scripts_prep-fle-addon.sh >@@ -0,0 +1,20 @@ >+--- scripts/prep-fle-addon.sh.orig 2024-05-31 10:02:13 UTC >++++ scripts/prep-fle-addon.sh >+@@ -62,7 +62,7 @@ if [ x"$PREBUILT_OSNAME" != x"" ]; then >+ mv -v prebuilts/nocrypto/include include >+ mv -v prebuilts/$LIB/*bson* lib >+ rm -rf prebuilts >+-else >++elif [ `uname` != FreeBSD ]; then >+ if [ `uname` = Darwin ]; then >+ export CFLAGS="-mmacosx-version-min=10.15"; >+ fi >+@@ -86,7 +86,7 @@ else >+ cd ../../ >+ fi >+ >+-if [ x"$FLE_NODE_SOURCE_PATH" != x"" ]; then >++if [ x"$FLE_NODE_SOURCE_PATH" != x"" -a `uname` != FreeBSD -a "$BUILD_TYPE" != dynamic ]; then >+ mkdir -p "$FLE_NODE_SOURCE_PATH"/deps/lib >+ mkdir -p "$FLE_NODE_SOURCE_PATH"/deps/include >+ cp -rv "$BUILDROOT"/lib*/*-static* "$FLE_NODE_SOURCE_PATH"/deps/lib >diff --git a/databases/mongosh/files/patch-scripts_sort-workspaces.js b/databases/mongosh/files/patch-scripts_sort-workspaces.js >new file mode 100644 >index 000000000000..0fe4e6da9222 >--- /dev/null >+++ b/databases/mongosh/files/patch-scripts_sort-workspaces.js >@@ -0,0 +1,11 @@ >+--- scripts/sort-workspaces.js.orig 2024-05-03 16:42:16 UTC >++++ scripts/sort-workspaces.js >+@@ -22,7 +22,7 @@ async function main() { >+ )); >+ >+ // should use the scopes in lerna.json >+- const { stdout } = await exec('npx -y lerna ls --all --no-since --toposort --json'); >++ const { stdout } = await exec('npx -y lerna ls --all --toposort --json'); >+ packageJSON.workspaces = JSON.parse(stdout).map(({ location }) => path.relative(monorepoRoot, location)); >+ >+ await fs.writeFile( >diff --git a/databases/mongosh/pkg-descr b/databases/mongosh/pkg-descr >new file mode 100644 >index 000000000000..7592bf8c8666 >--- /dev/null >+++ b/databases/mongosh/pkg-descr >@@ -0,0 +1,2 @@ >+Standalone MongoDB Shell replacing deprecated Mongo CLI >+NodeJS doesn't need to be installed >diff --git a/databases/mongosh/pkg-plist b/databases/mongosh/pkg-plist >new file mode 100644 >index 000000000000..061e8b2e4302 >--- /dev/null >+++ b/databases/mongosh/pkg-plist >@@ -0,0 +1 @@ >+bin/mongosh >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 279519
:
251215
|
255203
|
255218