git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #40082 from jarjee/update/mongodb

mongodb: 3.4.10 -> 4.0.12

commit90dcc3360327e250536eeeca7fe9d887c9f7a817 authorMaximilian Bosch <maximilian@mbosch.me> dateThu 26 Mar 2020, 18:15 (7 years ago) parentebb6e38b65ff5d
12 files changed+245−88
lib/licenses.nix+7 nixos/doc/manual/release-notes/rl-2003.xml+5 nixos/tests/mongodb.nix+47−37 pkgs/servers/nosql/mongodb/asio-no-experimental-string-view.patch+20 pkgs/servers/nosql/mongodb/forget-build-dependencies-3-4.patch+17 pkgs/servers/nosql/mongodb/forget-build-dependencies.patch+3−7 pkgs/servers/nosql/mongodb/default.nix → pkgs/servers/nosql/mongodb/mongodb.nix+52−41 pkgs/servers/nosql/mongodb/mozjs-45_fix-3-byte-opcode.patch+27 pkgs/servers/nosql/mongodb/v3_4.nix+15 pkgs/servers/nosql/mongodb/v3_6.nix+16 pkgs/servers/nosql/mongodb/v4_0.nix+17 pkgs/top-level/all-packages.nix+19−3
lib/licenses.nix+7
@@ -649,6 +649,13 @@ lib.mapAttrs (n: v: v // { shortName = n; }) {
649649 url = http://metadata.ftp-master.debian.org/changelogs/main/d/debianutils/debianutils_4.8.1_copyright;
650650 };
651651
652+ sspl = {
653+ shortName = "SSPL";
654+ fullName = "Server Side Public License";
655+ url = https://www.mongodb.com/licensing/server-side-public-license;
656+ free = false;
657+ };
658+
652659 tcltk = spdx {
653660 spdxId = "TCL";
654661 fullName = "TCL/TK License";
nixos/doc/manual/release-notes/rl-2003.xml+5
@@ -825,6 +825,11 @@ auth required pam_succeed_if.so uid >= 1000 quiet
825825 not <command>systemd-networkd</command>.
826826 </para>
827827 </listitem>
828+ <listitem>
829+ <para>
830+ <package>mongodb</package> has been updated to version <literal>3.4.24</literal>.
831+ </para>
832+ </listitem>
828833 </itemizedlist>
829834 </section>
830835</section>
nixos/tests/mongodb.nix+47−37
@@ -1,42 +1,52 @@
11# This test start mongodb, runs a query using mongo shell
22
3−import ./make-test-python.nix ({ pkgs, ...} : let
4− testQuery = pkgs.writeScript "nixtest.js" ''
5− db.greetings.insert({ "greeting": "hello" });
6− print(db.greetings.findOne().greeting);
7− '';
8−in {
9− name = "mongodb";
10− meta = with pkgs.stdenv.lib.maintainers; {
11− maintainers = [ bluescreen303 offline cstrahan rvl phile314 ];
12− };
3+import ./make-test-python.nix ({ pkgs, ... }:
4+ let
5+ testQuery = pkgs.writeScript "nixtest.js" ''
6+ db.greetings.insert({ "greeting": "hello" });
7+ print(db.greetings.findOne().greeting);
8+ '';
139
14− nodes = {
15− one =
16− { ... }:
17− {
18− services = {
19− mongodb.enable = true;
20− mongodb.enableAuth = true;
21− mongodb.initialRootPassword = "root";
22− mongodb.initialScript = pkgs.writeText "mongodb_initial.js" ''
23− db = db.getSiblingDB("nixtest");
24− db.createUser({user:"nixtest",pwd:"nixtest",roles:[{role:"readWrite",db:"nixtest"}]});
25− '';
26− mongodb.extraConfig = ''
27− # Allow starting engine with only a small virtual disk
28− storage.journal.enabled: false
29− storage.mmapv1.smallFiles: true
30− '';
31− };
32− };
10+ runMongoDBTest = pkg: ''
11+ node.execute("(rm -rf data || true) && mkdir data")
12+ node.execute(
13+ "${pkg}/bin/mongod --fork --logpath logs --dbpath data"
14+ )
15+ node.wait_for_open_port(27017)
16+
17+ assert "hello" in node.succeed(
18+ "mongo ${testQuery}"
19+ )
20+
21+ node.execute(
22+ "${pkg}/bin/mongod --shutdown --dbpath data"
23+ )
24+ node.wait_for_closed_port(27017)
25+ '';
26+
27+ in {
28+ name = "mongodb";
29+ meta = with pkgs.stdenv.lib.maintainers; {
30+ maintainers = [ bluescreen303 offline cstrahan rvl phile314 ];
31+ };
32+
33+ nodes = {
34+ node = {...}: {
35+ environment.systemPackages = with pkgs; [
36+# mongodb-3_4
37+ mongodb-3_6
38+ mongodb-4_0
39+ ];
40+ };
3341 };
3442
35− testScript = ''
36− start_all()
37− one.wait_for_unit("mongodb.service")
38− one.succeed(
39− "mongo -u nixtest -p nixtest nixtest ${testQuery} | grep -q hello"
40− )
41− '';
42−})
43+ testScript = ''
44+ node.start()
45+ ''
46+# + runMongoDBTest pkgs.mongodb-3_4
47+ + runMongoDBTest pkgs.mongodb-3_6
48+ + runMongoDBTest pkgs.mongodb-4_0
49+ + ''
50+ node.shutdown()
51+ '';
52+ })
pkgs/servers/nosql/mongodb/asio-no-experimental-string-view.patchnew file+20
@@ -0,0 +1,20 @@
1+diff --git a/src/third_party/asio-master/asio/include/asio/detail/config.hpp b/src/third_party/asio-master/asio/include/asio/detail/config.hpp
2+index 7fe6a95a..ff4cc56b 100644
3+--- a/src/third_party/asio-master/asio/include/asio/detail/config.hpp
4++++ b/src/third_party/asio-master/asio/include/asio/detail/config.hpp
5+@@ -786,7 +786,6 @@
6+ # if (__cplusplus >= 201402)
7+ # if __has_include(<experimental/string_view>)
8+ # define ASIO_HAS_STD_STRING_VIEW 1
9+-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
10+ # endif // __has_include(<experimental/string_view>)
11+ # endif // (__cplusplus >= 201402)
12+ # endif // defined(__clang__)
13+@@ -794,7 +793,6 @@
14+ # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
15+ # if (__cplusplus >= 201402)
16+ # define ASIO_HAS_STD_STRING_VIEW 1
17+-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
18+ # endif // (__cplusplus >= 201402)
19+ # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
20+ # endif // defined(__GNUC__)
pkgs/servers/nosql/mongodb/forget-build-dependencies-3-4.patchnew file+17
@@ -0,0 +1,17 @@
1+--- a/site_scons/mongo_scons_utils.py
2++++ b/site_scons/mongo_scons_utils.py
3+@@ -84,14 +84,11 @@
4+ def default_buildinfo_environment_data():
5+ return (
6+ ('distmod', '$MONGO_DISTMOD', True, True,),
7+ ('distarch', '$MONGO_DISTARCH', True, True,),
8+ ('cc', '$CC_VERSION', True, False,),
9+- ('ccflags', '$CCFLAGS', True, False,),
10+ ('cxx', '$CXX_VERSION', True, False,),
11+- ('cxxflags', '$CXXFLAGS', True, False,),
12+- ('linkflags', '$LINKFLAGS', True, False,),
13+ ('target_arch', '$TARGET_ARCH', True, True,),
14+ ('target_os', '$TARGET_OS', True, False,),
15+ )
16+
17+ # If you want buildInfo and --version to be relatively empty, set
pkgs/servers/nosql/mongodb/forget-build-dependencies.patch+3−7
@@ -1,8 +1,6 @@
1−--- a/site_scons/mongo_scons_utils.py
2−+++ b/site_scons/mongo_scons_utils.py
3−@@ -84,14 +84,11 @@
4− def default_buildinfo_environment_data():
5− return (
1+--- a/site_scons/mongo/generators.py
2++++ b/site_scons/mongo/generators.py
3+@@ -18,10 +18,7 @@ def default_buildinfo_environment_data():
64 ('distmod', '$MONGO_DISTMOD', True, True,),
75 ('distarch', '$MONGO_DISTARCH', True, True,),
86 ('cc', '$CC_VERSION', True, False,),
@@ -13,5 +11,3 @@
1311 ('target_arch', '$TARGET_ARCH', True, True,),
1412 ('target_os', '$TARGET_OS', True, False,),
1513 )
16−
17− # If you want buildInfo and --version to be relatively empty, set
pkgs/servers/nosql/mongodb/default.nix → pkgs/servers/nosql/mongodb/mongodb.nixrenamed+52−41
@@ -1,58 +1,63 @@
1−{ stdenv, fetchurl, fetchpatch, scons, boost, gperftools, pcre-cpp, snappy
2−, zlib, libyamlcpp, sasl, openssl, libpcap, Security
3−}:
1+{ stdenv, fetchurl, scons, boost, gperftools, pcre-cpp, snappy, zlib, libyamlcpp
2+, sasl, openssl, libpcap, python27, curl, Security, CoreFoundation, cctools }:
43
54# Note:
65# The command line tools are written in Go as part of a different package (mongodb-tools)
76
87with stdenv.lib;
98
10−let version = "3.4.10";
11− system-libraries = [
12− "pcre"
13− #"asio" -- XXX use package?
14− #"wiredtiger"
15− "boost"
16− "snappy"
17− "zlib"
18− #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
19− #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
20− "yaml"
21− ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
22−
23−in stdenv.mkDerivation {
24− pname = "mongodb";
9+{ version, sha256, patches ? [] }@args:
10+
11+let
12+ python = python27.withPackages (ps: with ps; [ pyyaml typing cheetah ]);
13+ system-libraries = [
14+ "boost"
15+ "pcre"
16+ "snappy"
17+ "yaml"
18+ "zlib"
19+ #"asio" -- XXX use package?
20+ #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs).
21+ #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source.
22+ #"wiredtiger"
23+ ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
24+ inherit (stdenv.lib) systems subtractLists;
25+
26+in stdenv.mkDerivation rec {
2527 inherit version;
28+ name = "mongodb-${version}";
2629
2730 src = fetchurl {
2831 url = "https://fastdl.mongodb.org/src/mongodb-src-r${version}.tar.gz";
29− sha256 = "1wz2mhl9z0b1bdkg6m8v8mvw9k60mdv5ybq554xn3yjj9z500f24";
32+ inherit sha256;
3033 };
3134
3235 nativeBuildInputs = [ scons ];
3336 buildInputs = [
34− sasl boost gperftools pcre-cpp snappy
35− zlib libyamlcpp sasl openssl.dev openssl.out libpcap
36− ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
37−
38− patches =
39− [
40− # MongoDB keeps track of its build parameters, which tricks nix into
41− # keeping dependencies to build inputs in the final output.
42− # We remove the build flags from buildInfo data.
43− ./forget-build-dependencies.patch
44− (fetchpatch {
45− url = https://projects.archlinux.org/svntogit/community.git/plain/trunk/boost160.patch?h=packages/mongodb;
46− name = "boost160.patch";
47− sha256 = "0bvsf3499zj55pzamwjmsssr6x63w434944w76273fr5rxwzcmh8";
48− })
49− ];
37+ boost
38+ curl
39+ gperftools
40+ libpcap
41+ libyamlcpp
42+ openssl
43+ pcre-cpp
44+ python
45+ sasl
46+ snappy
47+ zlib
48+ ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security CoreFoundation cctools ];
49+
50+ # MongoDB keeps track of its build parameters, which tricks nix into
51+ # keeping dependencies to build inputs in the final output.
52+ # We remove the build flags from buildInfo data.
53+ inherit patches;
5054
5155 postPatch = ''
5256 # fix environment variable reading
5357 substituteInPlace SConstruct \
5458 --replace "env = Environment(" "env = Environment(ENV = os.environ,"
5559 '' + stdenv.lib.optionalString stdenv.isDarwin ''
60+ substituteInPlace src/third_party/mozjs-45/extract/js/src/jsmath.cpp --replace 'defined(HAVE_SINCOS)' 0
5661
5762 substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder
5863 substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder
@@ -66,13 +71,14 @@ in stdenv.mkDerivation {
6671 --replace 'engine("wiredTiger")' 'engine("mmapv1")'
6772 '';
6873
69− NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument";
74+ NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang
75+ "-Wno-unused-command-line-argument";
7076
7177 sconsFlags = [
7278 "--release"
7379 "--ssl"
7480 #"--rocksdb" # Don't have this packaged yet
75− "--wiredtiger=${if stdenv.is64bit then "on" else "off"}"
81+ "--wiredtiger=on"
7682 "--js-engine=mozjs"
7783 "--use-sasl-client"
7884 "--disable-warnings-as-errors"
@@ -87,8 +93,13 @@ in stdenv.mkDerivation {
8793 '';
8894
8995 preInstall = ''
90− mkdir -p $out/lib
96+ mkdir -p "$out/lib"
9197 '';
98+
99+ postInstall = ''
100+ rm -f "$out/bin/install_compass" || true
101+ '';
102+
92103 prefixKey = "--prefix=";
93104
94105 enableParallelBuilding = true;
@@ -97,10 +108,10 @@ in stdenv.mkDerivation {
97108
98109 meta = {
99110 description = "A scalable, high-performance, open source NoSQL database";
100− homepage = http://www.mongodb.org;
101− license = licenses.agpl3;
111+ homepage = "http://www.mongodb.org";
112+ license = licenses.sspl;
102113
103114 maintainers = with maintainers; [ bluescreen303 offline cstrahan ];
104− platforms = platforms.unix;
115+ platforms = subtractLists systems.doubles.i686 systems.doubles.unix;
105116 };
106117}
pkgs/servers/nosql/mongodb/mozjs-45_fix-3-byte-opcode.patchnew file+27
@@ -0,0 +1,27 @@
1+# HG changeset patch
2+# User Dan Gohman <sunfish@mozilla.com>
3+# Parent d9b405d82cffb07343a5f2fd941e029298c7f6c4
4+# Bug 1390214 - IonMonkey: Don't test for a 3-byte opcode in a 2-byte opcode predicate.
5+# https://bug1390214.bmoattachments.org/attachment.cgi?id=8902972
6+
7+diff --git a/src/third_party/mozjs-45/extract/js/src/jit/x86-shared/Encoding-x86-shared.h b/src/third_party/mozjs-45/extract/js/src/jit/x86-shared/Encoding-x86-shared.h
8+--- a/src/third_party/mozjs-45/extract/js/src/jit/x86-shared/Encoding-x86-shared.h
9++++ b/src/third_party/mozjs-45/extract/js/src/jit/x86-shared/Encoding-x86-shared.h
10+@@ -310,17 +310,16 @@ enum ThreeByteOpcodeID {
11+
12+ // Test whether the given opcode should be printed with its operands reversed.
13+ inline bool IsXMMReversedOperands(TwoByteOpcodeID opcode)
14+ {
15+ switch (opcode) {
16+ case OP2_MOVSD_WsdVsd: // also OP2_MOVPS_WpsVps
17+ case OP2_MOVAPS_WsdVsd:
18+ case OP2_MOVDQ_WdqVdq:
19+- case OP3_PEXTRD_EdVdqIb:
20+ return true;
21+ default:
22+ break;
23+ }
24+ return false;
25+ }
26+
27+ enum ThreeByteEscape {
pkgs/servers/nosql/mongodb/v3_4.nixnew file+15
@@ -0,0 +1,15 @@
1+{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }:
2+
3+let
4+ buildMongoDB = callPackage ./mongodb.nix {
5+ inherit sasl;
6+ inherit boost;
7+ inherit Security;
8+ inherit CoreFoundation;
9+ inherit cctools;
10+ };
11+in buildMongoDB {
12+ version = "3.4.24";
13+ sha256 = "0j6mvgv0jnsnvgkl8505bl88kbxkba66qijlpi1la0dd5pd1imfr";
14+ patches = [ ./forget-build-dependencies-3-4.patch ];
15+}
pkgs/servers/nosql/mongodb/v3_6.nixnew file+16
@@ -0,0 +1,16 @@
1+{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }:
2+
3+let
4+ buildMongoDB = callPackage ./mongodb.nix {
5+ inherit sasl;
6+ inherit boost;
7+ inherit Security;
8+ inherit CoreFoundation;
9+ inherit cctools;
10+ };
11+in buildMongoDB {
12+ version = "3.6.13";
13+ sha256 = "1mbvk4bmabrswjdm01jssxcygjpq5799zqyx901nsi12vlcymwg4";
14+ patches = [ ./forget-build-dependencies.patch ]
15+ ++ stdenv.lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view.patch ];
16+}
pkgs/servers/nosql/mongodb/v4_0.nixnew file+17
@@ -0,0 +1,17 @@
1+{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }:
2+
3+let
4+ buildMongoDB = callPackage ./mongodb.nix {
5+ inherit sasl;
6+ inherit boost;
7+ inherit Security;
8+ inherit CoreFoundation;
9+ inherit cctools;
10+ };
11+in buildMongoDB {
12+ version = "4.0.12";
13+ sha256 = "1j8dqa4jr623y87jrdanyib9r7x18srrvdx952q4azcc8zrdwci1";
14+ patches =
15+ [ ./forget-build-dependencies.patch ./mozjs-45_fix-3-byte-opcode.patch ]
16+ ++ stdenv.lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view.patch ];
17+}
pkgs/top-level/all-packages.nix+19−3
@@ -15894,11 +15894,27 @@ in
1589415894 };
1589515895 mysql = mariadb; # TODO: move to aliases.nix
1589615896
15897− mongodb = callPackage ../servers/nosql/mongodb {
15897+ mongodb = hiPrio mongodb-3_4;
15898+
15899+ mongodb-3_4 = callPackage ../servers/nosql/mongodb/v3_4.nix {
1589815900 sasl = cyrus_sasl;
1589915901 boost = boost160;
15900− openssl = openssl_1_0_2;
15901− inherit (darwin.apple_sdk.frameworks) Security;
15902+ inherit (darwin) cctools;
15903+ inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
15904+ };
15905+
15906+ mongodb-3_6 = callPackage ../servers/nosql/mongodb/v3_6.nix {
15907+ sasl = cyrus_sasl;
15908+ boost = boost160;
15909+ inherit (darwin) cctools;
15910+ inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
15911+ };
15912+
15913+ mongodb-4_0 = callPackage ../servers/nosql/mongodb/v4_0.nix {
15914+ sasl = cyrus_sasl;
15915+ boost = boost169;
15916+ inherit (darwin) cctools;
15917+ inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
1590215918 };
1590315919
1590415920 nginx-sso = callPackage ../servers/nginx-sso { };