unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 28198@debbugs.gnu.org
Subject: [bug#28198] [PATCH 2/3] gnu: Add mongodb.
Date: Sat, 30 Sep 2017 08:59:41 +0100	[thread overview]
Message-ID: <20170930075942.31332-2-mail@cbaines.net> (raw)
In-Reply-To: <20170930075942.31332-1-mail@cbaines.net>

* gnu/packages/databases.scm (mongodb): New variable.
---
 gnu/packages/databases.scm                         | 92 ++++++++++++++++++++++
 ...ngodb-support-unknown-linux-distributions.patch | 55 +++++++++++++
 2 files changed, 147 insertions(+)
 create mode 100644 gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 6ce58985e..4ccbe6deb 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -68,8 +68,10 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages serialization)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages valgrind)
   #:use-module (gnu packages xml)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -316,6 +318,96 @@ and generic API, and was originally intended for use with dynamic web
 applications.")
     (license license:bsd-3)))
 
+(define-public mongodb
+  (package
+    (name "mongodb")
+    (version "3.4.9")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/mongodb/mongo/archive/r"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32 "0gidwyvh3bdwmk2pccgkqkaln4ysgn8iwa7ihjzllsq0rdg95045"))
+              (patches
+               (list
+                (search-patch "mongodb-support-unknown-linux-distributions.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("openssl" ,openssl)
+       ("pcre" ,pcre)
+       ("yaml-cpp" ,yaml-cpp)
+       ("zlib" ,zlib)
+       ("snappy" ,snappy)
+       ("boost" ,boost)))
+    (native-inputs
+     `(("scons" ,scons)
+       ("python" ,python-2)
+       ("valgrind" ,valgrind)
+       ("perl" ,perl)))
+    (arguments
+     `(#:phases
+       (let ((common-options
+              `(;; "--use-system-tcmalloc" TODO: Missing gperftools
+                "--use-system-pcre"
+                ;; TODO
+                ;; build/opt/mongo/db/fts/unicode/string.o failed: Error 1
+                ;; --use-system-boost
+                "--use-system-snappy"
+                "--use-system-zlib"
+                "--use-system-valgrind"
+                ;; "--use-system-stemmer" TODO: Missing relevant package
+                "--use-system-yaml"
+                "--disable-warnings-as-errors"
+                ,(format #f "--jobs=~a" (parallel-job-count))
+                "--ssl")))
+         (modify-phases %standard-phases
+           (delete 'configure) ; There is no configure phase
+           (add-after 'unpack 'scons-propagate-environment
+             (lambda _
+               ;; Modify the SConstruct file to arrange for
+               ;; environment variables to be propagated.
+               (substitute* "SConstruct"
+                 (("^env = Environment\\(")
+                  "env = Environment(ENV=os.environ, "))))
+           (add-after 'unpack 'create-version-file
+             (lambda _
+               (call-with-output-file "version.json"
+                 (lambda (port)
+                   (display ,(simple-format #f "{
+    \"version\": \"~A\"
+}" version) port)))))
+           (replace 'build
+             (lambda _
+               (zero? (apply system*
+                             `("scons"
+                               ,@common-options
+                               "mongod" "mongo" "mongos")))))
+           (replace 'check
+             (lambda* (#:key tests? #:allow-other-keys)
+               (or (not tests?)
+                   (zero? (apply system*
+                                 `("scons"
+                                   ,@common-options
+                                   "dbtest" "unittests"))))))
+           (replace 'install
+             (lambda _
+               (let ((bin  (string-append (assoc-ref %outputs "out") "/bin")))
+                 (install-file "mongod" bin)
+                 (install-file "mongos" bin)
+                 (install-file "mongo" bin))
+               #t))))))
+    (home-page "https://www.mongodb.org/")
+    (synopsis "High performance and high availability document database")
+    (description
+     "Mongo is a high-performance, high availability, schema-free
+document-oriented database.  A key goal of MongoDB is to bridge the gap
+between key/value stores (which are fast and highly scalable) and traditional
+RDBMS systems (which are deep in functionality).")
+    (license (list license:agpl3
+                   ;; Some parts are licensed under the Apache License
+                   license:asl2.0))))
+
 (define-public mysql
   (package
     (name "mysql")
diff --git a/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch b/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch
new file mode 100644
index 000000000..6057ebeb0
--- /dev/null
+++ b/gnu/packages/patches/mongodb-support-unknown-linux-distributions.patch
@@ -0,0 +1,55 @@
+From e724bb7018a482640c4f194f88b554af2c59d76e Mon Sep 17 00:00:00 2001
+From: Mark Benvenuto <mark.benvenuto@mongodb.com>
+Date: Wed, 20 Sep 2017 11:50:02 -0400
+Subject: [PATCH] SERVER-30857 Support unknown Linux distributions
+
+---
+ src/mongo/rpc/metadata/client_metadata.cpp | 6 ------
+ src/mongo/util/processinfo_linux.cpp       | 9 ++++++---
+ 2 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/src/mongo/rpc/metadata/client_metadata.cpp b/src/mongo/rpc/metadata/client_metadata.cpp
+index 845a315dd74..a959a4e31e9 100644
+--- a/src/mongo/rpc/metadata/client_metadata.cpp
++++ b/src/mongo/rpc/metadata/client_metadata.cpp
+@@ -302,9 +302,6 @@ void ClientMetadata::serializePrivate(StringData driverName,
+                                       StringData osArchitecture,
+                                       StringData osVersion,
+                                       BSONObjBuilder* builder) {
+-    invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
+-              !osArchitecture.empty() && !osVersion.empty());
+-
+     BSONObjBuilder metaObjBuilder(builder->subobjStart(kMetadataDocumentName));
+ 
+     {
+@@ -347,9 +344,6 @@ Status ClientMetadata::serializePrivate(StringData driverName,
+                                         StringData osVersion,
+                                         StringData appName,
+                                         BSONObjBuilder* builder) {
+-    invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
+-              !osArchitecture.empty() && !osVersion.empty());
+-
+     if (appName.size() > kMaxApplicationNameByteLength) {
+         return Status(ErrorCodes::ClientMetadataAppNameTooLarge,
+                       str::stream() << "The '" << kApplication << "." << kName
+diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
+index c3debf377bd..c2813b026b0 100644
+--- a/src/mongo/util/processinfo_linux.cpp
++++ b/src/mongo/util/processinfo_linux.cpp
+@@ -376,10 +376,13 @@ class LinuxSysHelper {
+             if ((nl = name.find('\n', nl)) != string::npos)
+                 // stop at first newline
+                 name.erase(nl);
+-            // no standard format for name and version.  use kernel version
+-            version = "Kernel ";
+-            version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
++        } else {
++            name = "unknown";
+         }
++
++        // There is no standard format for name and version so use the kernel version.
++        version = "Kernel ";
++        version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
+     }
+ 
+     /**
-- 
2.14.1

  reply	other threads:[~2017-09-30  8:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  9:18 [bug#28198] [PATCH] Add MongoDB package and service Christopher Baines
2017-08-23  9:25 ` [bug#28198] [PATCH 1/4] vm: Add disk-image-size to <virtual-machine> Christopher Baines
2017-08-23  9:25   ` [bug#28198] [PATCH 2/4] gnu: Add mongodb Christopher Baines
2017-08-31 12:32     ` Ludovic Courtès
2017-09-30  8:04       ` Christopher Baines
2017-08-23  9:25   ` [bug#28198] [PATCH 3/4] services: Add MongoDB Christopher Baines
2017-08-31 12:34     ` Ludovic Courtès
2017-09-30  8:05       ` Christopher Baines
2017-08-23  9:25   ` [bug#28198] [PATCH 4/4] tests: databases: Add MongoDB test Christopher Baines
2017-08-31 12:37     ` Ludovic Courtès
2017-09-30  8:09       ` Christopher Baines
2017-08-31 12:29   ` [bug#28198] [PATCH 1/4] vm: Add disk-image-size to <virtual-machine> Ludovic Courtès
2017-09-25 20:36     ` Christopher Baines
2017-09-26  7:14       ` Ludovic Courtès
2017-09-29  6:48         ` [bug#28635] " Christopher Baines
2017-08-26 22:33 ` [bug#28198] [PATCH] Add MongoDB package and service Roel Janssen
2017-08-27 22:30   ` Christopher Baines
2017-09-30  7:59 ` [bug#28198] [PATCH 1/3] vm: Add disk-image-size to <virtual-machine> Christopher Baines
2017-09-30  7:59   ` Christopher Baines [this message]
2017-10-04 14:40     ` [bug#28198] [PATCH 2/3] gnu: Add mongodb Ludovic Courtès
2017-09-30  7:59   ` [bug#28198] [PATCH 3/3] services: Add MongoDB Christopher Baines
2017-10-04 14:44     ` Ludovic Courtès
2017-10-06 20:29       ` bug#28198: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170930075942.31332-2-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=28198@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).