[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proper way to resolve dependency version conflicts of rust crates?
From: |
Ignas Lapėnas |
Subject: |
Re: proper way to resolve dependency version conflicts of rust crates? |
Date: |
Mon, 08 Jan 2024 12:02:29 +0200 |
User-agent: |
mu4e 1.10.8; emacs 30.0.50 |
Hi,
> 1. Sent a patch to the upstream of the crate as well as to guix updating
> all crate dependencies to most-recent.
Sending a patch upstream updating package versions is probably desired by the
guix rust-team, can’t actually answer that. Contributing is another beast to
tackle for me some time in the future. Best guess, guix-devel mailing list
should provide an answer for that.
> 2. Define a package variant of said dependency, let’s say foo-0.13-1 for
> v0.13.1 of foo.
I doubt that this is necessary if the package in question follows semver rules.
> 3. Substitute the required version in Cargo.toml of a affected crate to
> match the package-version of said dependency we’ve packaged in Guix.
>
> If I had to guess 3. would be the most appropriate way forward on this?
I would go with option 3.
Currently most packages I see drops the ’=’ altogether in favor of ’^’.
For example the rust-base64 package:
┌────
│ (define-public rust-base64-0.13
│ (package
│ (inherit rust-base64-0.21)
│ (name "rust-base64")
│ (version "0.13.1")
│ (source
│ (origin
│ (method url-fetch)
│ (uri (crate-uri "base64" version))
│ (file-name
│ (string-append name "-" version ".tar.gz"))
│ (sha256
│ (base32 "1s494mqmzjb766fy1kqlccgfg2sdcjb6hzbvzqv2jw65fdi5h6wy"))
│ (modules '((guix build utils)))
│ (snippet
│ '(begin (substitute* "Cargo.toml"
│ (("=0\\.3\\.2") "^0.3.2"))))))
│ (arguments
│ `(#:cargo-development-inputs
│ (("rust-criterion" ,rust-criterion-0.3)
│ ("rust-rand" ,rust-rand-0.6)
│ ("rust-structopt" ,rust-structopt-0.3))))))
└────
Hope my blabering helps you mate.
–
Best Regards,
Ignas Lapėnas