summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-10-28 16:37:35 +0100
committerLudovic Courtès <ludo@gnu.org>2020-10-31 23:16:42 +0100
commit139c4ac1994866250f76f45207e03ca080bad594 (patch)
treed8408ef57756f0cb555a124ff6aab0aa56c0f04e
parent48dec2e04efdc764e16828fb7837ca58064f3cbe (diff)
downloadguix-139c4ac1994866250f76f45207e03ca080bad594.tar.gz
guix build: 'package-with-source' no longer takes a 'store' parameter.
* guix/scripts/build.scm (<downloaded-file>): New record type.
(download-to-store*): New variable.
(compile-downloaded-file): New procedure.
(package-with-source): Remove 'store' parameter.  Use 'downloaded-file'
instead of 'download-to-store'.
(transform-package-source): Adjust accordingly.
-rw-r--r--guix/scripts/build.scm26
1 files changed, 22 insertions, 4 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index f4a8af035b..831ac8f798 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -45,6 +45,7 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
@@ -172,7 +173,25 @@ extensions."
         (else
          file-name)))
 
-(define* (package-with-source store p uri #:optional version)
+
+;; Files to be downloaded.
+(define-record-type <downloaded-file>
+  (downloaded-file uri recursive?)
+  downloaded-file?
+  (uri        downloaded-file-uri)
+  (recursive? downloaded-file-recursive?))
+
+(define download-to-store*
+  (store-lift download-to-store))
+
+(define-gexp-compiler (compile-downloaded-file (file <downloaded-file>)
+                                               system target)
+  "Download FILE and return the result as a store item."
+  (match file
+    (($ <downloaded-file> uri recursive?)
+     (download-to-store* uri #:recursive? recursive?))))
+
+(define* (package-with-source p uri #:optional version)
   "Return a package based on P but with its source taken from URI.  Extract
 the new package's version number from URI."
   (let ((base (tarball-base-name (basename uri))))
@@ -183,8 +202,7 @@ the new package's version number from URI."
                             (package-version p)))
 
                ;; Use #:recursive? #t to allow for directories.
-               (source (download-to-store store uri
-                                          #:recursive? #t))
+               (source (downloaded-file uri #t))
 
                ;; Override the replacement, otherwise '--with-source' would
                ;; have no effect.
@@ -226,7 +244,7 @@ matching URIs given in SOURCES."
         ((? package? p)
          (match (assoc-ref sources (package-name p))
            ((version source)
-            (package-with-source store p source version))
+            (package-with-source p source version))
            (#f
             p)))
         (_