From: Christopher Baines <mail@cbaines.net>
To: 30306@debbugs.gnu.org
Subject: [bug#30306] [PATCH 5/5] gnu: Fix and improve the mongo-tools package.
Date: Wed, 31 Jan 2018 14:13:19 +0000 [thread overview]
Message-ID: <20180131141319.14598-5-mail@cbaines.net> (raw)
In-Reply-To: <20180131141319.14598-1-mail@cbaines.net>
The hash of the source for this package is wrong. Most probably because the
source was changed from a tarball to a git repository without updating the
hash. Fixing this seems to break the check phase, so I rewrote that as well,
making changes to the build and install phases as needed.
* gnu/packages/databases.scm (mongo-tools)[source]: Update the hash value.
[arguments]: Remove the different unpack path, as this isn't necessary when
using the git repository as a source. Move the list of tools to make it
accessible from multiple phases. Rewrite the build phase, getting it to
install the tools in to the location the tests seem to expect to find
them. Replace the check phase to run the tests for each tool
individually. Add an install phase to install the tools, now that go install
is not being run in the build phase.
[native-inputs]: Add go-github.com-smartystreets-goconvey as a native-input
as this is required for running the tests.
---
gnu/packages/databases.scm | 80 +++++++++++++++++++++++++++++-----------------
1 file changed, 50 insertions(+), 30 deletions(-)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 79dac2013..31ed2cd20 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -2617,51 +2617,71 @@ transforms idiomatic python function calls to well-formed SQL queries.")
(file-name (git-file-name name version))
(sha256
(base32
- "095nc57k4m4iyim0x3fgpw681qba123iyl4qz7xysbv5ngbr19mc"))))
+ "1bcsz5cvj39a7nsxsfqmz9igrw33j6yli9kffigqyscs52amw7x1"))))
(build-system go-build-system)
(arguments
- `(#:unpack-path "github.com/mongodb"
- #:import-path "github.com/mongodb/mongo-tools"
+ `(#:import-path "github.com/mongodb/mongo-tools"
+ #:modules ((srfi srfi-1)
+ (guix build go-build-system)
+ (guix build utils))
#: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"
+ (let ((all-tools
+ '("bsondump" "mongodump" "mongoexport" "mongofiles"
+ "mongoimport" "mongooplog" "mongorestore"
+ "mongostat" "mongotop")))
+ (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 applications
+ (delete 'install-source)
+ (replace 'build
+ (lambda _
+ (every (lambda (tool)
+ (let ((command
+ `("go" "build"
+ ;; This is where the tests expect to find the
+ ;; executables
+ "-o" ,(string-append
+ "src/github.com/mongodb/mongo-tools/bin/"
+ tool)
+ "-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))))))))
+ (simple-format #t "build: running ~A\n"
+ (string-join command))
+ (apply invoke command)))
+ all-tools)))
+ (replace 'check
+ (lambda _
+ (with-directory-excursion "src"
+ (every (lambda (tool)
+ (invoke
+ "go" "test" "-v"
+ (string-append "github.com/mongodb/mongo-tools/" tool)))
+ all-tools))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each (lambda (tool)
+ (install-file
+ (string-append "src/github.com/mongodb/mongo-tools/bin/" tool)
+ (string-append (assoc-ref outputs "out")
+ "/bin")))
+ all-tools)))))))
(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)))
+ ("go-github.com-nsf-termbox-go" ,go-github.com-nsf-termbox-go)
+ ("go-github.com-smartystreets-goconvey" ,go-github.com-smartystreets-goconvey)))
(home-page "https://github.com/mongodb/mongo-tools")
(synopsis "Various tools for interacting with MongoDB and BSON")
(description
--
2.15.1
next prev parent reply other threads:[~2018-01-31 14:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 14:05 [bug#30306] [PATCH] Fix and improve the mongo-tools package Christopher Baines
2018-01-31 14:13 ` [bug#30306] [PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit Christopher Baines
2018-01-31 14:13 ` [bug#30306] [PATCH 2/5] gnu: Add go-github.com-smartystreets-assertions Christopher Baines
2018-01-31 14:13 ` [bug#30306] [PATCH 3/5] gnu: Add go-github.com-jtolds-gls Christopher Baines
2018-01-31 14:13 ` [bug#30306] [PATCH 4/5] gnu: Add go-github.com-smartystreets-goconvey Christopher Baines
2018-01-31 14:13 ` Christopher Baines [this message]
2018-01-31 22:11 ` [bug#30306] [PATCH] Fix and improve the mongo-tools package Leo Famulari
2018-02-01 20:32 ` bug#30306: " 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=20180131141319.14598-5-mail@cbaines.net \
--to=mail@cbaines.net \
--cc=30306@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).