Subject: guix import crate fails if optional dependency has a missing version

From: Mike Delago <[email-masked]>
Date: Sat, 13 Aug 2022 17:57:14 -0400

Version: 9e4632081ff31bf0d1715edd66f514614c6dc4bb

I'm working to define a package for Zellij, a terminal multiplexer 
similar to GNU screen or tmux.

It appears that some of the dependencies aren't within the standard Guix 
channel, so I'm doing a recursive import (with `guix import crate zellij 
--recursive >> foo.scm`)

Unfortunately, this is failing. Attempting again via 
`(crate-recursive-import "zellij" #:version "0.31.1")` in the guix repl 
leads to this backtrace:

following redirection to 
`https://static.crates.io/crates/wasmer-types/wasmer-types-1.0.2.crate'...
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1 (expecting 
struct): #f

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix-user) [1]> ,bt
;; lines removed for brevity
In guix/import/crate.scm:
    300:28 17 (crate->guix-package "cranelift-codegen" #:version _ # _ …)
    292:10 16 (sort-map-dependencies _)
In srfi/srfi-1.scm:
    ;;  lines removed for brevity
    586:29  3 (map1 (#<<crate-dependency> id: "hashbrown" kind: no…> …))
    586:17  2 (map1 (#<<crate-dependency> id: "peepmatic" kind: no…> …))
In guix/import/crate.scm:
    283:18  1 (dependency-name+version _)
In ice-9/boot-9.scm:
   1685:16  0 (raise-exception _ #:continuable? _)

It appears that the crate importer is failing when attempting to get a 
package that doesn't exist. In this case, it's "peepmatic", version 
0.68.0.  On crates.io, the [email-masked] returns a 404.

I'd like if the crate importer for guix should more cleanly handle this, 
or concisely describe the issue.

Thanks,

Mike Delago