guix-commits
[Top][All Lists]
Advanced

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

02/89: import: cran: Add support for Bioconductor 3.6.


From: Ricardo Wurmus
Subject: 02/89: import: cran: Add support for Bioconductor 3.6.
Date: Tue, 7 Nov 2017 02:44:46 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit 84dfdc5759a780cea25c6fd4c7cb0f33ba20bd8b
Author: Ricardo Wurmus <address@hidden>
Date:   Mon Nov 6 17:09:06 2017 +0100

    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.
---
 guix/import/cran.scm | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 9b08ebf..bcfc0d9 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



reply via email to

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