From 462b1e4473d3d322a8ddc3a335ebc8959e645ce8 Mon Sep 17 00:00:00 2001 From: Doro Rose Date: Wed, 2 Mar 2022 11:55:53 +0100 Subject: [PATCH 1/5] mongodb: add 4.4 --- nixos/tests/mongodb.nix | 4 +++ pkgs/servers/nosql/mongodb/4.4.nix | 14 ++++++++ ...asio-no-experimental-string-view-4-4.patch | 23 +++++++++++++ .../forget-build-dependencies-4-4.patch | 33 +++++++++++++++++++ pkgs/servers/nosql/mongodb/mongodb.nix | 18 ++++++---- pkgs/top-level/all-packages.nix | 7 ++++ 6 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 pkgs/servers/nosql/mongodb/4.4.nix create mode 100644 pkgs/servers/nosql/mongodb/asio-no-experimental-string-view-4-4.patch create mode 100644 pkgs/servers/nosql/mongodb/forget-build-dependencies-4-4.patch diff --git a/nixos/tests/mongodb.nix b/nixos/tests/mongodb.nix index 9c6fdfb1ca76..edd074f5163c 100644 --- a/nixos/tests/mongodb.nix +++ b/nixos/tests/mongodb.nix @@ -37,6 +37,8 @@ import ./make-test-python.nix ({ pkgs, ... }: mongodb-3_6 mongodb-4_0 mongodb-4_2 + mongodb-4_4 + mongodb-5_0 ]; }; }; @@ -48,6 +50,8 @@ import ./make-test-python.nix ({ pkgs, ... }: + runMongoDBTest pkgs.mongodb-3_6 + runMongoDBTest pkgs.mongodb-4_0 + runMongoDBTest pkgs.mongodb-4_2 + + runMongoDBTest pkgs.mongodb-4_4 + + runMongoDBTest pkgs.mongodb-5_0 + '' node.shutdown() ''; diff --git a/pkgs/servers/nosql/mongodb/4.4.nix b/pkgs/servers/nosql/mongodb/4.4.nix new file mode 100644 index 000000000000..01cefa95d039 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/4.4.nix @@ -0,0 +1,14 @@ +{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }: + +let + buildMongoDB = callPackage ./mongodb.nix { + inherit sasl boost Security CoreFoundation cctools; + }; +in +buildMongoDB { + version = "4.4.10"; + sha256 = "1rn9w3wwb2kbixqx39zb7cczzw5qjbh7d9yhlbivrs0f9bywl8nx"; + patches = [ + ./forget-build-dependencies-4-4.patch + ] ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view-4-4.patch ]; +} diff --git a/pkgs/servers/nosql/mongodb/asio-no-experimental-string-view-4-4.patch b/pkgs/servers/nosql/mongodb/asio-no-experimental-string-view-4-4.patch new file mode 100644 index 000000000000..b27145d57ecf --- /dev/null +++ b/pkgs/servers/nosql/mongodb/asio-no-experimental-string-view-4-4.patch @@ -0,0 +1,23 @@ +--- a/src/third_party/asio-master/asio/include/asio/detail/config.hpp +--- b/src/third_party/asio-master/asio/include/asio/detail/config.hpp +@@ -831,20 +831,8 @@ + # endif // (__cplusplus >= 201402) + # endif // (_LIBCPP_VERSION < 7000) + # else // defined(ASIO_HAS_CLANG_LIBCXX) +-# if (__cplusplus >= 201402) +-# if __has_include() +-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +-# endif // __has_include() +-# endif // (__cplusplus >= 201402) + # endif // // defined(ASIO_HAS_CLANG_LIBCXX) + # endif // defined(__clang__) +-# if defined(__GNUC__) +-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) +-# if (__cplusplus >= 201402) +-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +-# endif // (__cplusplus >= 201402) +-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) +-# endif // defined(__GNUC__) + # endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) + #endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + diff --git a/pkgs/servers/nosql/mongodb/forget-build-dependencies-4-4.patch b/pkgs/servers/nosql/mongodb/forget-build-dependencies-4-4.patch new file mode 100644 index 000000000000..1c3e0982a8c1 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/forget-build-dependencies-4-4.patch @@ -0,0 +1,33 @@ +--- a/site_scons/mongo/generators.py ++++ b/site_scons/mongo/generators.py +@@ -34,30 +34,12 @@ def default_buildinfo_environment_data(): + False, + ), + ( +- 'ccflags', +- '$CCFLAGS', +- True, +- False, +- ), +- ( + 'cxx', + '$CXX_VERSION', + True, + False, + ), + ( +- 'cxxflags', +- '$CXXFLAGS', +- True, +- False, +- ), +- ( +- 'linkflags', +- '$LINKFLAGS', +- True, +- False, +- ), +- ( + 'target_arch', + '$TARGET_ARCH', + True, diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index 7c66d348ffb0..28795890069d 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, sconsPackages, boost, gperftools, pcre-cpp, snappy, zlib, libyamlcpp -, sasl, openssl, libpcap, curl, Security, CoreFoundation, cctools }: +, sasl, openssl, libpcap, python3, curl, Security, CoreFoundation, cctools, xz }: # Note: # The command line tools are written in Go as part of a different package (mongodb-tools) @@ -8,12 +8,12 @@ with lib; { version, sha256, patches ? [] , license ? lib.licenses.sspl -}@args: +}: let variants = if versionAtLeast version "4.2" then rec { python = scons.python.withPackages (ps: with ps; [ pyyaml cheetah3 psutil setuptools ]); - scons = sconsPackages.scons_latest; + scons = sconsPackages.scons_3_1_2.override { python = python3; }; # 4.2 < mongodb <= 5.0.x needs scons 3.x built with python3 mozjsVersion = "60"; mozjsReplace = "defined(HAVE___SINCOS)"; } @@ -44,7 +44,9 @@ in stdenv.mkDerivation rec { inherit sha256; }; - nativeBuildInputs = [ variants.scons ]; + nativeBuildInputs = [ variants.scons ] + ++ lib.optionals (versionAtLeast version "4.4") [ xz ]; + buildInputs = [ boost curl @@ -70,7 +72,6 @@ in stdenv.mkDerivation rec { --replace "env = Environment(" "env = Environment(ENV = os.environ," '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/third_party/mozjs-${variants.mozjsVersion}/extract/js/src/jsmath.cpp --replace '${variants.mozjsReplace}' 0 - substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder substituteInPlace src/third_party/s2/s2cap.cc --replace drem remainder @@ -95,7 +96,8 @@ in stdenv.mkDerivation rec { "--use-sasl-client" "--disable-warnings-as-errors" "VARIANT_DIR=nixos" # Needed so we don't produce argument lists that are too long for gcc / ld - ] ++ map (lib: "--use-system-${lib}") system-libraries; + ] ++ lib.optionals (versionAtLeast version "4.4") [ "--link-model=static" ] + ++ map (lib: "--use-system-${lib}") system-libraries; preBuild = '' sconsFlags+=" CC=$CC" @@ -119,7 +121,9 @@ in stdenv.mkDerivation rec { runHook postInstallCheck ''; - prefixKey = "--prefix="; + installTargets = if (versionAtLeast version "4.4") then "install-core" else "install"; + + prefixKey = if (versionAtLeast version "4.4") then "DESTDIR=" else "--prefix="; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e2035dd2b2ad..cab37a8f14ea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21788,6 +21788,13 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; }; + mongodb-4_4 = callPackage ../servers/nosql/mongodb/4.4.nix { + sasl = cyrus_sasl; + boost = boost17x.override { enableShared = false; }; + inherit (darwin) cctools; + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; + }; + nginx-sso = callPackage ../servers/nginx-sso { }; percona-server56 = callPackage ../servers/sql/percona/5.6.x.nix { }; From 1be4226669a58a64db6118c5d257ceaee02589cd Mon Sep 17 00:00:00 2001 From: Doro Rose Date: Wed, 2 Mar 2022 11:58:01 +0100 Subject: [PATCH 2/5] mongodb: add 5.0 --- pkgs/servers/nosql/mongodb/5.0.nix | 25 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 +++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/servers/nosql/mongodb/5.0.nix diff --git a/pkgs/servers/nosql/mongodb/5.0.nix b/pkgs/servers/nosql/mongodb/5.0.nix new file mode 100644 index 000000000000..c02b27d6ee61 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/5.0.nix @@ -0,0 +1,25 @@ +{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }: + +let + buildMongoDB = callPackage ./mongodb.nix { + inherit sasl boost Security CoreFoundation cctools; + }; + variants = if stdenv.isLinux then + { + version = "5.0.5"; + sha256 = "1nny7a3w6pk8z9cwsz8kgk7gvf8lh5xb3r24drlr7wv970h90826"; + } + else + { + version = "5.0.3"; # at least darwin has to stay on 5.0.3 until the SDK used by nixpkgs is bumped to 10.13 + sha256 = "1p9pq0dfd6lynvnz5p1c8dqp4filzrz86j840xwxwx82dm1zl6p0"; + }; +in +buildMongoDB { + version = variants.version; + sha256 = variants.sha256; + patches = [ + ./forget-build-dependencies-4-4.patch + ./asio-no-experimental-string-view-4-4.patch + ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cab37a8f14ea..6c94d13e3a98 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21795,6 +21795,13 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; }; + mongodb-5_0 = callPackage ../servers/nosql/mongodb/5.0.nix { + sasl = cyrus_sasl; + boost = boost17x.override { enableShared = false; }; + inherit (darwin) cctools; + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; + }; + nginx-sso = callPackage ../servers/nginx-sso { }; percona-server56 = callPackage ../servers/sql/percona/5.6.x.nix { }; From 7a246abcf1181d86c7ca1babf2b9623f351a4eec Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Sat, 9 Apr 2022 09:42:36 +0200 Subject: [PATCH 3/5] mongodb: 4.4.10 -> 4.4.13 --- pkgs/servers/nosql/mongodb/4.4.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/4.4.nix b/pkgs/servers/nosql/mongodb/4.4.nix index 01cefa95d039..7dd74e24fc48 100644 --- a/pkgs/servers/nosql/mongodb/4.4.nix +++ b/pkgs/servers/nosql/mongodb/4.4.nix @@ -6,8 +6,8 @@ let }; in buildMongoDB { - version = "4.4.10"; - sha256 = "1rn9w3wwb2kbixqx39zb7cczzw5qjbh7d9yhlbivrs0f9bywl8nx"; + version = "4.4.13"; + sha256 = "sha256-ebg3R6P+tjRvizDzsl7mZzhTfqIaRJPfHBu0IfRvtS8="; patches = [ ./forget-build-dependencies-4-4.patch ] ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view-4-4.patch ]; From dc72466610d35382d15a8595c81be6cd8aedc97f Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Sat, 9 Apr 2022 09:43:17 +0200 Subject: [PATCH 4/5] mongodb: 4.2.17 -> 4.2.19 --- pkgs/servers/nosql/mongodb/v4_2.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/v4_2.nix b/pkgs/servers/nosql/mongodb/v4_2.nix index e638cddd232a..3759cc1e6d58 100644 --- a/pkgs/servers/nosql/mongodb/v4_2.nix +++ b/pkgs/servers/nosql/mongodb/v4_2.nix @@ -9,8 +9,8 @@ let inherit cctools; }; in buildMongoDB { - version = "4.2.17"; - sha256 = "sha256-4ynvImVjN674VdD/bJ55Vy/IrOlMN8iZb2PAhxwbv1A="; + version = "4.2.19"; + sha256 = "sha256-fngTHd+fSdHqiqQYOYS7o6P5eHybeZy3iNKkGzFmjTw="; patches = [ ./forget-build-dependencies-4-2.patch ] ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view-4-2.patch ]; From 92402c908ff53ee426f112a5fc13928105668f9d Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Sat, 9 Apr 2022 09:44:05 +0200 Subject: [PATCH 5/5] mongodb: 5.0.5 -> 5.0.7 --- pkgs/servers/nosql/mongodb/5.0.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/5.0.nix b/pkgs/servers/nosql/mongodb/5.0.nix index c02b27d6ee61..6bb2294cfffa 100644 --- a/pkgs/servers/nosql/mongodb/5.0.nix +++ b/pkgs/servers/nosql/mongodb/5.0.nix @@ -6,8 +6,8 @@ let }; variants = if stdenv.isLinux then { - version = "5.0.5"; - sha256 = "1nny7a3w6pk8z9cwsz8kgk7gvf8lh5xb3r24drlr7wv970h90826"; + version = "5.0.7"; + sha256 = "sha256-1PeDBZJNqJXHH/cSh2e+WR0PfS/b7XuJEzkkbrRT/gc="; } else {