import: crate: Support recursive imports.

* guix/import/crate.scm (crate-recursive-import): New procedure.
(crate->guix-package): Return dependencies as a second value.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Martin Becze 2019-10-01 16:54:56 -04:00 committed by Ludovic Courtès
parent b72c22c01a
commit f837293202
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 19 additions and 10 deletions

View File

@ -40,6 +40,7 @@
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:export (crate->guix-package #:export (crate->guix-package
guix-package->crate-name guix-package->crate-name
crate-recursive-import
%crate-updater)) %crate-updater))
@ -218,6 +219,7 @@ latest version of CRATE-NAME."
(cargo-development-inputs (cargo-development-inputs
(sort (map crate-dependency-id dev-dep-crates) (sort (map crate-dependency-id dev-dep-crates)
string-ci<?))) string-ci<?)))
(values
(make-crate-sexp #:name crate-name (make-crate-sexp #:name crate-name
#:version (crate-version-number version*) #:version (crate-version-number version*)
#:cargo-inputs cargo-inputs #:cargo-inputs cargo-inputs
@ -227,7 +229,14 @@ latest version of CRATE-NAME."
#:synopsis (crate-description crate) #:synopsis (crate-description crate)
#:description (crate-description crate) #:description (crate-description crate)
#:license (and=> (crate-version-license version*) #:license (and=> (crate-version-license version*)
string->license))))) string->license))
(append cargo-inputs cargo-development-inputs)))))
(define (crate-recursive-import crate-name)
(recursive-import crate-name #f
#:repo->guix-package (lambda (name repo)
(crate->guix-package name))
#:guix-name crate-name->package-name))
(define (guix-package->crate-name package) (define (guix-package->crate-name package)
"Return the crate name of PACKAGE." "Return the crate name of PACKAGE."