From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id ACEE1138334 for ; Sun, 8 Sep 2019 08:37:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D7F91E08DC; Sun, 8 Sep 2019 08:37:30 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BAB6EE08DC for ; Sun, 8 Sep 2019 08:37:30 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EA2C434AE83 for ; Sun, 8 Sep 2019 08:37:29 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6AE52744 for ; Sun, 8 Sep 2019 08:37:28 +0000 (UTC) From: "Sergei Trofimovich" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" Message-ID: <1567931751.84ba7d0ccde1869bed07f9d9b9c2fac09f48c13a.slyfox@gentoo> Subject: [gentoo-commits] proj/gcc-config:master commit in: / X-VCS-Repository: proj/gcc-config X-VCS-Files: gcc-config X-VCS-Directories: / X-VCS-Committer: slyfox X-VCS-Committer-Name: Sergei Trofimovich X-VCS-Revision: 84ba7d0ccde1869bed07f9d9b9c2fac09f48c13a X-VCS-Branch: master Date: Sun, 8 Sep 2019 08:37:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fd05852c-0d42-4b18-b8fb-3a001111c42a X-Archives-Hash: 0d47034d9c1bba74408f899da6c6b2dd commit: 84ba7d0ccde1869bed07f9d9b9c2fac09f48c13a Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Sep 8 08:35:51 2019 +0000 Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Sep 8 08:35:51 2019 +0000 URL: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=84ba7d0c gcc-config: consolidate profiles sourcing logic in a single function Bug: https://bugs.gentoo.org/174422 Signed-off-by: Sergei Trofimovich gentoo.org> gcc-config | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/gcc-config b/gcc-config index 9965449..dd11c71 100755 --- a/gcc-config +++ b/gcc-config @@ -80,16 +80,15 @@ show_var() { echo "${!1}" } -# Compatibility with profile files created before 2019-09-05. -# These profile files were setting PATH variable. -# Sourcing them without restoring previous PATH value breaks gcc-config. -source_profile_pre() { - __PATH__=${PATH} -} +source_profile() { + # Compatibility with profile files created before 2019-09-05. + # These profile files were setting PATH variable. + # Sourcing them without restoring previous PATH value breaks gcc-config. + local backup_PATH=${PATH} + + source "$1" -source_profile_post() { - PATH=${__PATH__} - unset __PATH__ + PATH=${backup_PATH} } try_real_hard_to_find_CHOST() { @@ -545,9 +544,7 @@ prefix_copy_gcc_libs() { for x in ${GCC_PROFILES} ; do unset GCC_PATH LDPATH eval $( - source_profile_pre - source "${x}" - source_profile_post + source_profile "${x}" echo "GCC_PATH='${GCC_PATH}'" echo "LDPATH='${LDPATH%%:*}'" ) @@ -613,9 +610,7 @@ switch_profile() { # Setup things properly again for this profile unset GCC_SPECS LDPATH MULTIOSDIRS - source_profile_pre - source "${GCC_ENV_D}/${CC_COMP}" - source_profile_post + source_profile "${GCC_ENV_D}/${CC_COMP}" # Support older configs that did not setup MULTIOSDIRS for us. : ${MULTIOSDIRS:=../${GENTOO_LIBDIR}} @@ -830,9 +825,7 @@ list_profiles() { if [[ ${x} == ${CURRENT_NATIVE} ]] ; then x="${x} ${GOOD}*${NORMAL}" elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then - source_profile_pre - source "${GCC_ENV_D}/config-${target}" - source_profile_post + source_profile "${GCC_ENV_D}/config-${target}" [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}" fi echo " [${i}] ${x}"