import: crate: Honor crate version for recursive imports.

Fixes <https://bugs.gnu.org/38709>.
Reported by Valentin Ignatev <valentignatev@gmail.com>.

* guix/import/crate.scm (crate-recursive-import): Add optional 'version'
parameter and honor it.
* guix/scripts/import/crate.scm (guix-import-crate): Pass VERSION as 2nd
argument to 'crate-recursive-import'.
This commit is contained in:
Ludovic Courtès 2019-12-30 22:49:09 +01:00
parent ddc291d74b
commit c7ca707b59
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 7 additions and 4 deletions

View file

@ -231,10 +231,13 @@ (define version*
string->license))
(append cargo-inputs cargo-development-inputs)))))
(define (crate-recursive-import crate-name)
(define* (crate-recursive-import crate-name #:optional version)
(recursive-import crate-name #f
#:repo->guix-package (lambda (name repo)
(crate->guix-package name))
#:repo->guix-package
(lambda (name repo)
(let ((version (and (string=? name crate-name)
version)))
(crate->guix-package name version)))
#:guix-name crate-name->package-name))
(define (guix-package->crate-name package)

View file

@ -100,7 +100,7 @@ (define-values (name version)
`(define-public ,(string->symbol name)
,pkg))
(_ #f))
(crate-recursive-import name))
(crate-recursive-import name version))
(let ((sexp (crate->guix-package name version)))
(unless sexp
(leave (G_ "failed to download meta-data for package '~a'~%")