guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: import: crate: Honor crate version for recursive imports.


From: guix-commits
Subject: 01/03: import: crate: Honor crate version for recursive imports.
Date: Mon, 30 Dec 2019 17:19:05 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit c7ca707b59304a978cab8c5c25401259c6c18214
Author: Ludovic Court├Ęs <address@hidden>
Date:   Mon Dec 30 22:49:09 2019 +0100

    import: crate: Honor crate version for recursive imports.
    
    Fixes <https://bugs.gnu.org/38709>.
    Reported by Valentin Ignatev <address@hidden>.
    
    * 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'.
---
 guix/import/crate.scm         | 9 ++++++---
 guix/scripts/import/crate.scm | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 4c3f800..405a26a 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -231,10 +231,13 @@ latest version of CRATE-NAME."
                                             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 92034da..d834518 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -100,7 +100,7 @@ Import and convert the crate.io package for 
PACKAGE-NAME.\n"))
                    `(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'~%")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]