commit: de0c03eda7a5570984491fe6fc2e4959b36ce128
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 1 12:55:26 2016 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 05:14:36 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de0c03ed
scons-utils.eclass: _scons_clean_makeopts, fix result caching
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