[PATCH] build-system/go: Use invoke instead of system*.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Ludovic Courtès
Owner
unassigned
Submitted by
Leo Famulari
Severity
normal
L
L
Leo Famulari wrote on 12 Jul 2018 16:31
(address . guix-patches@gnu.org)
24a770957d0cba9639eaa10d5f38ef95ccca4609.1531405875.git.leo@famulari.name
* 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(-)

Toggle diff (69 lines)
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
L
L
Leo Famulari wrote on 20 Jul 2018 21:36
(no subject)
(address . control@debbugs.gnu.org)
20180720193611.GA11329@jasmine.lan
close 32133
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAltSOasACgkQJkb6MLrK
fwjZsBAAuuapefmmCo4JY9q9CVyy67ZtyYOXC1OQo6uj66YTW24TFN+7xEp886wq
W7W4FLWwowJtvICfTCEwNvUp3kkx8iXNqiHolOqC6V+8lmtRYtHsMhaqYl32vpxJ
mzXFn1ArzSMv8hVfiNmmzBH7feQ+RsrC/G4/M4RsIkWoZch+oktFLAoPHl9E5D4F
ouPCPChDbp/DF+0R5uSz9oi9FAC7/2a00e+LFl6PDTTyzlksmMILlGBTimpO88Iu
t7w9UKK4hOxXmfpMzRNk80D4Es/5vQho17PYSIgEkzOZzPR//4CVfL+nhF4YqzJa
hyNQVJmv6/ESxp/u+BBiy3ieT7d87uTE4BHGDxkkpcB8Tgos7apO9l1Ez55ATcMg
ZuF7BUMtID4xYmp0kcJBnXeMrj38qMWAV+bxClVMzPZf9v9hqnbmvt46CYmiJj6k
ANFZBxT9eVIBoziu8QWmUxFs9ydhYQwfux//RWnaSWhY8WUso/SPFhTQoZde1WxO
RuQIF/zl82RtFQ0DQzoOIx9DuG/o+rEuqTy+cO4/DynYNmRxbRPm2HEnhOZqgkhW
xnQizUl2f6NayrWXdKxNE4Flo2Iu5wTUQ4RakbuB/kKvHjb8ZP7sSkdwTzIuH1/9
gh08PweF53O3Ta6nJ3NtGw9KxQL7tDxrXKTpYf2AU6ZlQwn1tC0=
=I2f8
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 24 Jul 2018 10:31
Re: [bug#32133] [PATCH] build-system/go: Use invoke instead of system*.
(name . Leo Famulari)(address . leo@famulari.name)(address . 32133@debbugs.gnu.org)
871sbt6nly.fsf@gnu.org
Leo Famulari <leo@famulari.name> skribis:

Toggle quote (4 lines)
> * 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’.
?