From 118145de3992a8249131bd0eb30ea89ad0bd0bdf Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 7 Feb 2024 17:38:19 +0100 Subject: llvm-utils.eclass: Split out PATH prepending logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split the logic prepending PATH from pkg_setup() into a dedicated llvm_prepend_path() function. Signed-off-by: Michał Górny --- eclass/llvm.eclass | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'eclass/llvm.eclass') diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass index 05ffcfd7cc6d..e297fe992c9f 100644 --- a/eclass/llvm.eclass +++ b/eclass/llvm.eclass @@ -212,30 +212,7 @@ llvm_pkg_setup() { llvm_fix_tool_path LLVM_CONFIG fi - local prefix=${ESYSROOT} - local llvm_path=${prefix}/usr/lib/llvm/${LLVM_SLOT}/bin - local IFS=: - local split_path=( ${PATH} ) - local new_path=() - local x added= - - # prepend new path before first LLVM version found - for x in "${split_path[@]}"; do - if [[ ${x} == */usr/lib/llvm/*/bin ]]; then - if [[ ${x} != ${llvm_path} ]]; then - new_path+=( "${llvm_path}" ) - elif [[ ${added} && ${x} == ${llvm_path} ]]; then - # deduplicate - continue - fi - added=1 - fi - new_path+=( "${x}" ) - done - # ...or to the end of PATH - [[ ${added} ]] || new_path+=( "${llvm_path}" ) - - export PATH=${new_path[*]} + llvm_prepend_path "${LLVM_SLOT}" fi } -- cgit v1.2.3-65-gdbad