summaryrefslogtreecommitdiff
path: root/eclass/rust.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/rust.eclass')
-rw-r--r--eclass/rust.eclass21
1 files changed, 16 insertions, 5 deletions
diff --git a/eclass/rust.eclass b/eclass/rust.eclass
index eb14ca2329b5..a7199f984af8 100644
--- a/eclass/rust.eclass
+++ b/eclass/rust.eclass
@@ -286,7 +286,8 @@ unset -f _rust_set_globals
# @USAGE: [-b|-d]
# @DESCRIPTION:
# Find the newest Rust install that is acceptable for the package,
-# and print its version number (i.e. SLOT) and type (source or bin[ary]).
+# and export its version (i.e. SLOT) and type (source or bin[ary])
+# as RUST_SLOT and RUST_TYPE.
#
# If -b is specified, the checks are performed relative to BROOT,
# and BROOT-path is returned. -b is the default.
@@ -363,10 +364,13 @@ _get_rust_slot() {
# 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
+ einfo "Skipping Rust ${slot} as it does not match llvm_slot_${llvm_r1_slot}"
continue
fi
fi
+ einfo "Checking whether Rust ${slot} is suitable ..."
+
if declare -f rust_check_deps >/dev/null; then
local RUST_SLOT="${slot}"
local LLVM_SLOT="${_RUST_LLVM_MAP[${slot}]}"
@@ -396,11 +400,13 @@ _get_rust_slot() {
esac
local _pkg
for _pkg in "${rust_pkgs[@]}"; do
+ einfo " Checking for ${_pkg} ..."
if has_version "${hv_switch}" "${_pkg}"; then
+ export RUST_SLOT="${slot}"
if [[ "${_pkg}" == "dev-lang/rust:${slot}${usedep}" ]]; then
- echo "${slot} source"
+ export RUST_TYPE="source"
else
- echo "${slot} binary"
+ export RUST_TYPE="binary"
fi
return
fi
@@ -418,7 +424,12 @@ _get_rust_slot() {
die "${FUNCNAME}: invalid max_slot=${max_slot}"
fi
- die "No Rust slot${1:+ <= ${1}} satisfying the package's dependencies found installed!"
+ local requirement_msg=""
+ [[ -n "${RUST_MAX_VER}" ]] && requirement_msg+="<= ${RUST_MAX_VER} "
+ [[ -n "${RUST_MIN_VER}" ]] && requirement_msg+=">= ${RUST_MIN_VER} "
+ [[ -n "${RUST_REQ_USE}" ]] && requirement_msg+="with USE=${RUST_REQ_USE}"
+ requirement_msg="${requirement_msg% }"
+ die "No Rust matching requirements${requirement_msg:+ (${requirement_msg})} found installed!"
}
# @FUNCTION: get_rust_path
@@ -500,7 +511,7 @@ rust_pkg_setup() {
debug-print-function ${FUNCNAME} "$@"
if [[ ${MERGE_TYPE} != binary ]]; then
- read -r RUST_SLOT RUST_TYPE <<< $(_get_rust_slot -b)
+ _get_rust_slot -b
rust_prepend_path "${RUST_SLOT}" "${RUST_TYPE}"
local prefix=$(get_rust_path "${BROOT}" "${RUST_SLOT}" "${RUST_TYPE}")
CARGO="${prefix}bin/cargo"