Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890292 - cargo.eclass: ${CRATES} required, disallows vendored source tarballs, inconsistent to go-module.eclass
Summary: cargo.eclass: ${CRATES} required, disallows vendored source tarballs, inconsi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-09 15:01 UTC by Thomas Schneider
Modified: 2024-03-06 19:02 UTC (History)
7 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 Thomas Schneider 2023-01-09 15:01:15 UTC
As of EAPI=8, cargo.eclass requires—for non-live ebuilds—$CRATES to be set, in order to populate $SRC_URI through $(cargo_crate_uris) (cf. [0]).  Regardless of the decision whether vendor tarballs or direct crates in $SRC_URI are preferred, I see no reason for cargo.eclass to force the current behaviour.  As $SRC_URI is only populated through $(cargo_crate_uris), and cargo_src_unpack() does not depend on $CRATES, it would probably be enough to just remove the check altogether.

Technical details aside, this behaviour is also confusing for ebuild writers, as it is inconsistens with go-module.eclass, which deprecated $EGO_SUM serving a similar purpose as $CRATES (cf. [1]).  My personal preference (well aware of [2,3] would be to un-deprecate $EGO_SUM, but that’s probably another discussion.  In any case, cargo.eclass and go-module.eclass should be at least somewhat consistent IMHO.

[0]: https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/cargo.eclass?id=0bd990c9fb95eb9628ff3708872417666a87a7d8#n29
[1]: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62fb29b23e3bc0eec89b6cf33d33c6cc939c1990
[2]: https://bugs.gentoo.org/847619#c3
[3]: https://bugs.gentoo.org/833567
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-09 15:10:35 UTC
I agree it makes sense for us to allow vendor tarballs and treat them more "fairly", not just on technical grounds, but to be more consistent with go-modul.eclass.
Comment 2 Hanabishi 2023-08-25 19:12:58 UTC
Another take: what if an app simply has no dependencies? CRATES being mandatory makes no sense.
Comment 3 Ionen Wolkens gentoo-dev 2023-08-25 19:32:01 UTC
Note that as a temporary workaround you can do a silly:

    CRATES=" "
    inherit cargo

That's what I did last time I messed with vendoring (eclass changed a bit since, but assume it still works), albeit it was just a test ebuild I never pushed to the tree. Could potentially have side-effects in the future if we assume that a non-empty CRATES means there's at least one crate in it though (but right now spaces are simply discarded through word splitting).
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-03-06 19:02:24 UTC
commit e759d3dcff09e271735620b525333d091e085e2d
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2023-12-02 13:35:51 +0100
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-12-09 19:16:16 +0100

    cargo.eclass: Allow CRATES to be unset
    
    Remove the assertion requiring CRATES to be set for non-live ebuilds.
    There are valid use cases for ebuilds without CRATES, and the eclass
    works just fine -- e.g. when the package is using GIT_CRATES only,
    or when crates are provided via a tarball.
    
    Closes: https://github.com/gentoo/gentoo/pull/34091
    Signed-off-by: Michał Górny <mgorny@gentoo.org>