commit:     bc3e1df73bf55eeba8c113ca42f87e981866b1e0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  1 08:57:12 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Mar  8 07:35:48 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc3e1df7

python-r1.eclass: Add integrity checks for globals

 eclass/python-r1.eclass | 42 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 856f7554dd5..df57cf1e132 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -51,6 +51,8 @@ fi
 [[ ${EAPI} == [45] ]] && inherit eutils
 inherit multibuild python-utils-r1
 
+fi
+
 # @ECLASS-VARIABLE: PYTHON_COMPAT
 # @REQUIRED
 # @DESCRIPTION:
@@ -198,15 +200,45 @@ _python_set_globals() {
                deps+=">=dev-lang/python-exec-2:=[${usedep}]"
        fi
 
-       PYTHON_DEPS=${deps}
-       IUSE=${flags[*]}
-       PYTHON_REQUIRED_USE=${requse}
-       PYTHON_USEDEP=${usedep}
-       readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
+       if [[ ${PYTHON_DEPS+1} ]]; then
+               # IUSE is magical, so we can't really check it
+               # (but we verify PYTHON_COMPAT already)
+
+               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
+
+               # these two are formality -- they depend on PYTHON_COMPAT only
+               if [[ ${PYTHON_REQUIRED_USE} != ${requse} ]]; then
+                       eerror "PYTHON_REQUIRED_USE have changed between 
inherits!"
+                       eerror "Before: ${PYTHON_REQUIRED_USE}"
+                       eerror "Now   : ${requse}"
+                       die "PYTHON_REQUIRED_USE integrity check failed"
+               fi
+
+               if [[ ${PYTHON_USEDEP} != "${usedep}" ]]; then
+                       eerror "PYTHON_USEDEP have changed between inherits!"
+                       eerror "Before: ${PYTHON_USEDEP}"
+                       eerror "Now   : ${usedep}"
+                       die "PYTHON_USEDEP integrity check failed"
+               fi
+       else
+               IUSE=${flags[*]}
+
+               PYTHON_DEPS=${deps}
+               PYTHON_REQUIRED_USE=${requse}
+               PYTHON_USEDEP=${usedep}
+               readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
+       fi
 }
 _python_set_globals
 unset -f _python_set_globals
 
+if [[ ! ${_PYTHON_R1} ]]; then
+
 # @FUNCTION: _python_validate_useflags
 # @INTERNAL
 # @DESCRIPTION:

Reply via email to