eclass/rust: Sync with Gentoo

It's from Gentoo commit 388cbca2dd4f4826e9bb99f89b2bb1808e84de52.
This commit is contained in:
Flatcar Buildbot 2025-06-16 07:11:34 +00:00 committed by Krzesimir Nowak
parent 948d5fa90a
commit a4df063c74

View File

@ -68,6 +68,7 @@ fi
# Definitive list of Rust slots and the associated LLVM slot, newest first.
declare -A -g -r _RUST_LLVM_MAP=(
["9999"]=20
["1.88.0"]=20
["1.87.0"]=20
["1.86.0"]=19
["1.85.1"]=19
@ -84,7 +85,6 @@ declare -A -g -r _RUST_LLVM_MAP=(
["1.76.0"]=17
["1.75.0"]=17
["1.74.1"]=17
["1.71.1"]=16
)
# @ECLASS_VARIABLE: _RUST_SLOTS_ORDERED
@ -95,6 +95,7 @@ declare -A -g -r _RUST_LLVM_MAP=(
# this array is used to store the Rust slots in a more convenient order for iteration.
declare -a -g -r _RUST_SLOTS_ORDERED=(
"9999"
"1.88.0"
"1.87.0"
"1.86.0"
"1.85.1"
@ -111,7 +112,6 @@ declare -a -g -r _RUST_SLOTS_ORDERED=(
"1.76.0"
"1.75.0"
"1.74.1"
"1.71.1"
)
# == user control knobs ==
@ -250,22 +250,25 @@ _rust_set_globals() {
local usedep="${RUST_REQ_USE+[${RUST_REQ_USE}]}"
# If we're not using LLVM, we can just generate a simple Rust dependency
# In time we need to implement trivial dependencies
# (>=RUST_MIN_VER) where RUST_MAX_VER isnt't set,
# however the previous attempt to do this ran into issues
# where `emerge ... --keep-going` ate legacy non-slotted
# Rust blockers resutling in the non-slotted version never
# being removed and breaking builds. #943206 #943143
if [[ -z "${RUST_NEEDS_LLVM}" ]]; then
rust_dep=( "|| (" )
# depend on each slot between RUST_MIN_VER and RUST_MAX_VER; it's a bit specific but
# won't hurt as we only ever add newer Rust slots.
for slot in "${_RUST_SLOTS[@]}"; do
# We can be more flexible if we generate a simpler, open-ended dependency
# when we don't have a max version set.
if [[ -z "${RUST_MAX_VER}" ]]; then
rust_dep+=(
"dev-lang/rust-bin:${slot}${usedep}"
"dev-lang/rust:${slot}${usedep}"
">=dev-lang/rust-bin-${RUST_MIN_VER}:*${usedep}"
">=dev-lang/rust-${RUST_MIN_VER}:*${usedep}"
)
done
else
# depend on each slot between RUST_MIN_VER and RUST_MAX_VER; it's a bit specific but
# won't hurt as we only ever add newer Rust slots.
for slot in "${_RUST_SLOTS[@]}"; do
rust_dep+=(
"dev-lang/rust-bin:${slot}${usedep}"
"dev-lang/rust:${slot}${usedep}"
)
done
fi
rust_dep+=( ")" )
RUST_DEPEND="${rust_dep[*]}"
else