From 5aae614868b8a7e3097ae70f6024352aa5c8de21 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 27 Dec 2020 12:05:24 +0100 Subject: import/utils: alist->package: Handle SPDX license names only as fallback. Fixes . * guix/import/utils.scm (alist->package): Find plain license names in (guix licenses) first, and only fall back to SPDX names on error. * tests/import-utils.scm ("alist->package with SPDX license name 1/2", "alist->package with SPDX license name 2/2"): New tests. --- tests/import-utils.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 2357ea5c40..874816442e 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -122,6 +122,38 @@ (or (package-license (alist->package meta)) 'license-is-false))) +(test-equal "alist->package with SPDX license name 1/2" ; + license:expat + (let* ((meta '(("name" . "hello") + ("version" . "2.10") + ("source" . (("method" . "url-fetch") + ("uri" . "mirror://gnu/hello/hello-2.10.tar.gz") + ("sha256" . + (("base32" . + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))) + ("build-system" . "gnu") + ("home-page" . "https://gnu.org") + ("synopsis" . "Say hi") + ("description" . "This package says hi.") + ("license" . "expat")))) + (package-license (alist->package meta)))) + +(test-equal "alist->package with SPDX license name 2/2" ; + license:expat + (let* ((meta '(("name" . "hello") + ("version" . "2.10") + ("source" . (("method" . "url-fetch") + ("uri" . "mirror://gnu/hello/hello-2.10.tar.gz") + ("sha256" . + (("base32" . + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))) + ("build-system" . "gnu") + ("home-page" . "https://gnu.org") + ("synopsis" . "Say hi") + ("description" . "This package says hi.") + ("license" . "MIT")))) + (package-license (alist->package meta)))) + (test-equal "alist->package with dependencies" `(("gettext" ,(specification->package "gettext"))) (let* ((meta '(("name" . "hello") -- cgit v1.2.1