guix-commits
[Top][All Lists]
Advanced

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

01/04: import: cran: Download tarballs only once.


From: guix-commits
Subject: 01/04: import: cran: Download tarballs only once.
Date: Thu, 3 Jan 2019 02:34:57 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit b3d0617a55c62fe75af44707a3cd4138fa97e62d
Author: Ricardo Wurmus <address@hidden>
Date:   Thu Jan 3 08:31:15 2019 +0100

    import: cran: Download tarballs only once.
    
    * guix/import/cran.scm (download): New procedure.
    (fetch-description, description->package): Use it.
---
 guix/import/cran.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index aaa1caf..507e77e 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -161,6 +161,12 @@ bioconductor package NAME, or #F if the package is 
unknown."
                (bioconductor-packages-list))
          (cut assoc-ref <> "Version")))
 
+;; Little helper to download URLs only once.
+(define download
+  (memoize
+   (lambda (url)
+     (with-store store (download-to-store store url)))))
+
 (define (fetch-description repository name)
   "Return an alist of the contents of the DESCRIPTION file for the R package
 NAME in the given REPOSITORY, or #f in case of failure.  NAME is
@@ -183,7 +189,7 @@ from ~s: ~a (~s)~%"
      ;; download the source tarball, and then extract the DESCRIPTION file.
      (and-let* ((version (latest-bioconductor-package-version name))
                 (url     (car (bioconductor-uri name version)))
-                (tarball (with-store store (download-to-store store url))))
+                (tarball (download url)))
        (call-with-temporary-directory
         (lambda (dir)
           (parameterize ((current-error-port (%make-void-port "rw+"))
@@ -299,7 +305,7 @@ from the alist META, which was derived from the R package's 
DESCRIPTION file."
                        ((url rest ...) url)
                        ((? string? url) url)
                        (_ #f)))
-         (tarball    (with-store store (download-to-store store source-url)))
+         (tarball    (download source-url))
          (sysdepends (append
                       (if (needs-zlib? tarball) '("zlib") '())
                       (map string-downcase (listify meta 
"SystemRequirements"))))



reply via email to

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