summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2020-11-14 21:31:33 +0100
committerHartmut Goebel <h.goebel@crazy-compilers.com>2020-12-02 22:09:23 +0100
commit45584061a9ebe961e2be08ee94c3fe8ad74e2713 (patch)
treea92671f40ed4ff909d5cb3c576c16846eb2b45ca /tests
parent9a48e35be853e10ba9b21bb91ef52a66b4264c84 (diff)
downloadguix-45584061a9ebe961e2be08ee94c3fe8ad74e2713.tar.gz
import: crate: Trim version for names after left-most non-zero part.
This complies to how versions are matched for caret requirements in crates:
An update is allowed if the new version number does not modify the left-most
non-zero digit in the major, minor, patch grouping.

* guix/import/crate.scm (version->semver-prefix): New function.
  (make-crate-sexp)[format-inputs]: Use it.
  (make-crate-sexp): Use it to pass shorter version to package->definition.
* guix/import/utils.scm (package->definition): Change optional parameter
  APPEND-VERSION? into APPEND-VERSION?/STRING. If it is a string, append its
  value to name.
* tests/crate.scm: Adjust tests accordingly.
Diffstat (limited to 'tests')
-rw-r--r--tests/crate.scm25
1 files changed, 12 insertions, 13 deletions
diff --git a/tests/crate.scm b/tests/crate.scm
index 3fbf6762c5..1506daeadd 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -352,7 +352,7 @@
              (_ (error "Unexpected URL: " url)))))
 
         (match (crate->guix-package "foo")
-          ((define-public 'rust-foo-1.0
+          ((define-public 'rust-foo-1
              (package (name "rust-foo")
                       (version "1.0.3")
                       (source
@@ -368,8 +368,7 @@
                        ('quasiquote
                         (#:skip-build? #t
                          #:cargo-inputs
-                         (("rust-leaf-alice"
-                           ('unquote 'rust-leaf-alice-0.7))))))
+                         (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "summary")
@@ -452,7 +451,7 @@
                 (synopsis "summary")
                 (description "summary")
                 (license (list license:expat license:asl2.0))))
-            (define-public 'rust-leaf-bob-3.0
+            (define-public 'rust-leaf-bob-3
               (package
                 (name "rust-leaf-bob")
                 (version "3.0.1")
@@ -471,7 +470,7 @@
                 (synopsis "summary")
                 (description "summary")
                 (license (list license:expat license:asl2.0))))
-            (define-public 'rust-intermediate-b-1.2
+            (define-public 'rust-intermediate-b-1
               (package
                 (name "rust-intermediate-b")
                 (version "1.2.3")
@@ -489,12 +488,12 @@
                  ('quasiquote (#:skip-build? #t
                                #:cargo-inputs
                                (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0))))))
+                                 ('unquote rust-leaf-bob-3))))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
                 (license (list license:expat license:asl2.0))))
-            (define-public 'rust-intermediate-a-1.0
+            (define-public 'rust-intermediate-a-1
               (package
                 (name "rust-intermediate-a")
                 (version "1.0.42")
@@ -512,16 +511,16 @@
                  ('quasiquote (#:skip-build? #t
                                #:cargo-inputs
                                (("rust-intermediate-b"
-                                 ('unquote 'rust-intermediate-b-1.2))
+                                 ('unquote rust-intermediate-b-1))
                                 ("rust-leaf-alice"
                                  ('unquote 'rust-leaf-alice-0.7))
                                 ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0))))))
+                                 ('unquote rust-leaf-bob-3))))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
                 (license (list license:expat license:asl2.0))))
-            (define-public 'rust-root-1.0
+            (define-public 'rust-root-1
               (package
                 (name "rust-root")
                 (version "1.0.4")
@@ -538,13 +537,13 @@
                 (arguments
                  ('quasiquote (#:cargo-inputs
                                (("rust-intermediate-a"
-                                 ('unquote 'rust-intermediate-a-1.0))
+                                 ('unquote rust-intermediate-a-1))
                                 ("rust-intermediate-b"
-                                 ('unquote 'rust-intermediate-b-1.2))
+                                 ('unquote rust-intermediate-b-1))
                                 ("rust-leaf-alice"
                                  ('unquote 'rust-leaf-alice-0.7))
                                 ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0))))))
+                                 ('unquote rust-leaf-bob-3))))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")