llvm-utils.eclass: Fix llvm_prepend_path w/ no '-d' and slot arg

Closes: https://bugs.gentoo.org/951975
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42214
Closes: https://github.com/gentoo/gentoo/pull/42214
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2025-05-22 19:48:00 +02:00
parent 0cd5afe4bd
commit ebb5251f0e
2 changed files with 23 additions and 3 deletions

View File

@@ -126,10 +126,9 @@ llvm_fix_tool_path() {
llvm_prepend_path() {
debug-print-function ${FUNCNAME} "$@"
local prefix
case ${1--d} in
local prefix=${ESYSROOT}
case ${1} in
-d)
prefix=${ESYSROOT}
shift
;;
-b)

View File

@@ -104,6 +104,8 @@ test_fix_tool_path AR ar 1
test_fix_tool_path AR ar 0
ESYSROOT=
einfo "Testing with ESYSROOT=${ESYSROOT}"
eindent
test_prepend_path 17 /usr/bin /usr/bin:/usr/lib/llvm/17/bin
test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin /usr/lib/llvm/17/bin:/usr/bin
test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin /usr/bin:/usr/lib/llvm/17/bin
@@ -123,5 +125,24 @@ test_prepend_path 18 /usr/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin \
/usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin
test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin \
/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin
eoutdent
ESYSROOT=/foo
einfo "Testing with ESYSROOT=${ESYSROOT}"
eindent
test_prepend_path 17 /usr/bin /usr/bin:/foo/usr/lib/llvm/17/bin
test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin \
/foo/usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin:/usr/bin
test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin: \
/usr/bin:/foo/usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin
test_prepend_path 17 /foo/usr/lib/llvm/17/bin:/usr/bin \
/foo/usr/lib/llvm/17/bin:/usr/bin
test_prepend_path 17 /usr/bin:/foo/usr/lib/llvm/17/bin: \
/usr/bin:/foo/usr/lib/llvm/17/bin
test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin \
/foo/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin
test_prepend_path 18 /foo/usr/lib/llvm/17/bin:/usr/bin \
/foo/usr/lib/llvm/18/bin:/foo/usr/lib/llvm/17/bin:/usr/bin
eoutdent
texit