From 45584061a9ebe961e2be08ee94c3fe8ad74e2713 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Sat, 14 Nov 2020 21:31:33 +0100 Subject: 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. --- tests/crate.scm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'tests/crate.scm') 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") -- cgit v1.2.3