Fix distutils-r1 phase functions to correctly pass through the return
value from the subphases. This fixes e.g. the mistake of virtx
not failing in the following case:
src_test() {
virtx distutils-r1_src_test
}
python_test() {
epytest
}
This is because virtx implicitly uses nonfatal and epytest uses
`die -n`. However, since the return value was not passed through, virtx
never knew that anything has failed.
While this covers only trivial cases and this is better solved via dying explicitly in the redefined python_test(), there's no harm in adding
this passthrough.
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 48 ++++++++++++++++++++++++++------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index a81d95f4eb6e..8942a6149c93 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1319,8 +1319,10 @@ distutils-r1_run_phase() {
local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}"
"${@}"
+ local ret=${?}
cd "${_DISTUTILS_INITIAL_CWD}" || die
+ return "${ret}"
}
# @FUNCTION: _distutils-r1_run_common_phase
@@ -1378,14 +1380,14 @@ _distutils-r1_run_foreach_impl() {
distutils-r1_src_prepare() {
debug-print-function ${FUNCNAME} "${@}"
-
+ local ret=0
local _DISTUTILS_DEFAULT_CALLED
# common preparations
if declare -f python_prepare_all >/dev/null; then
- python_prepare_all
+ python_prepare_all || ret=${?}
else
- distutils-r1_python_prepare_all
+ distutils-r1_python_prepare_all || ret=${?}
fi
if [[ ! ${_DISTUTIL