From ffb2ed45855c3a15a6db820cf2078141ae01ddd9 Mon Sep 17 00:00:00 2001 From: Niklaus 'vimja' Hofer Date: Sun, 23 Aug 2026 03:44:38 +0200 Subject: [PATCH] net-im/tuwunel: automate detection and handling of patched crates Signed-off-by: Niklaus 'vimja' Hofer --- net-im/tuwunel/tuwunel-1.9.0.ebuild | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/net-im/tuwunel/tuwunel-1.9.0.ebuild b/net-im/tuwunel/tuwunel-1.9.0.ebuild index 39427a1eac..2bc8b3711d 100644 --- a/net-im/tuwunel/tuwunel-1.9.0.ebuild +++ b/net-im/tuwunel/tuwunel-1.9.0.ebuild @@ -128,28 +128,30 @@ pkg_setup() { src_prepare() { # See https://bugs.gentoo.org/977089 - # grep '\[patch\.' Cargo.toml | sort - local patched_crates=( - async-channel - core_affinity - event-listener - hyper-util - resolv-conf - rustls-platform-verifier - rustyline-async + + # Get a list of patched crates from the project's Cargo.toml: + patched_crates=$( + grep '^\[patch\.' "${WORKDIR}"/"${P}"/Cargo.toml \ + | cut --delimiter='.' --fields=3 \ + | tr --delete ']' ) - for patched_crate in ${patched_crates[@]}; do + for patched_crate in ${patched_crates}; do + # Retrieve the crate's GIT hash from the GIT_CRATES array: local commit_hash=$( echo ${GIT_CRATES[${patched_crate}]} \ | cut --delimiter=';' --fields=2 ) + # Retrieve the crate's path from the GIT_CRATES array, replacing the + # '%commit%' placeholder with the GIT hash retrieved above: local crate_path=$( echo ${GIT_CRATES[${patched_crate}]} \ | cut --delimiter=';' --fields=3 \ | sed --expression="s/%commit%/${commit_hash}/g" ) + # Add an entry to config.toml, configuring the correct location for + # retrieving the patched crate. echo "" >> "${ECARGO_HOME}/config.toml" || die echo "[patch.crates-io.${patched_crate}]" >> "${ECARGO_HOME}/config.toml" || die echo "path = \"${WORKDIR}/${crate_path}\"" >> "${ECARGO_HOME}/config.toml" || die