summary refs log tree commit diff
path: root/gnu/packages/databases.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-02-01 13:18:47 +0100
committerMarius Bakke <mbakke@fastmail.com>2018-02-01 13:18:47 +0100
commitbee7bb315cd0b4529a4117b6220c29ca297fc023 (patch)
treefe4741f257e50782e51bc2955ad4480cd2ba6396 /gnu/packages/databases.scm
parentc2f0e5a44b537632c2655f97a2539c3bf02c8a63 (diff)
parent8a4644336d5063fd0bf43e90e3c0823c76e82e4e (diff)
downloadguix-bee7bb315cd0b4529a4117b6220c29ca297fc023.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/databases.scm')
-rw-r--r--gnu/packages/databases.scm132
1 files changed, 132 insertions, 0 deletions
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 42a2067d5f..01dbf91100 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -49,6 +49,7 @@
 
 (define-module (gnu packages databases)
   #:use-module (gnu packages)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages avahi)
@@ -67,6 +68,7 @@
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages time)
+  #:use-module (gnu packages golang)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages language)
   #:use-module (gnu packages libevent)
@@ -86,6 +88,8 @@
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages statistics)
   #:use-module (gnu packages tcl)
+  #:use-module (gnu packages terminals)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages valgrind)
   #:use-module (gnu packages xml)
@@ -94,6 +98,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (guix build-system ruby)
@@ -173,6 +178,50 @@ store key/value pairs in a file in a manner similar to the Unix dbm library
 and provides interfaces to the traditional file format.")
     (license license:gpl3+)))
 
+(define-public go-gopkg.in-mgo.v2
+  (package
+    (name "go-gopkg.in-mgo.v2")
+    (version "2016.08.01")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/go-mgo/mgo")
+                    (commit (string-append "r" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0rwbi1z63w43b0z9srm8m7iz1fdwx7bq7n2mz862d6liiaqa59jd"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "gopkg.in/mgo.v2"
+       ;; TODO: The tests fail as MongoDB fails to start
+       ;; Error parsing command line: unrecognised option '--chunkSize'
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'reset-gzip-timestamps)
+         (add-before 'check 'start-mongodb
+           (lambda* (#:key tests? #:allow-other-keys)
+             (or (not tests?)
+                 (with-directory-excursion "src/gopkg.in/mgo.v2"
+                   (invoke "make" "startdb")))))
+         (add-after 'check 'stop'mongodb
+           (lambda* (#:key tests? #:allow-other-keys)
+             (or (not tests?)
+                 (with-directory-excursion "src/gopkg.in/mgo.v2"
+                   (invoke "make" "stopdb"))))))))
+    (native-inputs
+     `(("go-gopkg.in-check.v1" ,go-gopkg.in-check.v1)
+       ("mongodb" ,mongodb)
+       ("daemontools" ,daemontools)))
+    (synopsis "@code{mgo} offers a rich MongoDB driver for Go.")
+    (description
+     "@code{mgo} (pronounced as mango) is a MongoDB driver for the Go language.
+It implements a rich selection of features under a simple API following
+standard Go idioms.")
+    (home-page "http://labix.org/mgo")
+    (license license:bsd-2)))
+
 (define-public bdb
   (package
     (name "bdb")
@@ -2565,3 +2614,86 @@ transforms idiomatic python function calls to well-formed SQL queries.")
 
 (define-public python2-sql
   (package-with-python2 python-sql))
+
+(define-public mongo-tools
+  (package
+    (name "mongo-tools")
+    (version "3.4.0")
+    (source
+     (origin (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/mongodb/mongo-tools")
+                   (commit (string-append "r" version))))
+             (file-name (git-file-name name version))
+             (sha256
+              (base32
+               "095nc57k4m4iyim0x3fgpw681qba123iyl4qz7xysbv5ngbr19mc"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:unpack-path "github.com/mongodb"
+       #:import-path "github.com/mongodb/mongo-tools"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'delete-bundled-source-code
+           (lambda _
+             (delete-file-recursively
+              "src/github.com/mongodb/mongo-tools/vendor")
+             #t))
+
+         ;; We don't need to install the source code for end-user application
+         (delete 'install-source)
+
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let build ((tools
+                          '("bsondump" "mongodump" "mongoexport" "mongofiles"
+                            "mongoimport" "mongooplog" "mongorestore"
+                            "mongostat" "mongotop")))
+               (if (null? tools)
+                   #t
+                   (if (let* ((tool (car tools))
+                              (command
+                               `("go" "install" "-v"
+                                 "-tags=\"ssl sasl\""
+                                 "-ldflags"
+                                 "-extldflags=-Wl,-z,now,-z,relro"
+                                 ,(string-append
+                                   "src/github.com/mongodb/mongo-tools/"
+                                   tool "/main/" tool ".go"))))
+                         (simple-format #t "build: running ~A\n"
+                                        (string-join command))
+                         (zero? (apply system* command)))
+                       (build (cdr tools))
+                       #f))))))))
+    (native-inputs
+     `(("go-github.com-howeyc-gopass" ,go-github.com-howeyc-gopass)
+       ("go-github.com-jessevdk-go-flags" ,go-github.com-jessevdk-go-flags)
+       ("go-golang.org-x-crypto-ssh-terminal" ,go-golang.org-x-crypto-ssh-terminal)
+       ("go-gopkg.in-mgo.v2" ,go-gopkg.in-mgo.v2)
+       ("go-gopkg.in-tomb.v2" ,go-gopkg.in-tomb.v2)
+       ("go-github.com-nsf-termbox-go" ,go-github.com-nsf-termbox-go)))
+    (home-page "https://github.com/mongodb/mongo-tools")
+    (synopsis "Various tools for interacting with MongoDB and BSON")
+    (description
+     "This package includes a collection of tools related to MongoDB.
+@table @code
+@item bsondump
+Display BSON files in a human-readable format
+@item mongoimport
+Convert data from JSON, TSV or CSV and insert them into a collection
+@item mongoexport
+Write an existing collection to CSV or JSON format
+@item mongodump/mongorestore
+Dump MongoDB backups to disk in the BSON format
+@item mongorestore
+Read MongoDB backups in the BSON format, and restore them to a live database
+@item mongostat
+Monitor live MongoDB servers, replica sets, or sharded clusters
+@item mongofiles
+Read, write, delete, or update files in GridFS
+@item mongooplog
+Replay oplog entries between MongoDB servers
+@item mongotop
+Monitor read/write activity on a mongo server
+@end table")
+    (license license:asl2.0)))