aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-08-20 14:54:14 -0700
committerZac Medico <zmedico@gentoo.org>2018-08-20 15:13:59 -0700
commitcbe6f8cac95f5db7b35018a01c56dc3d9c76bb21 (patch)
treeacf8a4e562e679a4b0b3a90dc7c320e0e6c01aa1
parentUpdates for portage-2.3.47 release (diff)
downloadportage-cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21.tar.gz
portage-cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21.tar.bz2
portage-cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21.zip
config: regenerate USE for conditional RESTRICT (bug 664104)
When the features USE state changes due to package.env settings, regenerate USE for correct evaluation of conditional RESTRICT. Fixes: 45986341a80c ("Support !test? conditionals in RESTRICT (bug 663278)") Bug: https://bugs.gentoo.org/664104
-rw-r--r--lib/portage/package/ebuild/config.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 9fbf7e8fc..a68df5807 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -1666,8 +1666,22 @@ class config(object):
has_changed = True
if has_changed:
+ # This can modify self.features due to package.env settings.
self.reset(keeping_pkg=1)
+ if "test" in self.features:
+ # This is independent of IUSE and RESTRICT, so that the same
+ # value can be shared between packages with different settings,
+ # which is important when evaluating USE conditional RESTRICT.
+ feature_use.append("test")
+
+ feature_use = " ".join(feature_use)
+ if feature_use != self.configdict["features"]["USE"]:
+ # Regenerate USE for evaluation of conditional RESTRICT.
+ self.configdict["features"]["USE"] = feature_use
+ self.reset(keeping_pkg=1)
+ has_changed = True
+
if explicit_iuse is None:
explicit_iuse = frozenset(x.lstrip("+-") for x in iuse.split())
if eapi_attrs.iuse_effective:
@@ -1696,25 +1710,12 @@ class config(object):
else:
restrict_test = "test" in restrict
- pkginternaluse_before = pkginternaluse
- if "test" in self.features:
- # This is independent of IUSE and RESTRICT, so that the same
- # value can be shared between packages with different settings,
- # which is important when evaluating USE conditional RESTRICT
- # above.
- feature_use.append("test")
-
- if restrict_test:
- # Handle it like IUSE="-test", since features USE is
- # independent of RESTRICT.
- pkginternaluse_list.append("-test")
- pkginternaluse = " ".join(pkginternaluse_list)
- self.configdict["pkginternal"]["USE"] = pkginternaluse
-
- feature_use = " ".join(feature_use)
- if (feature_use != self.configdict["features"].get("USE", "") or
- pkginternaluse is not pkginternaluse_before):
- self.configdict["features"]["USE"] = feature_use
+ if restrict_test and "test" in self.features:
+ # Handle it like IUSE="-test", since features USE is
+ # independent of RESTRICT.
+ pkginternaluse_list.append("-test")
+ pkginternaluse = " ".join(pkginternaluse_list)
+ self.configdict["pkginternal"]["USE"] = pkginternaluse
# TODO: can we avoid that?
self.reset(keeping_pkg=1)
has_changed = True