summaryrefslogtreecommitdiff
path: root/guix/import/cpan.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/import/cpan.scm')
-rw-r--r--guix/import/cpan.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 4320f94c98..7a97c7f8e8 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -61,7 +61,9 @@
cpan-fetch
cpan->guix-package
metacpan-url->mirror-url
- %cpan-updater))
+ %cpan-updater
+
+ %metacpan-base-url))
;;; Commentary:
;;;
@@ -70,6 +72,10 @@
;;;
;;; Code:
+(define %metacpan-base-url
+ ;; Base URL of the MetaCPAN API.
+ (make-parameter "https://fastapi.metacpan.org/v1/"))
+
;; Dependency of a "release".
(define-json-mapping <cpan-dependency> make-cpan-dependency cpan-dependency?
json->cpan-dependency
@@ -149,7 +155,7 @@
module is distributed with 'Test::Simple', so (module->dist-name \"ok\") would
return \"Test-Simple\""
(assoc-ref (json-fetch (string-append
- "https://fastapi.metacpan.org/v1/module/"
+ (%metacpan-base-url) "/module/"
module
"?fields=distribution"))
"distribution"))
@@ -176,7 +182,7 @@ or #f on failure. MODULE should be the distribution name, such as
\"Test-Script\" for the \"Test::Script\" module."
;; This API always returns the latest release of the module.
(json->cpan-release
- (json-fetch (string-append "https://fastapi.metacpan.org/v1/release/"
+ (json-fetch (string-append (%metacpan-base-url) "/release/"
name))))
(define (cpan-home name)