1 |
commit: e3b5ea37be7166d069741ea2c62b200b3918a779 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 30 11:33:52 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 1 18:33:18 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3b5ea37 |
7 |
|
8 |
distutils-r1.eclass: Fix subphase return value passthrough |
9 |
|
10 |
Fix distutils-r1 phase functions to correctly pass through the return |
11 |
value from the subphases. This fixes e.g. the mistake of virtx |
12 |
not failing in the following case: |
13 |
|
14 |
src_test() { |
15 |
virtx distutils-r1_src_test |
16 |
} |
17 |
|
18 |
python_test() { |
19 |
epytest |
20 |
} |
21 |
|
22 |
This is because virtx implicitly uses nonfatal and epytest uses |
23 |
`die -n`. However, since the return value was not passed through, virtx |
24 |
never knew that anything has failed. |
25 |
|
26 |
While this covers only trivial cases and this is better solved via dying |
27 |
explicitly in the redefined python_test(), there's no harm in adding |
28 |
this passthrough. |
29 |
|
30 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
31 |
|
32 |
eclass/distutils-r1.eclass | 48 +++++++++++++++++++++++++++++++--------------- |
33 |
1 file changed, 33 insertions(+), 15 deletions(-) |
34 |
|
35 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
36 |
index a81d95f4eb6e..8942a6149c93 100644 |
37 |
--- a/eclass/distutils-r1.eclass |
38 |
+++ b/eclass/distutils-r1.eclass |
39 |
@@ -1319,8 +1319,10 @@ distutils-r1_run_phase() { |
40 |
local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}" |
41 |
|
42 |
"${@}" |
43 |
+ local ret=${?} |
44 |
|
45 |
cd "${_DISTUTILS_INITIAL_CWD}" || die |
46 |
+ return "${ret}" |
47 |
} |
48 |
|
49 |
# @FUNCTION: _distutils-r1_run_common_phase |
50 |
@@ -1378,14 +1380,14 @@ _distutils-r1_run_foreach_impl() { |
51 |
|
52 |
distutils-r1_src_prepare() { |
53 |
debug-print-function ${FUNCNAME} "${@}" |
54 |
- |
55 |
+ local ret=0 |
56 |
local _DISTUTILS_DEFAULT_CALLED |
57 |
|
58 |
# common preparations |
59 |
if declare -f python_prepare_all >/dev/null; then |
60 |
- python_prepare_all |
61 |
+ python_prepare_all || ret=${?} |
62 |
else |
63 |
- distutils-r1_python_prepare_all |
64 |
+ distutils-r1_python_prepare_all || ret=${?} |
65 |
fi |
66 |
|
67 |
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then |
68 |
@@ -1393,35 +1395,45 @@ distutils-r1_src_prepare() { |
69 |
fi |
70 |
|
71 |
if declare -f python_prepare >/dev/null; then |
72 |
- _distutils-r1_run_foreach_impl python_prepare |
73 |
+ _distutils-r1_run_foreach_impl python_prepare || ret=${?} |
74 |
fi |
75 |
+ |
76 |
+ return ${ret} |
77 |
} |
78 |
|
79 |
distutils-r1_src_configure() { |
80 |
+ debug-print-function ${FUNCNAME} "${@}" |
81 |
+ local ret=0 |
82 |
+ |
83 |
python_export_utf8_locale |
84 |
[[ ${EAPI} == 6 ]] && xdg_environment_reset # Bug 577704 |
85 |
|
86 |
if declare -f python_configure >/dev/null; then |
87 |
- _distutils-r1_run_foreach_impl python_configure |
88 |
+ _distutils-r1_run_foreach_impl python_configure || ret=${?} |
89 |
fi |
90 |
|
91 |
if declare -f python_configure_all >/dev/null; then |
92 |
- _distutils-r1_run_common_phase python_configure_all |
93 |
+ _distutils-r1_run_common_phase python_configure_all || ret=${?} |
94 |
fi |
95 |
+ |
96 |
+ return ${ret} |
97 |
} |
98 |
|
99 |
distutils-r1_src_compile() { |
100 |
debug-print-function ${FUNCNAME} "${@}" |
101 |
+ local ret=0 |
102 |
|
103 |
if declare -f python_compile >/dev/null; then |
104 |
- _distutils-r1_run_foreach_impl python_compile |
105 |
+ _distutils-r1_run_foreach_impl python_compile || ret=${?} |
106 |
else |
107 |
- _distutils-r1_run_foreach_impl distutils-r1_python_compile |
108 |
+ _distutils-r1_run_foreach_impl distutils-r1_python_compile || ret=${?} |
109 |
fi |
110 |
|
111 |
if declare -f python_compile_all >/dev/null; then |
112 |
- _distutils-r1_run_common_phase python_compile_all |
113 |
+ _distutils-r1_run_common_phase python_compile_all || ret=${?} |
114 |
fi |
115 |
+ |
116 |
+ return ${ret} |
117 |
} |
118 |
|
119 |
# @FUNCTION: _distutils-r1_clean_egg_info |
120 |
@@ -1440,17 +1452,20 @@ _distutils-r1_clean_egg_info() { |
121 |
|
122 |
distutils-r1_src_test() { |
123 |
debug-print-function ${FUNCNAME} "${@}" |
124 |
+ local ret=0 |
125 |
|
126 |
if declare -f python_test >/dev/null; then |
127 |
- _distutils-r1_run_foreach_impl python_test |
128 |
+ _distutils-r1_run_foreach_impl python_test || ret=${?} |
129 |
if [[ ! ${DISTUTILS_USE_PEP517} ]]; then |
130 |
_distutils-r1_run_foreach_impl _distutils-r1_clean_egg_info |
131 |
fi |
132 |
fi |
133 |
|
134 |
if declare -f python_test_all >/dev/null; then |
135 |
- _distutils-r1_run_common_phase python_test_all |
136 |
+ _distutils-r1_run_common_phase python_test_all || ret=${?} |
137 |
fi |
138 |
+ |
139 |
+ return ${ret} |
140 |
} |
141 |
|
142 |
# @FUNCTION: _distutils-r1_check_namespace_pth |
143 |
@@ -1482,20 +1497,23 @@ _distutils-r1_check_namespace_pth() { |
144 |
|
145 |
distutils-r1_src_install() { |
146 |
debug-print-function ${FUNCNAME} "${@}" |
147 |
+ local ret=0 |
148 |
|
149 |
if declare -f python_install >/dev/null; then |
150 |
- _distutils-r1_run_foreach_impl python_install |
151 |
+ _distutils-r1_run_foreach_impl python_install || ret=${?} |
152 |
else |
153 |
- _distutils-r1_run_foreach_impl distutils-r1_python_install |
154 |
+ _distutils-r1_run_foreach_impl distutils-r1_python_install || ret=${?} |
155 |
fi |
156 |
|
157 |
if declare -f python_install_all >/dev/null; then |
158 |
- _distutils-r1_run_common_phase python_install_all |
159 |
+ _distutils-r1_run_common_phase python_install_all || ret=${?} |
160 |
else |
161 |
- _distutils-r1_run_common_phase distutils-r1_python_install_all |
162 |
+ _distutils-r1_run_common_phase distutils-r1_python_install_all || ret=${?} |
163 |
fi |
164 |
|
165 |
_distutils-r1_check_namespace_pth |
166 |
+ |
167 |
+ return ${ret} |
168 |
} |
169 |
|
170 |
_DISTUTILS_R1=1 |