1 |
commit: d2fb3f82e9c4ea1626eb465b153ccd1e8c5b2c9e |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 1 08:20:12 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 8 07:35:43 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2fb3f82 |
7 |
|
8 |
python-utils-r1.eclass: _python_set_impls, add integrity check |
9 |
|
10 |
Add integrity check for multi-inherits, i.e. ensure that PYTHON_COMPAT |
11 |
has not changed between successive calls to _python_set_impls. If it did |
12 |
(e.g. because of eclass+ebuild setting different values), then we abort |
13 |
not to give surprising results to the user. |
14 |
|
15 |
eclass/python-utils-r1.eclass | 22 +++++++++++++++++++--- |
16 |
1 file changed, 19 insertions(+), 3 deletions(-) |
17 |
|
18 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
19 |
index a6f197bd418..c75c4678e31 100644 |
20 |
--- a/eclass/python-utils-r1.eclass |
21 |
+++ b/eclass/python-utils-r1.eclass |
22 |
@@ -128,9 +128,25 @@ _python_set_impls() { |
23 |
die "No supported implementation in PYTHON_COMPAT." |
24 |
fi |
25 |
|
26 |
- _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" ) |
27 |
- _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" ) |
28 |
- readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS |
29 |
+ if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then |
30 |
+ # set once already, verify integrity |
31 |
+ if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then |
32 |
+ eerror "Supported impls (PYTHON_COMPAT) changed between inherits!" |
33 |
+ eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}" |
34 |
+ eerror "Now : ${supp[*]}" |
35 |
+ die "_PYTHON_SUPPORTED_IMPLS integrity check failed" |
36 |
+ fi |
37 |
+ if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then |
38 |
+ eerror "Unsupported impls changed between inherits!" |
39 |
+ eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}" |
40 |
+ eerror "Now : ${unsupp[*]}" |
41 |
+ die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed" |
42 |
+ fi |
43 |
+ else |
44 |
+ _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" ) |
45 |
+ _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" ) |
46 |
+ readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS |
47 |
+ fi |
48 |
} |
49 |
|
50 |
# @ECLASS-VARIABLE: PYTHON |