summaryrefslogtreecommitdiff
path: root/guix/import/cpan.scm
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2018-06-10 20:35:39 +0200
committerJelle Licht <jlicht@fsfe.org>2018-06-10 22:15:12 +0200
commit3edf0d53a4043c30f3ff87b3b4b7b47d1bac1397 (patch)
tree6b5d908ff681825c989f57b4eb69eecb2942bf0d /guix/import/cpan.scm
parent670a5e543033022a66d930d62a7dbff510f095db (diff)
downloadguix-patches-3edf0d53a4043c30f3ff87b3b4b7b47d1bac1397.tar
guix-patches-3edf0d53a4043c30f3ff87b3b4b7b47d1bac1397.tar.gz
import: json: Consolidate duplicate json-fetch functionality.
* guix/import/json.scm (json-fetch): Return a list or hash table. (json-fetch-alist): New procedure. * guix/import/github.scm (json-fetch*): Remove. (latest-released-version): Use json-fetch. * guix/import/cpan.scm (module->dist-name): Use json-fetch-alist. (cpan-fetch): Likewise. * guix/import/crate.scm (crate-fetch): Likewise. * guix/import/gem.scm (rubygems-fetch): Likewise. * guix/import/pypi.scm (pypi-fetch): Likewise. * guix/import/stackage.scm (stackage-lts-info-fetch): Likewise.
Diffstat (limited to 'guix/import/cpan.scm')
-rw-r--r--guix/import/cpan.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 58c051e283..08bed8767c 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -88,9 +88,10 @@
"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://fastapi.metacpan.org/v1/module/"
- module
- "?fields=distribution"))
+ (assoc-ref (json-fetch-alist (string-append
+ "https://fastapi.metacpan.org/v1/module/"
+ module
+ "?fields=distribution"))
"distribution"))
(define (package->upstream-name package)
@@ -113,7 +114,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://fastapi.metacpan.org/v1/release/" name)))
+ (json-fetch-alist (string-append "https://fastapi.metacpan.org/v1/release/" name)))
(define (cpan-home name)
(string-append "http://search.cpan.org/dist/" name "/"))