summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-28 20:53:00 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-30 22:48:44 +0200
commit4f5f1d98efe4343cd301d684094a00b82e069f1d (patch)
tree384e90ae86cbff15fd593cb3c9c32ee201c38c96
parent9e5812ac59b01ff011ec0c5b0f437dfe85d6fcc7 (diff)
downloadguix-4f5f1d98efe4343cd301d684094a00b82e069f1d.tar.gz
packages: Default origin 'patch-flags' is a gexp.
Using a gexp instead of a list means that 'gexp->sexp' & co. do not need
to scan that list for file-like objects.

* guix/packages.scm (<origin>)[patch-flags]: Default to
%DEFAULT-PATCH-FLAGS.
(%default-patch-flags): New variable.
(patch-and-repack): #:flags defaults to %DEFAULT-PATCH-FLAGS.
(origin->derivation): Don't expect FLAGS to be a list.
-rw-r--r--guix/packages.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index 36e55c0a42..cbe8004888 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -276,8 +276,8 @@ as base32.  Otherwise, it must be a bytevector."
              (default '()) (delayed))
 
   (snippet   origin-snippet (default #f))         ; sexp or #f
-  (patch-flags  origin-patch-flags                ; list of strings
-                (default '("-p1")))
+  (patch-flags  origin-patch-flags                ; string-list gexp
+                (default %default-patch-flags))
 
   ;; Patching requires Guile, GNU Patch, and a few more.  These two fields are
   ;; used to specify these dependencies when needed.
@@ -325,6 +325,9 @@ specifications to 'hash'."
 
 (set-record-type-printer! <origin> print-origin)
 
+(define %default-patch-flags
+  #~("-p1"))
+
 (define (origin-actual-file-name origin)
   "Return the file name of ORIGIN, either its 'file-name' field or the file
 name of its URI."
@@ -594,7 +597,7 @@ the build code of derivation."
                            #:key
                            inputs
                            (snippet #f)
-                           (flags '("-p1"))
+                           (flags %default-patch-flags)
                            (modules '())
                            (guile-for-build (%guile-for-build))
                            (system (%current-system)))
@@ -1622,7 +1625,7 @@ unless you know what you are doing."
              (content-hash-value hash)
              name #:system system))
     (($ <origin> uri method hash name (= force (patches ...)) snippet
-        (flags ...) inputs (modules ...) guile-for-build)
+                 flags inputs (modules ...) guile-for-build)
      ;; Patches and/or a snippet.
      (mlet %store-monad ((source (method uri
                                          (content-hash-algorithm hash)