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
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.
Another take: what if an app simply has no dependencies? CRATES being mandatory makes no sense.
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).
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>