unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t.
@ 2022-04-13 12:00 Attila Lendvai
  2022-04-14 10:38 ` Ricardo Wurmus
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Attila Lendvai @ 2022-04-13 12:00 UTC (permalink / raw)
  To: 54906; +Cc: Attila Lendvai

This mimics the same feature of the cargo-build-system.

* guix/build-system/go.scm (go-build): Add skip-build? keyword param and
propagate it.
* guix/build/go-build-system.scm (build): Add skip-build? keyword param.
---
 guix/build-system/go.scm       |  4 +++-
 guix/build/go-build-system.scm | 31 ++++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 5e0e5bbad3..6bcb3656be 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -175,6 +175,7 @@ (define* (go-build name inputs
                    (import-path "")
                    (unpack-path "")
                    (build-flags ''())
+                   (skip-build? #f)
                    (tests? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
@@ -205,7 +206,8 @@ (define builder
                     #:import-path #$import-path
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
-                    #:tests? #$tests?
+                    #:skip-build? #$skip-build?
+                    #:tests? #$(and tests? (not skip-build?))
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 7f25e05d0d..637d66a6f1 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -254,22 +254,23 @@ (define (go-inputs inputs)
                 (_ #f))
               inputs))))
 
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key skip-build? import-path build-flags #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
-  (with-throw-handler
-    #t
-    (lambda _
-      (apply 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"
-              `(,@build-flags ,import-path)))
-    (lambda (key . args)
-      (display (string-append "Building '" import-path "' failed.\n"
-                              "Here are the results of `go env`:\n"))
-      (invoke "go" "env"))))
+  (or skip-build?
+      (with-throw-handler
+        #t
+        (lambda _
+          (apply 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"
+                 `(,@build-flags ,import-path)))
+        (lambda (key . args)
+          (display (string-append "Building '" import-path "' failed.\n"
+                                  "Here are the results of `go env`:\n"))
+          (invoke "go" "env")))))
 
 ;; Can this also install commands???
 (define* (check #:key tests? import-path #:allow-other-keys)
-- 
2.35.1





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

end of thread, other threads:[~2022-06-13  1:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 12:00 [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t Attila Lendvai
2022-04-14 10:38 ` Ricardo Wurmus
2022-04-27 16:33 ` [bug#54906] ping Attila Lendvai
2022-04-27 17:42 ` [bug#54906] [PATCH] build: go-build-system: Add support for #:skip-build? #t Katherine Cox-Buday
2022-04-27 19:22 ` Maxime Devos
2022-04-28 10:56   ` Attila Lendvai
2022-04-28 11:35     ` Maxime Devos
2022-04-28 12:14       ` Attila Lendvai
2022-06-13  1:53         ` Maxime Devos

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