GNU bug report logs - #32133
[PATCH] build-system/go: Use invoke instead of system*.

Previous Next

Package: guix-patches;

Reported by: Leo Famulari <leo <at> famulari.name>

Date: Thu, 12 Jul 2018 14:32:02 UTC

Severity: normal

Tags: patch

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32133 in the body.
You can then email your comments to 32133 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#32133; Package guix-patches. (Thu, 12 Jul 2018 14:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Famulari <leo <at> famulari.name>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 12 Jul 2018 14:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: guix-patches <at> gnu.org
Subject: [PATCH] build-system/go: Use invoke instead of system*.
Date: Thu, 12 Jul 2018 10:31:17 -0400
* 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





bug closed, send any further explanations to 32133 <at> debbugs.gnu.org and Leo Famulari <leo <at> famulari.name> Request was from Leo Famulari <leo <at> famulari.name> to control <at> debbugs.gnu.org. (Fri, 20 Jul 2018 19:37:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#32133; Package guix-patches. (Tue, 24 Jul 2018 08:33:02 GMT) Full text and rfc822 format available.

Message #10 received at 32133 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Leo Famulari <leo <at> famulari.name>
Cc: 32133 <at> debbugs.gnu.org
Subject: Re: [bug#32133] [PATCH] build-system/go: Use invoke instead of
 system*.
Date: Tue, 24 Jul 2018 10:31:53 +0200
Leo Famulari <leo <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 21 Aug 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.