From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 632C51384B4 for ; Fri, 1 Jan 2016 16:48:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4309E21C0EE; Fri, 1 Jan 2016 16:41:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1D98F21C0E3 for ; Fri, 1 Jan 2016 16:41:52 +0000 (UTC) Received: from localhost.localdomain (d202-251.icpnet.pl [109.173.202.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id CFD60340A3B; Fri, 1 Jan 2016 16:41:50 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 11/15] scons-utils.eclass: _scons_clean_makeopts, fix result caching Date: Fri, 1 Jan 2016 17:41:17 +0100 Message-Id: <1451666481-22145-12-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1451666481-22145-1-git-send-email-mgorny@gentoo.org> References: <1451666481-22145-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: c76d882a-8be5-462f-8068-66b81ef2cbb6 X-Archives-Hash: d8ad4623b171d7d74e7a40ea83eb5a1e Stop calling _scons_clean_makeopts in a subshell in order to make it possible for the cache to be preserved. Pass the result through SCONSOPTS variable. --- eclass/scons-utils.eclass | 15 +++++++++------ eclass/tests/scons-utils.sh | 7 ++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass index e5e309b..4da2c4a 100644 --- a/eclass/scons-utils.eclass +++ b/eclass/scons-utils.eclass @@ -124,8 +124,12 @@ escons() { fi # if SCONSOPTS are _unset_, use cleaned MAKEOPTS - set -- scons ${SCONSOPTS-$(_scons_clean_makeopts)} ${EXTRA_ESCONS} \ - "${@}" + if [[ ! ${SCONSOPTS+set} ]]; then + local SCONSOPTS + _scons_clean_makeopts + fi + + set -- scons ${SCONSOPTS} ${EXTRA_ESCONS} "${@}" echo "${@}" >&2 "${@}" ret=${?} @@ -169,9 +173,8 @@ _scons_clean_makeopts() { # empty MAKEOPTS give out empty SCONSOPTS # thus, we do need to worry about the initial setup if [[ ${*} = ${_SCONS_CACHE_MAKEOPTS} ]]; then - set -- ${_SCONS_CACHE_SCONSOPTS} - debug-print "Cache hit: [${*}]" - echo ${*} + SCONSOPTS=${_SCONS_CACHE_SCONSOPTS} + debug-print "Cache hit: [${SCONSOPTS}]" return fi export _SCONS_CACHE_MAKEOPTS=${*} @@ -235,7 +238,7 @@ _scons_clean_makeopts() { set -- ${new_makeopts} export _SCONS_CACHE_SCONSOPTS=${*} debug-print "New SCONSOPTS: [${*}]" - echo ${*} + SCONSOPTS=${*} } # @FUNCTION: use_scons diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh index df8af7a..6355c54 100755 --- a/eclass/tests/scons-utils.sh +++ b/eclass/tests/scons-utils.sh @@ -10,14 +10,15 @@ inherit scons-utils test-scons_clean_makeopts() { tbegin "scons_clean_makeopts() for ${1}" - local sconsopts=$(_scons_clean_makeopts ${1}) ret=0 + local SCONSOPTS ret=0 + _scons_clean_makeopts ${1} - if [[ ${sconsopts} != ${2-${1}} ]]; then + if [[ ${SCONSOPTS} != ${2-${1}} ]]; then eerror "Self-test failed:" eindent eerror "MAKEOPTS: ${1}" eerror "Expected: ${2-${1}}" - eerror "Actual: ${sconsopts}" + eerror "Actual: ${SCONSOPTS}" eoutdent ret=1 fi -- 2.6.4