summaryrefslogtreecommitdiff
path: root/guix/download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-08-29 00:48:35 +0200
committerLudovic Courtès <ludo@gnu.org>2015-08-29 01:22:54 +0200
commitced200328ca6337ac446e4557c645629e7d7a997 (patch)
tree86338f3e4132c6724e1ea7a6c4b258309a81a074 /guix/download.scm
parent0309e1b0ba9764746fc99c6ee02917c585ea8579 (diff)
downloadgnu-guix-ced200328ca6337ac446e4557c645629e7d7a997.tar
gnu-guix-ced200328ca6337ac446e4557c645629e7d7a997.tar.gz
download: Keep only 2 store items for all the downloads.
This significantly reduces churn in the store. It also reduces run time of 'guix build inkscape -Sd' by ~10%. * guix/download.scm (url-fetch)[mirror-file]: New variable. [builder]: Get URL from the "guix download url" env. var. Get the mirrors from MIRROR-FILE. Pass #:script-name and #:env-vars to 'gexp->derivation'.
Diffstat (limited to 'guix/download.scm')
-rw-r--r--guix/download.scm18
1 files changed, 16 insertions, 2 deletions
diff --git a/guix/download.scm b/guix/download.scm
index f0a7a2928e..6e91607196 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -239,6 +239,10 @@ in the store."
((url ...)
(any https? url)))))
+ (define mirror-file
+ ;; Copy the list of mirrors to a file to keep a single copy in the store.
+ (plain-file "mirrors" (object->string mirrors)))
+
(define builder
#~(begin
#+(if need-gnutls?
@@ -253,8 +257,11 @@ in the store."
#~#t)
(use-modules (guix build download))
- (url-fetch '#$url #$output
- #:mirrors '#$mirrors)))
+
+ (url-fetch (call-with-input-string (getenv "guix download url")
+ read)
+ #$output
+ #:mirrors (call-with-input-file #$mirror-file read))))
(let ((uri (and (string? url) (string->uri url))))
(if (or (and (string? url) (not uri))
@@ -271,6 +278,13 @@ in the store."
(guix build utils)
(guix ftp-client))
+ ;; Use environment variables and a fixed script
+ ;; name so there's only one script in store for
+ ;; all the downloads.
+ #:script-name "download"
+ #:env-vars
+ `(("guix download url" . ,(object->string url)))
+
;; Honor the user's proxy settings.
#:leaked-env-vars '("http_proxy" "https_proxy")