summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-27 22:17:53 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-27 23:29:40 +0200
commit5fbc753ab524809cd81e3e5c54b3d0acbe33792d (patch)
treedbdce991ec34e83b31e477155154cc994c26b0f1
parent5dfe02c60767a633c67f7f6fc9557b54b3c99b63 (diff)
downloadguix-5fbc753ab524809cd81e3e5c54b3d0acbe33792d.tar.gz
import: crate: Gracefully handle non-existent crates.
Fixes <https://bugs.gnu.org/40891>.
Reported by Hartmut Goebel <h.goebel@crazy-compilers.com>.

* guix/import/crate.scm (crate->guix-package): Wrap value of
'version-number' and 'version*' in (and crate ...).
-rw-r--r--guix/import/crate.scm14
1 files changed, 8 insertions, 6 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 0b4482e876..e3ec11d7f8 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -201,14 +201,16 @@ latest version of CRATE-NAME."
     (lookup-crate crate-name))
 
   (define version-number
-    (or version
-        (crate-latest-version crate)))
+    (and crate
+         (or version
+             (crate-latest-version crate))))
 
   (define version*
-    (find (lambda (version)
-            (string=? (crate-version-number version)
-                      version-number))
-          (crate-versions crate)))
+    (and crate
+         (find (lambda (version)
+                 (string=? (crate-version-number version)
+                           version-number))
+               (crate-versions crate))))
 
   (and crate version*
        (let* ((dependencies   (crate-version-dependencies version*))