unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#30306] [PATCH] Fix and improve the mongo-tools package.
@ 2018-01-31 14:05 Christopher Baines
  2018-01-31 14:13 ` [bug#30306] [PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit Christopher Baines
  2018-01-31 22:11 ` [bug#30306] [PATCH] " Leo Famulari
  0 siblings, 2 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:05 UTC (permalink / raw)
  To: 30306

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

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(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit.
  2018-01-31 14:05 [bug#30306] [PATCH] Fix and improve the mongo-tools package Christopher Baines
@ 2018-01-31 14:13 ` Christopher Baines
  2018-01-31 14:13   ` [bug#30306] [PATCH 2/5] gnu: Add go-github.com-smartystreets-assertions Christopher Baines
                     ` (3 more replies)
  2018-01-31 22:11 ` [bug#30306] [PATCH] " Leo Famulari
  1 sibling, 4 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:13 UTC (permalink / raw)
  To: 30306

* gnu/packages/check.scm (go-github.com-smartystreets-gunit): New variable.
---
 gnu/packages/check.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH 2/5] gnu: Add go-github.com-smartystreets-assertions.
  2018-01-31 14:13 ` [bug#30306] [PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit Christopher Baines
@ 2018-01-31 14:13   ` Christopher Baines
  2018-01-31 14:13   ` [bug#30306] [PATCH 3/5] gnu: Add go-github.com-jtolds-gls Christopher Baines
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:13 UTC (permalink / raw)
  To: 30306

* gnu/packages/check.scm (go-github.com-smartystreets-assertions): New
  variable.
---
 gnu/packages/check.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH 3/5] gnu: Add go-github.com-jtolds-gls.
  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   ` 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   ` [bug#30306] [PATCH 5/5] gnu: Fix and improve the mongo-tools package Christopher Baines
  3 siblings, 0 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:13 UTC (permalink / raw)
  To: 30306

* gnu/packages/golang.scm (go-github.com-jtolds-gls): New variable.
---
 gnu/packages/golang.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH 4/5] gnu: Add go-github.com-smartystreets-goconvey.
  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   ` Christopher Baines
  2018-01-31 14:13   ` [bug#30306] [PATCH 5/5] gnu: Fix and improve the mongo-tools package Christopher Baines
  3 siblings, 0 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:13 UTC (permalink / raw)
  To: 30306

* gnu/packages/check.scm (go-github.com-smartystreets-goconvey): New variable.
---
 gnu/packages/check.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH 5/5] gnu: Fix and improve the mongo-tools package.
  2018-01-31 14:13 ` [bug#30306] [PATCH 1/5] gnu: Add go-github.com-smartystreets-gunit Christopher Baines
                     ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 8+ messages in thread
From: Christopher Baines @ 2018-01-31 14:13 UTC (permalink / raw)
  To: 30306

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#30306] [PATCH] Fix and improve the mongo-tools package.
  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 22:11 ` Leo Famulari
  2018-02-01 20:32   ` bug#30306: " Christopher Baines
  1 sibling, 1 reply; 8+ messages in thread
From: Leo Famulari @ 2018-01-31 22:11 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 30306

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

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!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30306: [PATCH] Fix and improve the mongo-tools package.
  2018-01-31 22:11 ` [bug#30306] [PATCH] " Leo Famulari
@ 2018-02-01 20:32   ` Christopher Baines
  0 siblings, 0 replies; 8+ messages in thread
From: Christopher Baines @ 2018-02-01 20:32 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 30306-done

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]


Leo Famulari <leo@famulari.name> writes:

> 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 :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-01 20:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [bug#30306] [PATCH 5/5] gnu: Fix and improve the mongo-tools package Christopher Baines
2018-01-31 22:11 ` [bug#30306] [PATCH] " Leo Famulari
2018-02-01 20:32   ` bug#30306: " Christopher Baines

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).