summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-07 09:50:26 +0200
committerLudovic Courtès <ludo@gnu.org>2021-10-07 10:47:44 +0200
commit1327ec822fa6dd396e979efd8d4e1f7479f1d5b3 (patch)
tree7678464be3ff95fcad16e57bb1b93f038d263f3a
parentcd52869134be2433ac25e3ca19846d7b96de904e (diff)
downloadguix-1327ec822fa6dd396e979efd8d4e1f7479f1d5b3.tar.gz
import: crate: Gracefully handle missing license info.
Fixes <https://issues.guix.gnu.org/51048>.
Reported by Michael Zappa <me@michzappa.com>.

* guix/import/crate.scm (<crate-version>)[license]: Translate 'null to #f.
(make-crate-sexp): Handle LICENSE = #f.
-rw-r--r--guix/import/crate.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 287ffd2536..c76d7e9c1a 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 David Craven <david@craven.ch>
-;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
 ;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;;
@@ -79,7 +79,10 @@
   (number        crate-version-number "num")      ;string
   (download-path crate-version-download-path "dl_path") ;string
   (readme-path   crate-version-readme-path "readme_path") ;string
-  (license       crate-version-license "license") ;string
+  (license       crate-version-license "license"  ;string | #f
+                 (match-lambda
+                   ('null #f)
+                   ((? string? str) str)))
   (links         crate-version-links))            ;alist
 
 ;; Crate dependency.  Each dependency (each edge in the graph) is annotated as
@@ -198,6 +201,7 @@ and LICENSE."
                    (description ,(beautify-description description))
                    (license ,(match license
                                (() #f)
+                               (#f #f)
                                ((license) license)
                                (_ `(list ,@license)))))))
          (close-port port)