commit:     f8b206fd6688628bd9bbb2f2c5e3d3eb627d76dc
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 01:33:50 2024 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 06:14:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8b206fd

rust.eclass: cross compile fixes

Change _get_rust_slot to default to -b/BROOT.
Reuse _get_rust_slot result in pkg_setup.
Pass along arguments from get_rust_prefix to _get_rust_slot.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/39298
Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 eclass/rust.eclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/eclass/rust.eclass b/eclass/rust.eclass
index 3a8a93718787..f293e96d7ce8 100644
--- a/eclass/rust.eclass
+++ b/eclass/rust.eclass
@@ -259,10 +259,10 @@ unset -f _rust_set_globals
 # and print its version number (i.e. SLOT) and type (source or bin[ary]).
 #
 # If -b is specified, the checks are performed relative to BROOT,
-# and BROOT-path is returned.
+# and BROOT-path is returned. -b is the default.
 #
 # If -d is specified, the checks are performed relative to ESYSROOT,
-# and ESYSROOT-path is returned. -d is the default.
+# and ESYSROOT-path is returned.
 #
 # If RUST_M{AX,IN}_SLOT is non-zero, then only Rust versions that
 # are not newer or older than the specified slot(s) will be considered.
@@ -278,7 +278,7 @@ unset -f _rust_set_globals
 _get_rust_slot() {
        debug-print-function ${FUNCNAME} "$@"
 
-       local hv_switch=-d
+       local hv_switch=-b
        while [[ ${1} == -* ]]; do
                case ${1} in
                        -b|-d) hv_switch="${1}";;
@@ -412,7 +412,7 @@ get_rust_prefix() {
        [[ ${1} == -d ]] && prefix=${ESYSROOT}
 
        local slot rust_type
-       read -r slot rust_type <<< $(_get_rust_slot)
+       read -r slot rust_type <<< $(_get_rust_slot "$@")
        get_rust_path "${prefix}" "${slot}" "${rust_type}"
 }
 
@@ -451,9 +451,9 @@ rust_pkg_setup() {
        debug-print-function ${FUNCNAME} "$@"
 
        if [[ ${MERGE_TYPE} != binary ]]; then
-               read -r RUST_SLOT RUST_TYPE <<< $(_get_rust_slot)
+               read -r RUST_SLOT RUST_TYPE <<< $(_get_rust_slot -b)
                rust_prepend_path "${RUST_SLOT}" "${RUST_TYPE}"
-               local prefix=$(get_rust_prefix)
+               local prefix=$(get_rust_path "${BROOT}" "${RUST_SLOT}" 
"${RUST_TYPE}")
                CARGO="${prefix}bin/cargo"
                RUSTC="${prefix}bin/rustc"
                export CARGO RUSTC

Reply via email to