summaryrefslogtreecommitdiff
path: root/guix/scripts/import/crate.scm
diff options
context:
space:
mode:
authorMartin Becze <mjbecze@riseup.net>2020-02-04 03:50:48 -0500
committerHartmut Goebel <h.goebel@crazy-compilers.com>2020-12-02 22:09:23 +0100
commit269c1db41bd82f93c7ae5c62a4969a423e556183 (patch)
tree7ebfc953a3a418cf5f4d41e6dd1c897b121bc1d4 /guix/scripts/import/crate.scm
parentbea3b17739fc591b8cf6db1f8d28a6f6c9585577 (diff)
import: crate: Use guile-semver to resolve module versions.
* guix/import/crate.scm: Add guile-semver as a soft dependency. (make-crate-sexp): Don't allow other keys. Add '#:skip-build?' to build system args. Pass a VERSION argument to 'cargo-inputs'. (crate->guix-package): Use guile-semver to resolve the correct module versions. Treat "build" dependencies as normal dependencies. (crate-name->package-name): Reuse the procedure 'guix-name' instead of duplicating its logic. * guix/import/utils.scm (package-names->package-inputs): Implement handling of (name version) pairs. * guix/scripts/import/crate.scm (guix-import-crate): Use crate-recursive-import instead of duplicate code. * tests/crate.scm (recursive-import): Change test packages versions to be distinguishable. Add version data to the test. Check created symbols, too. Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Diffstat (limited to 'guix/scripts/import/crate.scm')
-rw-r--r--guix/scripts/import/crate.scm11
1 files changed, 3 insertions, 8 deletions
diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm
index 9c4286f8bd..33dae56561 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -2,7 +2,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
-;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -95,19 +95,14 @@ Import and convert the crate.io package for PACKAGE-NAME.\n"))
(package-name->name+version spec))
(if (assoc-ref opts 'recursive)
- (map (match-lambda
- ((and ('package ('name name) . rest) pkg)
- `(define-public ,(string->symbol name)
- ,pkg))
- (_ #f))
- (crate-recursive-import name #:version version))
+ (crate-recursive-import name #:version version)
(let ((sexp (crate->guix-package name #:version version)))
(unless sexp
(leave (G_ "failed to download meta-data for package '~a'~%")
(if version
(string-append name "@" version)
name)))
- sexp)))
+ (list sexp))))
(()
(leave (G_ "too few arguments~%")))
((many ...)