Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 608396 - cargo.eclass should have helpers for path dependencies
Summary: cargo.eclass should have helpers for path dependencies
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-06 08:39 UTC by Robin Johnson
Modified: 2024-02-11 06:01 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-02-06 08:39:35 UTC
cargo.eclass should have a unified way of handling path dependencies [1].

To build rdedup, I have this hack, but it depends on the inner workings of cargo.eclass, and is fragile.

rdedup/Cargo.toml
...
[dependencies]
rdedup-lib = { version = "1.0.2", path = "lib" }
...

rdedup-1.0.2.ebuild:
CRATES="... rdedup-lib-1.0.2 ..."
src_prepare() {
    ln -sf "${WORKDIR}/cargo_home/gentoo/rdedup-lib-${PV}" "${S}/lib"
}

At the very least, it would be good to have a manual helper eg:
usage:
cargo_path_dep $CRATE_SPEC $PATHSPEC
example:
cargo_path_dep rdedup-lib-${PV} "${S}/lib"

Better would be scanning the main Cargo.toml and applying it automatically.

[1] http://doc.crates.io/specifying-dependencies.html#specifying-path-dependencies
Comment 1 gibix 2018-06-05 19:04:13 UTC
We should handle in the same way also git deps/patches in the cargo eclass and specially how to generate them with cargo-ebuild. I'm looking to some solutions.

- Have a CRATES_GIT and a CRATES_PATH generated by cargo-ebuild and handle them with
- Encode CRATES with a descriptor (es git+path+$MYPATH+branch=patch)
Comment 2 Larry the Git Cow gentoo-dev 2023-02-08 20:15:14 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49a81668b60c1d54885e62b000595141ee6ff333

commit 49a81668b60c1d54885e62b000595141ee6ff333
Author:     Patrick McLean <chutzpah@gentoo.org>
AuthorDate: 2023-01-26 23:20:13 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2023-02-08 20:08:12 +0000

    cargo.eclass: Add support for GIT_CRATES
    
    This adds support for an associative array called GIT_CRATES containing any
    crates that must be fetched from git rather than just cargo crates. This will
    add the code to the cargo config to make sure that the locations are overridden
    so cargo won't try to fetch the crates from git.
    
    Currently it automatically handle GitHub and GitLab URIs, and will accept
    arbitrary URIs.
    
    Bug: https://bugs.gentoo.org/608396
    Issue: https://github.com/gentoo/cargo-ebuild/issues/33
    Closes: https://github.com/gentoo/gentoo/pull/29289
    Tested-By: Georgy Yakovlev <gyakovlev@gentoo.org>
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 eclass/cargo.eclass | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)