import: cpan: Adapt for the change to guile-json version 3.

In guile-json version 3, JSON objects are represented as hash tables, rather
than alists.

* guix/import/cpan.scm (string->license): Change the match expression to match
on lists, rather than vectors.
(module->dist-name, cpan-source-url, cpan-version): Change assoc-ref to
hash-ref.
(cpan-module->sexp): Change assoc-ref to hash-ref, and assoc-ref* to
hash-ref*.
* tests/cpan.scm ("source-url-http", "source-url-https"): Convert the alist to
a hash table.
This commit is contained in:
Christopher Baines 2019-08-06 20:17:28 +01:00
parent 8a3b11d1eb
commit 01ce7af25a
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577
2 changed files with 24 additions and 19 deletions

View file

@ -24,7 +24,8 @@
#:use-module (guix tests)
#:use-module (guix grafts)
#:use-module (srfi srfi-64)
#:use-module (ice-9 match))
#:use-module (ice-9 match)
#:use-module (ice-9 hash-table))
;; Globally disable grafts because they can trigger early builds.
(%graft? #f)
@ -109,14 +110,16 @@
(test-equal "source-url-http"
((@@ (guix import cpan) cpan-source-url)
`(("download_url" .
"http://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")))
(alist->hash-table
`(("download_url" .
"http://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"))))
"mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
(test-equal "source-url-https"
((@@ (guix import cpan) cpan-source-url)
`(("download_url" .
"https://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")))
(alist->hash-table
`(("download_url" .
"https://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"))))
"mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
(test-end "cpan")