summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-01-01 13:55:26 +0100
committerMichał Górny <mgorny@gentoo.org>2016-01-08 06:14:36 +0100
commitde0c03eda7a5570984491fe6fc2e4959b36ce128 (patch)
treecca9467c1cef6a7585c02560a71ac4b75f523724 /eclass
parentscons-utils.eclass: scons_clean_makeopts, mark internal (diff)
downloadgentoo-de0c03eda7a5570984491fe6fc2e4959b36ce128.tar.gz
gentoo-de0c03eda7a5570984491fe6fc2e4959b36ce128.tar.bz2
gentoo-de0c03eda7a5570984491fe6fc2e4959b36ce128.zip
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.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/scons-utils.eclass15
-rwxr-xr-xeclass/tests/scons-utils.sh7
2 files changed, 13 insertions, 9 deletions
diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass
index e5e309be13c4..4da2c4ac7a5c 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 df8af7a7713c..6355c54517db 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