[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: import: cpan: Update CPAN importer to use MetaCPAN v1 API.
From: |
Ludovic Courtès |
Subject: |
01/01: import: cpan: Update CPAN importer to use MetaCPAN v1 API. |
Date: |
Wed, 7 Jun 2017 09:08:39 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 4679dd6967c21e21c740cd88e17191b8e2aac5ee
Author: James Richardson <address@hidden>
Date: Sat Jun 3 14:37:54 2017 -0400
import: cpan: Update CPAN importer to use MetaCPAN v1 API.
* guix/import/cpan.scm (module->dist-name, cpan-fetch): Use metacpan.org
URLs.
* tests/cpan.scm ("cpan->guix-package"): Adjust accordingly.
Signed-off-by: Ludovic Courtès <address@hidden>
---
guix/import/cpan.scm | 4 ++--
tests/cpan.scm | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 32c5c31..a41f918 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -88,7 +88,7 @@
"Return the base distribution module for a given module. E.g. the 'ok'
module is distributed with 'Test::Simple', so (module->dist-name \"ok\") would
return \"Test-Simple\""
- (assoc-ref (json-fetch (string-append "https://api.metacpan.org/module/"
+ (assoc-ref (json-fetch (string-append
"https://fastapi.metacpan.org/v1/module/"
module
"?fields=distribution"))
"distribution"))
@@ -113,7 +113,7 @@ return \"Test-Simple\""
"Return an alist representation of the CPAN metadata for the perl module
MODULE,
or #f on failure. MODULE should be e.g. \"Test::Script\""
;; This API always returns the latest release of the module.
- (json-fetch (string-append "https://api.metacpan.org/release/" name)))
+ (json-fetch (string-append "https://fastapi.metacpan.org/v1/release/" name)))
(define (cpan-home name)
(string-append "http://search.cpan.org/dist/" name))
diff --git a/tests/cpan.scm b/tests/cpan.scm
index 8b58851..de865b2 100644
--- a/tests/cpan.scm
+++ b/tests/cpan.scm
@@ -74,10 +74,10 @@
(mock ((guix http-client) http-fetch
(lambda (url . rest)
(match url
- ("https://api.metacpan.org/release/Foo-Bar"
+ ("https://fastapi.metacpan.org/v1/release/Foo-Bar"
(values (open-input-string test-json)
(string-length test-json)))
-
("https://api.metacpan.org/module/Test::Script?fields=distribution"
+
("https://fastapi.metacpan.org/v1/module/Test::Script?fields=distribution"
(let ((result "{ \"distribution\" : \"Test-Script\" }"))
(values (open-input-string result)
(string-length result))))