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 ...).
This commit is contained in:
Ludovic Courtès 2020-04-27 22:17:53 +02:00
parent 5dfe02c607
commit 5fbc753ab5
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -201,14 +201,16 @@ (define crate
(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*))