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

Eli Schwartz <[email protected]> Thu, 28 May 2026 17:56:25 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
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 ./) \
-- 
2.53.0