summary refs log tree commit diff
diff options
context:
space:
mode:
authorSarah Morgensen <iskarian@mgsn.dev>2021-07-12 07:41:04 -0700
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:44:36 +0200
commitb8af6694b9bbea96e8b0d1c9aea64b7f8e690812 (patch)
tree6bc3412f1c60bf9feea5fa86a7bdac9db5b91741
parent969fb0b2be24a9d49972cb6480ca8147b75e5748 (diff)
downloadguix-b8af6694b9bbea96e8b0d1c9aea64b7f8e690812.tar.gz
import: crate: Emit new-style package inputs.
* guix/import/crate.scm (maybe-cargo-development-inputs)
(maybe-cargo-inputs): Wrap PACKAGE-INPUTS in unquoted 'list'.
* tests/crate.scm ("crate->guix-package")
("cargo-recursive-import")
("cargo-recursive-import-honors-existing-packages"): Adjust accordingly.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I4dfb745272ecbc893926446872514fb815c07236
-rw-r--r--guix/import/crate.scm5
-rw-r--r--tests/crate.scm77
2 files changed, 30 insertions, 52 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index c4551688f6..3b36e9e3e3 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
 ;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
@@ -146,14 +147,14 @@ record or #f if it was not found."
     (()
      '())
     ((package-inputs ...)
-     `(#:cargo-inputs ,package-inputs))))
+     `(#:cargo-inputs (,'unquote (list ,@package-inputs))))))
 
 (define (maybe-cargo-development-inputs package-names)
   (match (package-names->package-inputs package-names)
     (()
      '())
     ((package-inputs ...)
-     `(#:cargo-development-inputs ,package-inputs))))
+     `(#:cargo-development-inputs (,'unquote (list ,@package-inputs))))))
 
 (define (maybe-arguments arguments)
   (match arguments
diff --git a/tests/crate.scm b/tests/crate.scm
index 5b4ad08c3c..63643c2728 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2019, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
 ;;;
@@ -500,7 +501,7 @@
                        ('quasiquote
                         (#:skip-build? #t
                          #:cargo-inputs
-                         (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
+                         ('unquote (list rust-leaf-alice-0.7)))))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "This package provides summary.")
@@ -606,7 +607,7 @@
                     (string-append name "-" version ".tar.gz"))
                    (sha256
                     (base32
-                     (?  string? hash)))))
+                     (? string? hash)))))
                 (build-system cargo-build-system)
                 (arguments ('quasiquote (#:skip-build? #t)))
                 (home-page "http://example.com")
@@ -649,8 +650,7 @@
                 (arguments
                  ('quasiquote (#:skip-build? #t
                                #:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                               ('unquote (list rust-leaf-bob-3)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -672,12 +672,9 @@
                 (arguments
                  ('quasiquote (#:skip-build? #t
                                #:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                               ('unquote (list rust-intermediate-b-1
+                                               rust-leaf-alice-0.7
+                                               rust-leaf-bob-3)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -698,17 +695,12 @@
                 (build-system cargo-build-system)
                 (arguments
                  ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
+                               ('unquote (list rust-intermediate-a-1
+                                               rust-intermediate-b-1
+                                               rust-leaf-alice-0.7
+                                               rust-leaf-bob-3))
                                #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                               ('unquote (list rust-intermediate-c-1)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -736,8 +728,7 @@
                 (build-system cargo-build-system)
                 (arguments
                  ('quasiquote (#:cargo-development-inputs
-                               (("rust-leaf-alice"
-                                 ('unquote rust-leaf-alice-0.7))))))
+                               ('unquote (list rust-leaf-alice-0.7)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -816,12 +807,9 @@
                 (build-system cargo-build-system)
                 (arguments
                  ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                               ('unquote (list rust-intermediate-b-1
+                                               rust-leaf-alice-0.7
+                                               rust-leaf-bob-3)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -842,17 +830,12 @@
                 (build-system cargo-build-system)
                 (arguments
                  ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
+                               ('unquote (list rust-intermediate-a-1
+                                               rust-intermediate-b-1
+                                               rust-leaf-alice-0.7
+                                               rust-leaf-bob-3))
                                #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                               ('unquote (list rust-intermediate-c-1)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -963,13 +946,10 @@
             (build-system cargo-build-system)
             (arguments
              ('quasiquote (#:cargo-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3)))
+                           ('unquote (list rust-leaf-bob-3))
                            #:cargo-development-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                            ("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+                           ('unquote (list rust-leaf-bob-3.0.2-yanked
+                                           rust-leaf-bob-4.0.0-yanked)))))
             (home-page "http://example.com")
             (synopsis "summary")
             (description "This package provides summary.")
@@ -1094,13 +1074,10 @@
                 (build-system cargo-build-system)
                 (arguments
                  ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3)))
+                               ('unquote (list rust-leaf-bob-3))
                                #:cargo-development-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                                ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+                               ('unquote (list rust-leaf-bob-3.0.2-yanked
+                                               rust-leaf-bob-4.0.0-yanked)))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")