all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#32133] [PATCH] build-system/go: Use invoke instead of system*.
@ 2018-07-12 14:31 Leo Famulari
  2018-07-24  8:31 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Famulari @ 2018-07-12 14:31 UTC (permalink / raw)
  To: 32133

* guix/build/go-build-system.scm (unpack, build): Use invoke.
(install-source): Unconditionally return #t.
(check): Use invoke and unconditionally return #t.
---
 guix/build/go-build-system.scm | 38 ++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 7c833a616..6be016706 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -125,17 +125,17 @@ unset.  When SOURCE is a directory, copy it instead of unpacking."
         (copy-recursively source dest #:keep-mtime? #t)
         #t)
       (if (string-suffix? ".zip" source)
-        (zero? (system* "unzip" "-d" dest source))
-        (zero? (system* "tar" "-C" dest "-xvf" source))))))
+        (invoke "unzip" "-d" dest source)
+        (invoke "tar" "-C" dest "-xvf" source)))))
 
 (define* (install-source #:key install-source? outputs #:allow-other-keys)
   "Install the source code to the output directory."
   (let* ((out (assoc-ref outputs "out"))
          (source "src")
          (dest (string-append out "/" source)))
-    (if install-source?
-      (copy-recursively source dest #:keep-mtime? #t)
-      #t)))
+    (when install-source?
+      (copy-recursively source dest #:keep-mtime? #t))
+    #t))
 
 (define (go-package? name)
   (string-prefix? "go-" name))
@@ -178,24 +178,26 @@ respectively."
 
 (define* (build #:key import-path #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
-  (or
-    (zero? (system* "go" "install"
-                    "-v" ; print the name of packages as they are compiled
-                    "-x" ; print each command as it is invoked
-                    ;; Respectively, strip the symbol table and debug
-                    ;; information, and the DWARF symbol table.
-                    "-ldflags=-s -w"
-                    import-path))
-    (begin
+  (with-throw-handler
+    #t
+    (lambda _
+      (invoke "go" "install"
+              "-v" ; print the name of packages as they are compiled
+              "-x" ; print each command as it is invoked
+              ;; Respectively, strip the symbol table and debug
+              ;; information, and the DWARF symbol table.
+              "-ldflags=-s -w"
+              import-path))
+    (lambda (key . args)
       (display (string-append "Building '" import-path "' failed.\n"
                               "Here are the results of `go env`:\n"))
-      (system* "go" "env")
-      #f)))
+      (invoke "go" "env"))))
 
 (define* (check #:key tests? import-path #:allow-other-keys)
   "Run the tests for the package named by IMPORT-PATH."
-  (if tests?
-    (zero? (system* "go" "test" import-path))))
+  (when tests?
+    (invoke "go" "test" import-path))
+  #t)
 
 (define* (install #:key outputs #:allow-other-keys)
   "Install the compiled libraries. `go install` installs these files to
-- 
2.18.0

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

* [bug#32133] [PATCH] build-system/go: Use invoke instead of system*.
  2018-07-12 14:31 [bug#32133] [PATCH] build-system/go: Use invoke instead of system* Leo Famulari
@ 2018-07-24  8:31 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2018-07-24  8:31 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 32133

Leo Famulari <leo@famulari.name> skribis:

> * guix/build/go-build-system.scm (unpack, build): Use invoke.
> (install-source): Unconditionally return #t.
> (check): Use invoke and unconditionally return #t.

Definitely LGTM, thanks!

Ludo’.

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

end of thread, other threads:[~2018-07-24  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 14:31 [bug#32133] [PATCH] build-system/go: Use invoke instead of system* Leo Famulari
2018-07-24  8:31 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.