summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-03-01 09:20:12 +0100
committerMichał Górny <mgorny@gentoo.org>2017-03-08 08:35:43 +0100
commitd2fb3f82e9c4ea1626eb465b153ccd1e8c5b2c9e (patch)
tree8de03cd6f27e36ae95c446d85f23e7f63ef9a798 /eclass
parentpython-utils-r1.eclass: _python_set_impls, use local vars (diff)
downloadgentoo-d2fb3f82e9c4ea1626eb465b153ccd1e8c5b2c9e.tar.gz
gentoo-d2fb3f82e9c4ea1626eb465b153ccd1e8c5b2c9e.tar.bz2
gentoo-d2fb3f82e9c4ea1626eb465b153ccd1e8c5b2c9e.zip
python-utils-r1.eclass: _python_set_impls, add integrity check
Add integrity check for multi-inherits, i.e. ensure that PYTHON_COMPAT has not changed between successive calls to _python_set_impls. If it did (e.g. because of eclass+ebuild setting different values), then we abort not to give surprising results to the user.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass22
1 files changed, 19 insertions, 3 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a6f197bd418f..c75c4678e310 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -128,9 +128,25 @@ _python_set_impls() {
die "No supported implementation in PYTHON_COMPAT."
fi
- _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
- _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
- readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
+ if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
+ # set once already, verify integrity
+ if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
+ eerror "Supported impls (PYTHON_COMPAT) changed between inherits!"
+ eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}"
+ eerror "Now : ${supp[*]}"
+ die "_PYTHON_SUPPORTED_IMPLS integrity check failed"
+ fi
+ if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
+ eerror "Unsupported impls changed between inherits!"
+ eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}"
+ eerror "Now : ${unsupp[*]}"
+ die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed"
+ fi
+ else
+ _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
+ _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
+ readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
+ fi
}
# @ECLASS-VARIABLE: PYTHON