mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-08 07:56:16 -05:00
import: cran: Download tarballs only once.
* guix/import/cran.scm (download): New procedure. (fetch-description, description->package): Use it.
This commit is contained in:
parent
707efe171a
commit
b3d0617a55
1 changed files with 8 additions and 2 deletions
|
@ -161,6 +161,12 @@ (define (latest-bioconductor-package-version name)
|
|||
(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 @@ (define (fetch-description repository name)
|
|||
;; 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 @@ (define (description->package repository meta)
|
|||
((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"))))
|
||||
|
|
Loading…
Reference in a new issue