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