From c24fe4a52057ea3390faf59fd672a617eff34aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 5 Feb 2020 16:03:43 +0100 Subject: import: gem: Deal with unavailable licensing info. Fixes . Reported by Seth . * guix/import/gem.scm ()[licenses]: Adjust for non-vector licenses. * tests/gem.scm (test-bar-json): Change "licenses" to 'null'. ("gem-recursive-import"): Adjust accordingly. --- guix/import/gem.scm | 7 ++++++- tests/gem.scm | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/guix/import/gem.scm b/guix/import/gem.scm index f4589b98b3..bd5d5b3569 100644 --- a/guix/import/gem.scm +++ b/guix/import/gem.scm @@ -44,7 +44,12 @@ (version gem-version) ;string (authors gem-authors) ;string (licenses gem-licenses "licenses" ;list of strings - vector->list) + (lambda (licenses) + ;; This is sometimes #nil (the JSON 'null' value). Arrange + ;; to always return a list. + (cond ((not licenses) '()) + ((vector? licenses) (vector->list licenses)) + (else '())))) (info gem-info) (sha256 gem-sha256 "sha" ;bytevector base16-string->bytevector) diff --git a/tests/gem.scm b/tests/gem.scm index 5158238d18..455fc15189 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -55,7 +55,7 @@ { \"name\": \"bundler\" }, ] }, - \"licenses\": [\"MIT\", \"Apache 2.0\"] + \"licenses\": null }") (define test-bundler-json @@ -138,7 +138,7 @@ ('synopsis "Another cool gem") ('description "Another cool gem") ('home-page "https://example.com") - ('license ('list 'license:expat 'license:asl2.0))) + ('license #f)) ;no licensing info ('package ('name "ruby-bundler") ('version "1.14.2") -- cgit v1.2.3