summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Becze <mjbecze@riseup.net>2019-10-01 16:54:56 -0400
committerLudovic Courtès <ludo@gnu.org>2019-10-01 23:34:30 +0200
commitf8372932027680a1f2f1b41ea8e19c12bb7d7070 (patch)
tree17a4f5ea0a42ea20f275eb5b31e27777d13147bd
parentb72c22c01a4ccc2c4287b2bf8fb11666f0aeb7ae (diff)
downloadguix-f8372932027680a1f2f1b41ea8e19c12bb7d7070.tar.gz
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>
-rw-r--r--guix/import/crate.scm29
1 files changed, 19 insertions, 10 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index fd1974eae8..8dc014d232 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -40,6 +40,7 @@
   #:use-module (srfi srfi-26)
   #:export (crate->guix-package
             guix-package->crate-name
+            crate-recursive-import
             %crate-updater))
 
 
@@ -218,16 +219,24 @@ latest version of CRATE-NAME."
               (cargo-development-inputs
                (sort (map crate-dependency-id dev-dep-crates)
                      string-ci<?)))
-         (make-crate-sexp #:name crate-name
-                          #:version (crate-version-number version*)
-                          #:cargo-inputs cargo-inputs
-                          #:cargo-development-inputs cargo-development-inputs
-                          #:home-page (or (crate-home-page crate)
-                                          (crate-repository crate))
-                          #:synopsis (crate-description crate)
-                          #:description (crate-description crate)
-                          #:license (and=> (crate-version-license version*)
-                                           string->license)))))
+         (values
+          (make-crate-sexp #:name crate-name
+                           #:version (crate-version-number version*)
+                           #:cargo-inputs cargo-inputs
+                           #:cargo-development-inputs cargo-development-inputs
+                           #:home-page (or (crate-home-page crate)
+                                           (crate-repository crate))
+                           #:synopsis (crate-description crate)
+                           #:description (crate-description crate)
+                           #:license (and=> (crate-version-license version*)
+                                            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)
   "Return the crate name of PACKAGE."