summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-10-18 12:45:56 +0200
committerRicardo Wurmus <rekado@elephly.net>2022-12-31 14:48:46 +0100
commit1176fccb83d1e9d4232f2fae2b661a7f29f76060 (patch)
tree0d6300af46cff48f9cd6c902e2a3050ecf4499f9
parent08028c443e7beb84e2a6c80dc8c87007c149b332 (diff)
downloadguix-1176fccb83d1e9d4232f2fae2b661a7f29f76060.tar.gz
import/cran: Allow overriding tarball download.
* guix/import/cran.scm (description->package): Accept new keyword argument
DOWNLOAD-SOURCE.
(cran->guix-package): Ditto.
-rw-r--r--guix/import/cran.scm15
1 files changed, 9 insertions, 6 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 725c3a9b21..b59b7b287f 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -508,7 +508,8 @@ reference the pkg-config tool."
 (define (needs-knitr? meta)
   (member "knitr" (listify meta "VignetteBuilder")))
 
-(define* (description->package repository meta #:key (license-prefix identity))
+(define* (description->package repository meta #:key (license-prefix identity)
+                               (download-source download))
   "Return the `package' s-expression for an R package published on REPOSITORY
 from the alist META, which was derived from the R package's DESCRIPTION file."
   (let* ((base-url   (case repository
@@ -550,10 +551,10 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
                           (_ #f)))))
          (git?       (if (assoc-ref meta 'git) #true #false))
          (hg?        (if (assoc-ref meta 'hg) #true #false))
-         (source     (download source-url #:method (cond
-                                                    (git? 'git)
-                                                    (hg? 'hg)
-                                                    (else #f))))
+         (source     (download-source source-url #:method (cond
+                                                           (git? 'git)
+                                                           (hg? 'hg)
+                                                           (else #f))))
          (sysdepends (append
                       (if (needs-zlib? source (not (or git? hg?))) '("zlib") '())
                       (filter (lambda (name)
@@ -646,13 +647,15 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
   (memoize
    (lambda* (package-name #:key (repo 'cran) version (license-prefix identity)
                           (fetch-description fetch-description)
+                          (download-source download)
                           #:allow-other-keys)
      "Fetch the metadata for PACKAGE-NAME from REPO and return the `package'
 s-expression corresponding to that package, or #f on failure."
      (let ((description (fetch-description repo package-name version)))
        (if description
            (description->package repo description
-                                 #:license-prefix license-prefix)
+                                 #:license-prefix license-prefix
+                                 #:download-source download-source)
            (case repo
              ((git)
               ;; Retry import from Bioconductor