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. --- guix/import/utils.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/import/utils.scm b/guix/import/utils.scm index e227c2e42d..cdbcf6bfa5 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -372,8 +372,12 @@ specifications to look up and replace them with plain symbols instead." (match (assoc-ref meta "license") (#f #f) (l - (or (module-ref (resolve-interface '(guix licenses) #:prefix 'license:) - (spdx-string->license l)) + (or (false-if-exception + (module-ref (resolve-interface '(guix licenses)) + (string->symbol l))) + (false-if-exception + (module-ref (resolve-interface '(guix licenses) #:prefix 'license:) + (spdx-string->license l))) (license:fsdg-compatible l))))))) (define* (read-lines #:optional (port (current-input-port))) -- cgit v1.2.3