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

Ionen Wolkens <[email protected]> Thu, 28 May 2026 20:25:57 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <ahjdFX0iS4j6somh@eversor>
On Thu, May 28, 2026 at 05:56:25PM -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"
> +

= 8 -> == 8

Either works but it's for consistency given we use == nearly everywhere
to avoid confusion with assignments (bash also doesn't document = as
being valid for comparisons afaik, posix test(1) does but this is
bash's [[ which we likewise prefer).

Others may further prefer != 8 && die given they find || confusing, but well
-- personally I actually prefer || when it's for abort conditions like
die so I'd leave it like that.

>  	_cargo_check_initialized
>  
>  	set -- "${CARGO}" install $(has --path ${@} || echo --path ./) \
> -- 
> 2.53.0
> 
> 

-- 
ionen
signature.asc (application/pgp-signature, 525 B)
-----BEGIN PGP SIGNATURE-----

iQFPBAABCAA5FiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmoY3RUbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELJEBrCwrEM0tB8H/3lfxit2fzb8UQbgRLom
2EYJlXvVtXFMEhNn5lWpQ5K7tBLySALM8JcEJ/wBOcluzrQ2GBhdxmANJUySKO7f
SlFOoI2Z585OnFr/WJQOngGPaSgX5xHM51ZVmS/yaZNMxvM9nqwXo7WnAMMUwORj
FMY/H5XBUk6txVdrW7HKRs7WL5L+NWGvqDT5H2x3MBwt8TPjQEGIj94CUqcUdZ6/
goGewvDiVasM/2Smlhy01+NgiqEN5InmWAw4kQysIriKFY/Ae0w6GqEF+vzvsW0K
MB7iQ7BOh1CIIRXYSPe/QwDkne/FaR3DTeig/Ym+s3ijxJxo5ZK7iDh4d7IKUyr1
0yM=
=PVzr
-----END PGP SIGNATURE-----