[PATCH] Fix and improve the mongo-tools package.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 31 Jan 2018 15:05
(address . guix-patches@gnu.org)
87shamktrz.fsf@cbaines.net
Turns out that the mongo-tools package worked on my machine, but not on
my _other_ machine when I tried it. I think this was caused by changing
the source, but not updating the hash.

These packages fix that, and also improve the testing for the pacakge at
the same time.

Christopher Baines (5):
gnu: Add go-github.com-smartystreets-gunit.
gnu: Add go-github.com-smartystreets-assertions.
gnu: Add go-github.com-jtolds-gls.
gnu: Add go-github.com-smartystreets-goconvey.
gnu: Fix and improve the mongo-tools package.

gnu/packages/check.scm | 82 ++++++++++++++++++++++++++++++++++++++++++++++
gnu/packages/databases.scm | 80 +++++++++++++++++++++++++++-----------------
gnu/packages/golang.scm | 23 +++++++++++++
3 files changed, 155 insertions(+), 30 deletions(-)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlpxzUBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XeeyhAAgMZc85j9ACbYxxGqhIKUxAuvAUJvCZYL7c9zU5LVN1q5Pyymytu4qrBh
eiL9HTkisvpbeatxNmZBy1iGzFEX4fF7GWdr+o31KJU+i0jlW7+T7ZKBrK69dhSa
R2Jgu94D0bo0mr0IDe67VXtdTwQV1PuB2rWmW34+vC5yvx38ZZ2FFpDxrnqBtCv/
UePvRVQ4/t1O7CYDxHDMYLirwCc3ifWZXTQLbU+e27iAUg/NRH4VNCh04saDVreY
SctK51l4TshYK5wZvQPovfS7tOSMBFpWlgWth6hgOa9K//0mfuUsotU0AH4+qpmW
vROLZrD17FjEL+B7tZKP0ImGw+joNmum+yUYp1oicqNJmZerG4aqECcXRWXN9rGI
RfKP5auKLhAKYe3KqPj/U4m3QDms7cZICYo7AOfTG02psgyyvRykx1vRLVXsRbQv
8alQaKD5R/ifrEC9soH+c5jtEoJgITaBBBo5zN1vY4Pi6oPOhLVVRv4TzNxvuM5a
tNmhby6uk4gFpbNCuDsSvpmnZHiLlkxeIQabXAhW6GKVdJlb5pSjTwjjIzVMy/2k
L3PUi1A4vYiEinqBiouQmcetN3OV1H77Hck233FDgmeVw4KIQDFSrvacjpgS3And
KywSouyz8JbDZDiWKLfRRIRQzlkIzNXNWL6AYtn0GIcz3UX03iY=
=pUP0
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 31 Jan 2018 15:13
[PATCH 4/5] gnu: Add go-github.com-smartystreets-goconvey.
(address . 30306@debbugs.gnu.org)
20180131141319.14598-4-mail@cbaines.net
* gnu/packages/check.scm (go-github.com-smartystreets-goconvey): New variable.
---
gnu/packages/check.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (47 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index b26deda8a..1276c0fda 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -49,6 +49,7 @@
#:use-module (gnu packages autotools)
#:use-module (gnu packages bash)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages golang)
#:use-module (gnu packages python)
#:use-module (gnu packages python-web)
#:use-module (gnu packages time)
@@ -363,6 +364,32 @@ for writing tests in Go.")
(home-page "https://github.com/smartystreets/assertions")
(license license:expat)))
+(define-public go-github.com-smartystreets-goconvey
+ (package
+ (name "go-github.com-smartystreets-goconvey")
+ (version "1.6.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/smartystreets/goconvey")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1ph18rkl3ns3fgin5i4j54w5a69grrmf3apcsmnpdn1wlrbs3dxh"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/smartystreets/goconvey"))
+ (propagated-inputs
+ `(("go-github.com-jtolds-gls" ,go-github.com-jtolds-gls)
+ ("go-github.com-smartystreets-assertions" ,go-github.com-smartystreets-assertions)))
+ (synopsis "Go testing tool with both a web and terminal user interface")
+ (description
+ "GoConvey is a testing tool for Go. It integrates with go test, can show
+test coverage and has a web user interface that will refresh automatically.")
+ (home-page "https://github.com/smartystreets/goconvey")
+ (license license:expat)))
+
(define-public googletest
(package
(name "googletest")
--
2.15.1
C
C
Christopher Baines wrote on 31 Jan 2018 15:13
[PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit.
(address . 30306@debbugs.gnu.org)
20180131141319.14598-1-mail@cbaines.net
* gnu/packages/check.scm (go-github.com-smartystreets-gunit): New variable.
---
gnu/packages/check.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 564b75f8d..69d5b7a38 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -308,6 +308,36 @@ normally do not detect. The goal is to detect only real errors in the code
(home-page "https://github.com/go-check/check")
(license license:bsd-2))))
+(define-public go-github.com-smartystreets-gunit
+ (package
+ (name "go-github.com-smartystreets-gunit")
+ (version "1.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/smartystreets/gunit")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "00m4zg0kdj49mnpmf9klb44ba71p966xsk6zknrzqgfc8119f35z"))))
+ (build-system go-build-system)
+ (arguments
+ '(;; TODO: This package depends on go-github.com-smartystreets-assertions
+ ;; for running the tests, but go-github.com-smartystreets-assertions
+ ;; depends on this package, so break this loop by not running the tests
+ ;; for this package.
+ #:tests? #f
+ #:import-path "github.com/smartystreets/gunit"))
+ (synopsis "Testing tool for Go, in the style of xUnit")
+ (description
+ "@code{gunit} allows the test author to use a struct as the scope for a
+group of related test cases, in the style of xUnit fixtures. This makes
+extraction of setup/teardown behavior (as well as invoking the system under
+test) much simpler.")
+ (home-page "https://github.com/smartystreets/gunit")
+ (license license:expat)))
+
(define-public googletest
(package
(name "googletest")
--
2.15.1
C
C
Christopher Baines wrote on 31 Jan 2018 15:13
[PATCH 2/5] gnu: Add go-github.com-smartystreets-assertions.
(address . 30306@debbugs.gnu.org)
20180131141319.14598-2-mail@cbaines.net
* gnu/packages/check.scm (go-github.com-smartystreets-assertions): New
variable.
---
gnu/packages/check.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 69d5b7a38..b26deda8a 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -338,6 +338,31 @@ test) much simpler.")
(home-page "https://github.com/smartystreets/gunit")
(license license:expat)))
+(define-public go-github.com-smartystreets-assertions
+ (package
+ (name "go-github.com-smartystreets-assertions")
+ (version "1.8.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/smartystreets/assertions")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1j0adgbykl55rf2945g0n5bmqdsnjcqlx5dcmpfh4chki43hiwg9"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/smartystreets/assertions"))
+ (native-inputs
+ `(("go-github.com-smartystreets-gunit" ,go-github.com-smartystreets-gunit)))
+ (synopsis "Assertions for testing with Go")
+ (description
+ "The @code{assertions} package provides convinient assertion functions
+for writing tests in Go.")
+ (home-page "https://github.com/smartystreets/assertions")
+ (license license:expat)))
+
(define-public googletest
(package
(name "googletest")
--
2.15.1
C
C
Christopher Baines wrote on 31 Jan 2018 15:13
[PATCH 3/5] gnu: Add go-github.com-jtolds-gls.
(address . 30306@debbugs.gnu.org)
20180131141319.14598-3-mail@cbaines.net
* gnu/packages/golang.scm (go-github.com-jtolds-gls): New variable.
---
gnu/packages/golang.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (33 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index b8eb90ed9..3149d36ba 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -496,3 +496,26 @@ way of specifying command line options.")
termination.")
(home-page "https://gopkg.in/tomb.v2")
(license license:bsd-3))))
+
+(define-public go-github.com-jtolds-gls
+ (package
+ (name "go-github.com-jtolds-gls")
+ (version "4.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jtolds/gls")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1vm37pvn0k4r6d3m620swwgama63laz8hhj3pyisdhxwam4m2g1h"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/jtolds/gls"))
+ (synopsis "@code{gls} provides Goroutine local storage")
+ (description
+ "The @code{gls} package provides a way to store a retrieve values
+per-goroutine.")
+ (home-page "https://github.com/jtolds/gls")
+ (license license:expat)))
--
2.15.1
C
C
Christopher Baines wrote on 31 Jan 2018 15:13
[PATCH 5/5] gnu: Fix and improve the mongo-tools package.
(address . 30306@debbugs.gnu.org)
20180131141319.14598-5-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(-)

Toggle diff (108 lines)
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
L
L
Leo Famulari wrote on 31 Jan 2018 23:11
Re: [bug#30306] [PATCH] Fix and improve the mongo-tools package.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 30306@debbugs.gnu.org)
20180131221140.GA24187@jasmine.lan
On Wed, Jan 31, 2018 at 02:05:52PM +0000, Christopher Baines wrote:
Toggle quote (7 lines)
> Turns out that the mongo-tools package worked on my machine, but not on
> my _other_ machine when I tried it. I think this was caused by changing
> the source, but not updating the hash.
>
> These packages fix that, and also improve the testing for the pacakge at
> the same time.

Okay, LGTM! Thanks!
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlpyPxkACgkQJkb6MLrK
fwhGEw/9HQW136iKnXm9BgCaRi8MSkFVOtYutNrshaBrFVcjUfiohGJmwNm79Ms2
N5j51zEoy9U8+v3c70fgFPXq/TRg9nsO9p3yQL+L2YTImwILv3KFMQs42w78OKic
Pa5CeeTJ09aJ8ft0fWnU6wUmZ1EL8SEIpmPfF8+hSs0JJnJQs+S2VGDTdLKJsb4s
5DM1DTNVFTvL3tP6EnCXMmSzFFcuFzPszqG2GXtR8dg096dW6ANgtmeCm8jQjKEW
6skl+ODPoXL53cbuDHqeC7eTTuKJyvCllXFUBJj/LPiQPtPG3e5xjmFHmSoScYD+
LXdI5ADyU3H1qq2PFJNNZ0xuxY8lP+17qmypyeWedePlHHBrSuTi2QbnwuxODWKE
9xwPe4FIAN/lZBKt0598WHB15PLFJQNSQDDleewYoZiDunQ87rSmVMwx4L1u2sHl
myMS6LqdYoViFyNQGQCjOOJqT2aqyMPl0DlaaMA3JUZDVKlmiqDcaVOos4Caxkl8
A3l7mLylIbSUnBpDsSoZdcJf24drZf1vlKekLbVRz/MQjwXUdGWcVafY5j2Vy8sx
ljtuia9OzVxm921/MFjKg79iXns0NrgQevDhT9SALq6Me7K3A+qVxyX9qKneHBr5
xPKhzZG/6eOrpz1Zr6yrhyTG/cw+O4JK0OtOByBlVpxGutQpnlM=
=UHUi
-----END PGP SIGNATURE-----


C
C
Christopher Baines wrote on 1 Feb 2018 21:32
(name . Leo Famulari)(address . leo@famulari.name)(address . 30306-done@debbugs.gnu.org)
87bmh8pi1r.fsf@cbaines.net
Leo Famulari <leo@famulari.name> writes:

Toggle quote (10 lines)
> On Wed, Jan 31, 2018 at 02:05:52PM +0000, Christopher Baines wrote:
>> Turns out that the mongo-tools package worked on my machine, but not on
>> my _other_ machine when I tried it. I think this was caused by changing
>> the source, but not updating the hash.
>>
>> These packages fix that, and also improve the testing for the pacakge at
>> the same time.
>
> Okay, LGTM! Thanks!

Great, I've pushed this now :)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlpzeWBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcDvQ/+KYvo/fichYjeSij2cnzzAPN2foK4EXFRwnjlI6n5wykqG24p+hY0Hvrz
05aWwS3ZCb8O0uwn3026+NZJZEosEYgjHuVy3FzjmeX4UMaRvZa0QgVmrc+avdGP
rMAfTHbGzb+U0wSgO+uH//rWzcdrctkdZqT8+I9qqkK93Ihy4QHa21QGz1HUXZ1/
547sc58cLeLB6+NXVrfn4aUIbpVkmFyohnbHl0AdM2xT4CoZ7GRlgDbNoowoQwjk
O6OzYY6CHlwRHEdbBHZj4gLrZO/AO2c8CiIzR9NOS6t8XpGvQIEn7fPq4iGCMoov
X3BX/2V7zGiGqAIb//6phChatXFvZis/Hd0F+bJMSFph5wu30P6b6SWqveB8Vr/q
ghQ/DVRWspj2ip6Y32my3Y4ifuSMV/ySG3SUTGc5uW0/R/2RWGym9M5CKmkuI35P
ELPX73koP1XmM1AP1eJVZC9cl9J3/+hRsYH874XnYdscYMMVkFc/ynZCD8SNMWjR
T1PeerGPc8b4ka3CRxmBvRWwzjY+TzlAWRFIQUfvLf2Ob3vxntgPrwxLLe/SHTiO
0AVheoGJvzG3PM6uZFbgqEV2NH7hIgeMMhvoMTotYOFfGGVTc/T1sZWwK4we1/d3
d4YSYbAWEnpNNPE790Iqdl0N6phdnHIdsc82gWVFWnCpC6ddHto=
=gfUW
-----END PGP SIGNATURE-----

Closed
?