summaryrefslogtreecommitdiff
path: root/guix/import/cran.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-04-05 15:37:03 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-05-16 21:39:06 +0200
commit7c9fcb0825d95d9790da3e77d247353ced9a8948 (patch)
tree9d0fc2ff142f17ed81df946a42d63f43d7ae398f /guix/import/cran.scm
parentca05bc0e1eb39c75444a054dfba8533c4bd05d33 (diff)
downloadgnu-guix-7c9fcb0825d95d9790da3e77d247353ced9a8948.tar
gnu-guix-7c9fcb0825d95d9790da3e77d247353ced9a8948.tar.gz
import cran: Fetch DESCRIPTION files from Github mirror.
* guix/import/cran.scm (%bioconductor-svn-url): Remove variable. (bioconductor-mirror-url): New procedure. (fetch-description): Take a REPOSITORY symbol instead of a BASE-URL string. (cran->guix-package): Pass REPOSITORY symbol to "fetch-description". (latest-cran-release, latest-bioconductor-release): Adjust accordingly. (bioconductor-package?): Update comment about SVN.
Diffstat (limited to 'guix/import/cran.scm')
-rw-r--r--guix/import/cran.scm34
1 files changed, 18 insertions, 16 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index a94051655c..221b5420e2 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -125,17 +125,19 @@ package definition."
;; The latest Bioconductor release is 3.5. Bioconductor packages should be
;; updated together.
-(define %bioconductor-svn-url
- (string-append "https://readonly:readonly@"
- "hedgehog.fhcrc.org/bioconductor/branches/RELEASE_3_5/"
- "madman/Rpacks/"))
+(define (bioconductor-mirror-url name)
+ (string-append "https://raw.githubusercontent.com/Bioconductor-mirror/"
+ name "/release-3.5"))
-
-(define (fetch-description base-url name)
+(define (fetch-description repository name)
"Return an alist of the contents of the DESCRIPTION file for the R package
-NAME, or #f in case of failure. NAME is case-sensitive."
+NAME in the given REPOSITORY, or #f in case of failure. NAME is
+case-sensitive."
;; This API always returns the latest release of the module.
- (let ((url (string-append base-url name "/DESCRIPTION")))
+ (let ((url (string-append (case repository
+ ((cran) (string-append %cran-url name))
+ ((bioconductor) (bioconductor-mirror-url name)))
+ "/DESCRIPTION")))
(guard (c ((http-get-error? c)
(format (current-error-port)
"error: failed to retrieve package information \
@@ -291,11 +293,8 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
(lambda* (package-name #:optional (repo 'cran))
"Fetch the metadata for PACKAGE-NAME from REPO and return the `package'
s-expression corresponding to that package, or #f on failure."
- (let* ((url (case repo
- ((cran) %cran-url)
- ((bioconductor) %bioconductor-svn-url)))
- (module-meta (fetch-description url package-name)))
- (and=> module-meta (cut description->package repo <>))))))
+ (and=> (fetch-description repo package-name)
+ (cut description->package repo <>)))))
(define* (recursive-import package-name #:optional (repo 'cran))
"Generate a stream of package expressions for PACKAGE-NAME and all its
@@ -386,7 +385,7 @@ dependencies."
(package->upstream-name package))
(define meta
- (fetch-description %cran-url upstream-name))
+ (fetch-description 'cran upstream-name))
(and meta
(let ((version (assoc-ref meta "Version")))
@@ -403,7 +402,7 @@ dependencies."
(package->upstream-name package))
(define meta
- (fetch-description %bioconductor-svn-url upstream-name))
+ (fetch-description 'bioconductor upstream-name))
(and meta
(let ((version (assoc-ref meta "Version")))
@@ -430,7 +429,10 @@ dependencies."
"Return true if PACKAGE is an R package from Bioconductor."
(let ((predicate (lambda (uri)
(and (string-prefix? "http://bioconductor.org" uri)
- ;; Data packages are not listed in SVN
+ ;; Data packages are neither listed in SVN nor on
+ ;; the Github mirror, so we have to exclude them
+ ;; from the set of bioconductor packages that can be
+ ;; updated automatically.
(not (string-contains uri "/data/annotation/"))))))
(and (string-prefix? "r-" (package-name package))
(match (and=> (package-source package) origin-uri)