import: crate: Trim version for names after left-most non-zero part.
authorHartmut Goebel <h.goebel@crazy-compilers.com>
Sat, 14 Nov 2020 20:31:33 +0000 (21:31 +0100)
committerHartmut Goebel <h.goebel@crazy-compilers.com>
Wed, 2 Dec 2020 21:09:23 +0000 (22:09 +0100)
commit45584061a9ebe961e2be08ee94c3fe8ad74e2713
treea92671f40ed4ff909d5cb3c576c16846eb2b45ca
parent9a48e35be853e10ba9b21bb91ef52a66b4264c84
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.
guix/import/crate.scm
guix/import/utils.scm
tests/crate.scm