python-any-r1.eclass: Add integrity check for globals
authorMichał Górny <mgorny@gentoo.org>
Wed, 1 Mar 2017 08:27:20 +0000 (09:27 +0100)
committerMichał Górny <mgorny@gentoo.org>
Wed, 8 Mar 2017 07:35:45 +0000 (08:35 +0100)
eclass/python-any-r1.eclass

index d41cf6a5808dbd8f3fde94fc7fb32f922da4ac64..69f7bb736d225b94ebb14b76dd96412f3965e144 100644 (file)
@@ -57,8 +57,6 @@ fi
 
 EXPORT_FUNCTIONS pkg_setup
 
-if [[ ! ${_PYTHON_ANY_R1} ]]; then
-
 # @ECLASS-VARIABLE: PYTHON_COMPAT
 # @REQUIRED
 # @DESCRIPTION:
@@ -161,12 +159,23 @@ _python_any_set_globals() {
        done
        deps="|| ( ${deps})"
 
-       PYTHON_DEPS=${deps}
-       readonly PYTHON_DEPS
+       if [[ ${PYTHON_DEPS+1} ]]; then
+               if [[ ${PYTHON_DEPS} != "${deps}" ]]; then
+                       eerror "PYTHON_DEPS have changed between inherits (PYTHON_REQ_USE?)!"
+                       eerror "Before: ${PYTHON_DEPS}"
+                       eerror "Now   : ${deps}"
+                       die "PYTHON_DEPS integrity check failed"
+               fi
+       else
+               PYTHON_DEPS=${deps}
+               readonly PYTHON_DEPS
+       fi
 }
 _python_any_set_globals
 unset -f _python_any_set_globals
 
+if [[ ! ${_PYTHON_ANY_R1} ]]; then
+
 # @FUNCTION: python_gen_any_dep
 # @USAGE: <dependency-block>
 # @DESCRIPTION: