guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: download: Keep a single copy of the mirror file.


From: Ludovic Courtès
Subject: 03/03: download: Keep a single copy of the mirror file.
Date: Sat, 29 Aug 2015 21:57:08 +0000

civodul pushed a commit to branch master
in repository guix.

commit 532164194a96bb3a0e957bf2fe5e7487cf53488d
Author: Ludovic Courtès <address@hidden>
Date:   Sat Aug 29 23:47:53 2015 +0200

    download: Keep a single copy of the mirror file.
    
    This saves ~10% on 'guix build inkscape -Sd'.
    
    * guix/download.scm (%mirror-file): New variable.
      (url-fetch): Remove #:mirrors parameter.
      Remove 'mirror-file'; refer to '%mirror-file' instead.
---
 guix/download.scm |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/guix/download.scm b/guix/download.scm
index 6e91607..079d1b0 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -202,6 +202,12 @@
        "http://ftp.fr.debian.org/debian/";
        "http://ftp.debian.org/debian/";))))
 
+(define %mirror-file
+  ;; Copy of the list of mirrors to a file.  This allows us to keep a single
+  ;; copy in the store, and computing it here avoids repeated calls to
+  ;; 'object->string'.
+  (plain-file "mirrors" (object->string %mirrors)))
+
 (define (gnutls-package)
   "Return the default GnuTLS package."
   (let ((module (resolve-interface '(gnu packages tls))))
@@ -210,16 +216,14 @@
 (define* (url-fetch url hash-algo hash
                     #:optional name
                     #:key (system (%current-system))
-                    (guile (default-guile))
-                    (mirrors %mirrors))
+                    (guile (default-guile)))
   "Return a fixed-output derivation that fetches URL (a string, or a list of
 strings denoting alternate URLs), which is expected to have hash HASH of type
 HASH-ALGO (a symbol).  By default, the file name is the base name of URL;
 optionally, NAME can specify a different file name.
 
 When one of the URL starts with mirror://, then its host part is
-interpreted as the name of a mirror scheme, taken from MIRRORS; MIRRORS
-must be a list of symbol/URL-list pairs.
+interpreted as the name of a mirror scheme, taken from %MIRROR-FILE.
 
 Alternately, when URL starts with file://, return the corresponding file name
 in the store."
@@ -239,10 +243,6 @@ 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?
@@ -261,7 +261,7 @@ in the store."
         (url-fetch (call-with-input-string (getenv "guix download url")
                      read)
                    #$output
-                   #:mirrors (call-with-input-file #$mirror-file read))))
+                   #:mirrors (call-with-input-file #$%mirror-file read))))
 
   (let ((uri (and (string? url) (string->uri url))))
     (if (or (and (string? url) (not uri))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]