From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edjL1-0005KH-GU for guix-patches@gnu.org; Mon, 22 Jan 2018 16:09:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edjKz-0002tK-MY for guix-patches@gnu.org; Mon, 22 Jan 2018 16:09:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:58950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edjKz-0002sZ-Et for guix-patches@gnu.org; Mon, 22 Jan 2018 16:09:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1edjKz-0007nL-7w for guix-patches@gnu.org; Mon, 22 Jan 2018 16:09:05 -0500 Subject: [bug#30214] [PATCH 10/10] gnu: Add mongo-tools. Resent-Message-ID: From: Christopher Baines Date: Mon, 22 Jan 2018 21:08:30 +0000 Message-Id: <20180122210830.28924-10-mail@cbaines.net> In-Reply-To: <20180122210830.28924-1-mail@cbaines.net> References: <87h8rd4nxg.fsf@cbaines.net> <20180122210830.28924-1-mail@cbaines.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30214@debbugs.gnu.org * gnu/packages/databases.scm (mongo-tools): New variable. --- gnu/packages/databases.scm | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index 8f5f639cc..0c1bc9ea3 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -68,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) @@ -87,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) @@ -2607,3 +2610,95 @@ 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 url-fetch) + (uri (string-append "https://github.com/mongodb/mongo-tools" + "/archive/r" version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "095nc57k4m4iyim0x3fgpw681qba123iyl4qz7xysbv5ngbr19mc")))) + (build-system go-build-system) + (arguments + `(#:tests? #f + #:unpack-path "github.com/mongodb" + #:import-path "github.com/mongodb/mongo-tools" + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'rename-archive + (lambda _ + (rename-file + ,(string-append "src/github.com/mongodb/mongo-tools-r" version) + "src/github.com/mongodb/mongo-tools") + #t)) + + (add-after 'rename-archive '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 ((bash (which "bash")) + (out (assoc-ref outputs "out"))) + (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))) -- 2.15.1