diff mbox series

[bug#37525,v2,1/3] added recusive import functionality to the crate importer

Message ID 20191001205458.20926-1-mjbecze@riseup.net
State Accepted
Headers show
Series [bug#37525,v2,1/3] added recusive import functionality to the crate importer | expand

Commit Message

Martin Becze Oct. 1, 2019, 8:54 p.m. UTC
* /guix/import/crate.scm (crate-recursive-import crate-name): added recusive import proc
* /guix/import/crate.scm (crate->guix-package): return inputs for use by the recurive importer
---
 guix/import/crate.scm | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

Comments

Ludovic Courtès Oct. 1, 2019, 9:33 p.m. UTC | #1
Hi,

Applied!

Note that I merged patches #2 and #3, because we usually document
features as we add them, not separately.  I had to fix up the Texinfo
markup so that ‘--recursive’ is described under ‘crate’.

Anyway it seems to work well, thanks for the patches!

Ludo’.
Martin Becze Oct. 1, 2019, 9:52 p.m. UTC | #2
On 2019-10-01 21:33, Ludovic Courtès wrote:
> Hi,
> 
> Applied!
> 
> Note that I merged patches #2 and #3, because we usually document
> features as we add them, not separately.  I had to fix up the Texinfo
> markup so that ‘--recursive’ is described under ‘crate’.
> 
> Anyway it seems to work well, thanks for the patches!
> 
> Ludo’.

Awesome thanks! 

> features as we add them, not separately.

Do you mean in the same commit that makes the changes to the code? or
when you apply patches to master?
Ludovic Courtès Oct. 2, 2019, 2:28 p.m. UTC | #3
Martin Becze <mjbecze@riseup.net> skribis:

> On 2019-10-01 21:33, Ludovic Courtès wrote:

[...]

>> features as we add them, not separately.
>
> Do you mean in the same commit that makes the changes to the code? or
> when you apply patches to master?

I mean that when we add a user-visible change, such as a new
command-line option, we should document it in the same commit that
actually adds the feature.

Thanks,
Ludo’.
diff mbox series

Patch

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."