diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2017-11-06 17:09:06 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2017-11-07 08:13:34 +0100 |
commit | 84dfdc5759a780cea25c6fd4c7cb0f33ba20bd8b (patch) | |
tree | a99dced32ba96711aab2405ef8a4d4439ac6e1d4 /guix | |
parent | 6b46b04f919881e0122e201db4590ba5da77aa88 (diff) | |
download | gnu-guix-84dfdc5759a780cea25c6fd4c7cb0f33ba20bd8b.tar gnu-guix-84dfdc5759a780cea25c6fd4c7cb0f33ba20bd8b.tar.gz |
import: cran: Add support for Bioconductor 3.6.
* guix/import/cran.scm (%bioconductor-version,
%bioconductor-packages-list-url): New variables.
(bioconductor-packages-list, latest-bioconductor-package-version): New
procedures.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/import/cran.scm | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 9b08ebfb63..bcfc0d9355 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -128,11 +128,41 @@ package definition." (define %cran-url "http://cran.r-project.org/web/packages/") (define %bioconductor-url "https://bioconductor.org/packages/") -;; The latest Bioconductor release is 3.5. Bioconductor packages should be +;; The latest Bioconductor release is 3.6. Bioconductor packages should be ;; updated together. (define (bioconductor-mirror-url name) (string-append "https://raw.githubusercontent.com/Bioconductor-mirror/" name "/release-3.5")) +(define %bioconductor-version "3.6") + +(define %bioconductor-packages-list-url + (string-append "https://bioconductor.org/packages/" + %bioconductor-version "/bioc/src/contrib/PACKAGES")) + +(define (bioconductor-packages-list) + "Return the latest version of package NAME for the current bioconductor +release." + (let ((url (string->uri %bioconductor-packages-list-url))) + (guard (c ((http-get-error? c) + (format (current-error-port) + "error: failed to retrieve list of packages from ~s: ~a (~s)~%" + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c)) + #f)) + ;; Split the big list on empty lines, then turn each chunk into an + ;; alist of attributes. + (map (lambda (chunk) + (description->alist (string-join chunk "\n"))) + (chunk-lines (read-lines (http-fetch/cached url))))))) + +(define (latest-bioconductor-package-version name) + "Return the version string corresponding to the latest release of the +bioconductor package NAME, or #F if the package is unknown." + (and=> (find (lambda (meta) + (string=? (assoc-ref meta "Package") name)) + (bioconductor-packages-list)) + (cut assoc-ref <> "Version"))) (define (fetch-description repository name) "Return an alist of the contents of the DESCRIPTION file for the R package |