Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 10/10] python-single-r1.eclass: Add integrity checks for globals
Date: Wed, 01 Mar 2017 16:11:47
Message-Id: 20170301160249.11287-11-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] python-r1, add integrity checks for redefined control vars by "Michał Górny"
1 ---
2 eclass/python-single-r1.eclass | 36 ++++++++++++++++++++++++++++++------
3 1 file changed, 30 insertions(+), 6 deletions(-)
4
5 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
6 index 85350924b657..fc51c4ec2377 100644
7 --- a/eclass/python-single-r1.eclass
8 +++ b/eclass/python-single-r1.eclass
9 @@ -56,8 +56,6 @@ fi
10
11 EXPORT_FUNCTIONS pkg_setup
12
13 -if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
14 -
15 # @ECLASS-VARIABLE: PYTHON_COMPAT
16 # @REQUIRED
17 # @DESCRIPTION:
18 @@ -232,14 +230,40 @@ _python_single_set_globals() {
19 deps+=">=dev-lang/python-exec-2:=[${usedep}]"
20 fi
21
22 - PYTHON_DEPS=${deps}
23 - PYTHON_REQUIRED_USE=${requse}
24 - PYTHON_USEDEP=${usedep}
25 - readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
26 + if [[ ${PYTHON_DEPS+1} ]]; then
27 + if [[ ${PYTHON_DEPS} != "${deps}" ]]; then
28 + eerror "PYTHON_DEPS have changed between inherits (PYTHON_REQ_USE?)!"
29 + eerror "Before: ${PYTHON_DEPS}"
30 + eerror "Now : ${deps}"
31 + die "PYTHON_DEPS integrity check failed"
32 + fi
33 +
34 + # these two are formality -- they depend on PYTHON_COMPAT only
35 + if [[ ${PYTHON_REQUIRED_USE} != ${requse} ]]; then
36 + eerror "PYTHON_REQUIRED_USE have changed between inherits!"
37 + eerror "Before: ${PYTHON_REQUIRED_USE}"
38 + eerror "Now : ${requse}"
39 + die "PYTHON_REQUIRED_USE integrity check failed"
40 + fi
41 +
42 + if [[ ${PYTHON_USEDEP} != "${usedep}" ]]; then
43 + eerror "PYTHON_USEDEP have changed between inherits!"
44 + eerror "Before: ${PYTHON_USEDEP}"
45 + eerror "Now : ${usedep}"
46 + die "PYTHON_USEDEP integrity check failed"
47 + fi
48 + else
49 + PYTHON_DEPS=${deps}
50 + PYTHON_REQUIRED_USE=${requse}
51 + PYTHON_USEDEP=${usedep}
52 + readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
53 + fi
54 }
55 _python_single_set_globals
56 unset -f _python_single_set_globals
57
58 +if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
59 +
60 # @FUNCTION: python_gen_usedep
61 # @USAGE: <pattern> [...]
62 # @DESCRIPTION:
63 --
64 2.12.0