aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-05-14 17:45:32 +0200
committerSam James <sam@gentoo.org>2023-05-14 18:24:32 +0100
commit6d83aec7a8d26035d81b1cafdf007135aa4ea094 (patch)
tree3b7a16571eb74c5c79062b169f137a24fc611326
parentgcc-config: Add missing terminating quote for 'backing up' path message (diff)
downloadgcc-config-6d83aec7a8d26035d81b1cafdf007135aa4ea094.tar.gz
gcc-config-6d83aec7a8d26035d81b1cafdf007135aa4ea094.tar.bz2
gcc-config-6d83aec7a8d26035d81b1cafdf007135aa4ea094.zip
gcc-config: Don't call portageq if the variable is already setv2.11
Bug: https://bugs.gentoo.org/906329 Acked-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org> Closes: https://github.com/gentoo/gcc-config/pull/3 Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-xgcc-config9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc-config b/gcc-config
index 80951b4..404ab29 100755
--- a/gcc-config
+++ b/gcc-config
@@ -42,9 +42,10 @@ fi
PV="@PV@"
[[ ${PV} == @*@ ]] && PV="git"
-ABI=$(portageq envvar DEFAULT_ABI 2>/dev/null)
-GENTOO_LIBDIR=$(portageq envvar LIBDIR_"${ABI}" 2>/dev/null)
-[[ $? != 0 || -z ${GENTOO_LIBDIR} ]] && GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+ABI=${DEFAULT_ABI:-$(portageq envvar DEFAULT_ABI 2>/dev/null)}
+LIBDIR_VAR=LIBDIR_${ABI}
+GENTOO_LIBDIR=${!LIBDIR_VAR:-$(portageq envvar "${LIBDIR_VAR}" 2>/dev/null)}
+[[ $? -ne 0 || -z ${GENTOO_LIBDIR} ]] && GENTOO_LIBDIR="@GENTOO_LIBDIR@"
[[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
usage() {
@@ -166,7 +167,7 @@ get_chost() {
# Make sure Portage isn't broken.
CHOST=$(portageq envvar CHOST 2>/dev/null)
- if [[ $? != 0 || -z ${CHOST} ]] ; then
+ if [[ $? -ne 0 || -z ${CHOST} ]] ; then
ewarn "Python or Portage seems to be broken, attempting to locate CHOST ourselves ..."
CHOST=$(try_real_hard_to_find_CHOST)
fi