commit:     80d2c435a58d88cfe71f37378bffae35e072408f
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 17:21:05 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 01:01:35 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=80d2c435

Allow EPREFIX to be overridden for manipulating prefixed ROOT

This use case was totally broken. We need to hardcode BROOT instead, as
we don't want to source /lib/gentoo/functions.sh from ROOT

We did the same with gcc-config. This aligns the start of these scripts.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 src/binutils-config | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/binutils-config b/src/binutils-config
index 4219f93..37ea77c 100755
--- a/src/binutils-config
+++ b/src/binutils-config
@@ -1,28 +1,25 @@
 #!/usr/bin/env bash
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Format of /etc/env.d/binutils/:
 #  config-TARGET:      CURRENT=version for TARGET
 #  TARGET-VER:         has a TARGET and VER variable
 
-EPREFIX="@GENTOO_EPREFIX@"
-if [[ ${EPREFIX} == "@"GENTOO_EPREFIX"@" ]] ; then
-       EPREFIX=""
-fi
-
 : ${ROOT:=/}
 [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
 [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
-
+BROOT="@GENTOO_EPREFIX@"
+[[ ${BROOT} == @*@ ]] && BROOT=""
+: ${EPREFIX="${BROOT}"}
 EROOT="${ROOT%/}${EPREFIX}/"
 
-cd "${EPREFIX}/"
+cd "${BROOT}/"
 
 trap ":" INT QUIT TSTP
 
 argv0=${0##*/}
-FUNCTIONS_SH="${EPREFIX}/lib/gentoo/functions.sh"
+FUNCTIONS_SH="${BROOT}/lib/gentoo/functions.sh"
 source ${FUNCTIONS_SH} || {
        echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
        exit 1

Reply via email to