Re: [PATCH 1/2] cargo.eclass: for EAPI 9, ban cargo_src_install

James Le Cuirot <[email protected]> Thu, 28 May 2026 23:00:20 +0100
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
On Thu, 2026-05-28 at 17:56 -0400, Eli Schwartz wrote:
> This was always a terrible idea. cargo pretends to be a package manager
> and a build system, but is neither -- only a compiler-wrapper.
> 
> "cargo install" recompiles the binary so it is not what you tested in
> src_test. It does so during the src_install phase, and it (mostly?)
> doesn't respect incremental builds or caching intermediate outputs. It
> also cannot install anything other than what doexe does, since cargo
> doesn't support *building* multiple output types, let alone installing
> them in a uniform way.
> 
> Simply require users to use doexe like for any other package without a
> standard (autotools, meson, cmake etc.) build system.
> 
> Signed-off-by: Eli Schwartz <[email protected]>
> ---
>  eclass/cargo.eclass | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
> index 10018334ebdb..18cb2156cc8f 100644
> --- a/eclass/cargo.eclass
> +++ b/eclass/cargo.eclass
> @@ -826,9 +826,13 @@ cargo_src_compile() {
>  # In some cases workspaces need an alternative --path parameter.
>  # Defaults to '--path ./' if no path is specified.
>  # '--path ./somedir' can be passed directly to cargo_src_install.
> +#
> +# Banned starting EAPI 9.
>  cargo_src_install() {
>  	debug-print-function ${FUNCNAME} "$@"
>  
> +	[[ ${EAPI} = 8 ]] || die "cargo.eclass: src_install no longer provided since EAPI 9"
> +
>  	_cargo_check_initialized
>  
>  	set -- "${CARGO}" install $(has --path ${@} || echo --path ./) \

I always wondered why it did some rebuilding. Good call.
signature.asc (application/pgp-signature, 423 B)
-----BEGIN PGP SIGNATURE-----

iQEDBAAWCgCrFiEE6qETVs4yu3Lfuc3XsNCJZ6jP87QFAmoYuvQbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFQUExMTM1NkNFMzJCQjcyREZCOUNE
RDdCMEQwODk2N0E4Q0ZGM0I0ERxjaGV3aUBnZW50b28ub3JnAAoJELDQiWeoz/O0
dsoBAJ9FXKN+ltPEiWaRSO94pt/9bScBwJlYOtA50WUExc5pAP47/HzpArj5CkpY
ZyAxRPOscdB11UypO2xRJc10xa3/AA==
=Thwd
-----END PGP SIGNATURE-----