summaryrefslogtreecommitdiff
path: root/eclass/rust.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-12-09 02:07:41 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-12-09 02:07:41 +0000
commit1a95f960273f276a4fdefb824336b073d83bcb5e (patch)
tree6adc7118c038d948a0e44ceb3095e09bc2cbe488 /eclass/rust.eclass
parent494168b06b81a32b889c3cb1f721f925d0a6824f (diff)
gentoo auto-resync : 09:12:2024 - 02:07:41
Diffstat (limited to 'eclass/rust.eclass')
-rw-r--r--eclass/rust.eclass49
1 files changed, 44 insertions, 5 deletions
diff --git a/eclass/rust.eclass b/eclass/rust.eclass
index 2bf0b27b3f40..eb14ca2329b5 100644
--- a/eclass/rust.eclass
+++ b/eclass/rust.eclass
@@ -102,6 +102,26 @@ declare -a -g -r _RUST_SLOTS_ORDERED=(
"1.54.0"
)
+# == user control knobs ==
+
+# @ECLASS_VARIABLE: ERUST_SLOT_OVERRIDE
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Specify the version (slot) of Rust to be used by the package. This is
+# useful for troubleshooting and debugging purposes; If unset, the newest
+# acceptable Rust version will be used. May be combined with ERUST_TYPE_OVERRIDE.
+# This variable must not be set in ebuilds.
+
+# @ECLASS_VARIABLE: ERUST_TYPE_OVERRIDE
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Specify the type of Rust to be used by the package from options:
+# 'source' or 'binary' (-bin). This is useful for troubleshooting and
+# debugging purposes. If unset, the standard eclass logic will be used
+# to determine the type of Rust to use (i.e. prefer source if binary
+# is also available). May be combined with ERUST_SLOT_OVERRIDE.
+# This variable must not be set in ebuilds.
+
# == control variables ==
# @ECLASS_VARIABLE: RUST_MAX_VER
@@ -336,6 +356,10 @@ _get_rust_slot() {
fi
fi
+ if [[ -n "${ERUST_SLOT_OVERRIDE}" && "${slot}" != "${ERUST_SLOT_OVERRIDE}" ]]; then
+ continue
+ fi
+
# If we're in LLVM mode we can skip any slots that don't match the selected USE
if [[ -n "${RUST_NEEDS_LLVM}" ]]; then
if [[ "${llvm_slot}" != "${llvm_r1_slot}" ]]; then
@@ -349,12 +373,27 @@ _get_rust_slot() {
rust_check_deps && return
else
local usedep="${RUST_REQ_USE+[${RUST_REQ_USE}]}"
- # When checking for installed packages prefer the non `-bin` package
+ # When checking for installed packages prefer the source package;
# if effort was put into building it we should use it.
- local rust_pkgs=(
- "dev-lang/rust:${slot}${usedep}"
- "dev-lang/rust-bin:${slot}${usedep}"
- )
+ local rust_pkgs
+ case "${ERUST_TYPE_OVERRIDE}" in
+ source)
+ rust_pkgs=(
+ "dev-lang/rust:${slot}${usedep}"
+ )
+ ;;
+ binary)
+ rust_pkgs=(
+ "dev-lang/rust-bin:${slot}${usedep}"
+ )
+ ;;
+ *)
+ rust_pkgs=(
+ "dev-lang/rust:${slot}${usedep}"
+ "dev-lang/rust-bin:${slot}${usedep}"
+ )
+ ;;
+ esac
local _pkg
for _pkg in "${rust_pkgs[@]}"; do
if has_version "${hv_switch}" "${_pkg}"; then