diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 4c3f8000d0..405a26a877 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -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) diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 92034dab3c..d834518c18 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -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'~%")