mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-23 19:19:20 -05:00
import: cran: Try import via CRAN if package is not on Bioconductor.
* guix/import/cran.scm (fetch-description): Return #F on failure. (cran->guix-package): Retry from CRAN on failure to fetch description from bioconductor.
This commit is contained in:
parent
0290f533cc
commit
10a1cacb16
1 changed files with 11 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
|
@ -23,6 +23,7 @@ (define-module (guix import cran)
|
||||||
#:use-module (ice-9 regex)
|
#:use-module (ice-9 regex)
|
||||||
#:use-module ((ice-9 rdelim) #:select (read-string read-line))
|
#:use-module ((ice-9 rdelim) #:select (read-string read-line))
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
#:use-module (srfi srfi-2)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (ice-9 receive)
|
#:use-module (ice-9 receive)
|
||||||
|
@ -180,9 +181,9 @@ (define (fetch-description repository name)
|
||||||
;; Currently, the bioconductor project does not offer a way to access a
|
;; Currently, the bioconductor project does not offer a way to access a
|
||||||
;; package's DESCRIPTION file over HTTP, so we determine the version,
|
;; package's DESCRIPTION file over HTTP, so we determine the version,
|
||||||
;; download the source tarball, and then extract the DESCRIPTION file.
|
;; download the source tarball, and then extract the DESCRIPTION file.
|
||||||
(let* ((version (latest-bioconductor-package-version name))
|
(and-let* ((version (latest-bioconductor-package-version name))
|
||||||
(url (car (bioconductor-uri name version)))
|
(url (car (bioconductor-uri name version)))
|
||||||
(tarball (with-store store (download-to-store store url))))
|
(tarball (with-store store (download-to-store store url))))
|
||||||
(call-with-temporary-directory
|
(call-with-temporary-directory
|
||||||
(lambda (dir)
|
(lambda (dir)
|
||||||
(parameterize ((current-error-port (%make-void-port "rw+"))
|
(parameterize ((current-error-port (%make-void-port "rw+"))
|
||||||
|
@ -346,8 +347,12 @@ (define cran->guix-package
|
||||||
(lambda* (package-name #:optional (repo 'cran))
|
(lambda* (package-name #:optional (repo 'cran))
|
||||||
"Fetch the metadata for PACKAGE-NAME from REPO and return the `package'
|
"Fetch the metadata for PACKAGE-NAME from REPO and return the `package'
|
||||||
s-expression corresponding to that package, or #f on failure."
|
s-expression corresponding to that package, or #f on failure."
|
||||||
(and=> (fetch-description repo package-name)
|
(let ((description (fetch-description repo package-name)))
|
||||||
(cut description->package repo <>)))))
|
(if (and (not description)
|
||||||
|
(eq? repo 'bioconductor))
|
||||||
|
;; Retry import from CRAN
|
||||||
|
(cran->guix-package package-name 'cran)
|
||||||
|
(description->package repo description))))))
|
||||||
|
|
||||||
(define* (cran-recursive-import package-name #:optional (repo 'gnu))
|
(define* (cran-recursive-import package-name #:optional (repo 'gnu))
|
||||||
(recursive-import package-name repo
|
(recursive-import package-name repo
|
||||||
|
|
Loading…
Reference in a new issue