1 |
commit: ad607b8ecfad3e099cae508ff4d3b5b62cab969f |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 17 11:08:21 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 17 20:12:32 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad607b8e |
7 |
|
8 |
config: default features USE for conditional RESTRICT (bug 663848) |
9 |
|
10 |
Initialize default features USE state, and reset when appropriate, |
11 |
so that the "test" flag state is correct for evaluation of !test? |
12 |
conditionals in RESTRICT. |
13 |
|
14 |
Fixes: 45986341a80c ("Support !test? conditionals in RESTRICT (bug 663278)") |
15 |
Bug: https://bugs.gentoo.org/663848 |
16 |
|
17 |
lib/portage/package/ebuild/config.py | 13 +++++++++++-- |
18 |
1 file changed, 11 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py |
21 |
index 3b01095d0..9fbf7e8fc 100644 |
22 |
--- a/lib/portage/package/ebuild/config.py |
23 |
+++ b/lib/portage/package/ebuild/config.py |
24 |
@@ -259,6 +259,7 @@ class config(object): |
25 |
self.packages = clone.packages |
26 |
self.repositories = clone.repositories |
27 |
self.unpack_dependencies = clone.unpack_dependencies |
28 |
+ self._default_features_use = clone._default_features_use |
29 |
self._iuse_effective = clone._iuse_effective |
30 |
self._iuse_implicit_match = clone._iuse_implicit_match |
31 |
self._non_user_variables = clone._non_user_variables |
32 |
@@ -961,6 +962,14 @@ class config(object): |
33 |
|
34 |
# initialize self.features |
35 |
self.regenerate() |
36 |
+ feature_use = [] |
37 |
+ if "test" in self.features: |
38 |
+ feature_use.append("test") |
39 |
+ self.configdict["features"]["USE"] = self._default_features_use = " ".join(feature_use) |
40 |
+ if feature_use: |
41 |
+ # Regenerate USE so that the initial "test" flag state is |
42 |
+ # correct for evaluation of !test? conditionals in RESTRICT. |
43 |
+ self.regenerate() |
44 |
|
45 |
if unprivileged: |
46 |
self.features.add('unprivileged') |
47 |
@@ -1296,7 +1305,7 @@ class config(object): |
48 |
del self._penv[:] |
49 |
self.configdict["pkg"].clear() |
50 |
self.configdict["pkginternal"].clear() |
51 |
- self.configdict["features"].clear() |
52 |
+ self.configdict["features"]["USE"] = self._default_features_use |
53 |
self.configdict["repo"].clear() |
54 |
self.configdict["defaults"]["USE"] = \ |
55 |
" ".join(self.make_defaults_use) |
56 |
@@ -1598,7 +1607,7 @@ class config(object): |
57 |
has_changed = True |
58 |
# Prevent stale features USE from corrupting the evaluation |
59 |
# of USE conditional RESTRICT. |
60 |
- self.configdict["features"]["USE"] = "" |
61 |
+ self.configdict["features"]["USE"] = self._default_features_use |
62 |
|
63 |
self._penv = [] |
64 |
cpdict = self._penvdict.get(cp) |