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
1 changed files with 8 additions and 6 deletions

View File

@ -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*))