[PATCH 3/9] cargo.eclass: port to esplit.eclass

Sam James <[email protected]> Thu, 9 Jul 2026 22:22:12 +0100
Newsgroups gmane.linux.gentoo.devel
Message-ID <78ebb2fadd1a790f247541d49850abe0671ff507.1783632122.git.sam@gentoo.org>
Avoid global-scope use of a heredoc which requires the use of a temporary
file for any size with < EAPI 9 and with large sizes still with >= EAPI 9.

Closes: https://bugs.gentoo.org/978857
Signed-off-by: Sam James <[email protected]>
---
 eclass/cargo.eclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index bf2a820537878..5a196dc138e46 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -20,6 +20,8 @@ esac
 if [[ -z ${_CARGO_ECLASS} ]]; then
 _CARGO_ECLASS=1
 
+inherit esplit
+
 if [[ -n ${RUST_NEEDS_LLVM} ]]; then
 	inherit llvm-r1
 fi
@@ -308,9 +310,14 @@ _cargo_set_crate_uris() {
 	if declare -p GIT_CRATES &>/dev/null; then
 		if [[ $(declare -p GIT_CRATES) == "declare -A"* ]]; then
 			local crate commit crate_uri crate_dir host repo_ext feat_expr
+			local split_git_crate
 
 			for crate in "${!GIT_CRATES[@]}"; do
-				IFS=';' read -r crate_uri commit crate_dir host <<< "${GIT_CRATES[${crate}]}" || die "${ECLASS}: could not create heredoc"
+				mapfile -d '' split_git_crate < <(IFS=';' esplit "${GIT_CRATES[${crate}]}")
+				crate_uri="${split_git_crate[0]}"
+				commit="${split_git_crate[1]}"
+				crate_dir="${split_git_crate[2]}"
+				host="${split_git_crate[3]}"
 
 				if [[ -z ${host} ]]; then
 					case "${crate_uri}" in
-- 
2.55.0