Zac Medico
2018-08-11 20:05:21 UTC
Make RESTRICT=test prevent the "test" USE flag from being added to
features USE flags when FEATURES=test is enabled, in order to preserve
default behavior for ebuilds that set RESTRICT=test. The code that sets
the restrict_test variable in the setcpv method must execute earlier
now, but the logic is unchanged. Note that it is still possible to
enable USE=test for ebuilds that set RESTRICT=test, but FEATURES=test
will not do it, so it will only be triggered by an explicit USE=test
setting by the user or profile.
Fixes: 8c5598c1af2c ("Replace implicit {FEATURES->USE}=test forcing with USE default")
Bug: https://bugs.gentoo.org/663278
---
lib/portage/package/ebuild/config.py | 50 ++++++++++++++++++------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 3e0081829..220fa31bb 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -1663,7 +1663,31 @@ class config(object):
else:
iuse_implicit_match = self._iuse_implicit_match
- if "test" in explicit_iuse or iuse_implicit_match("test"):
+ if pkg is None:
+ raw_restrict = pkg_configdict.get("RESTRICT")
+ else:
+ raw_restrict = pkg._raw_metadata["RESTRICT"]
+
+ restrict_test = False
+ if raw_restrict:
+ try:
+ if built_use is not None:
+ restrict = use_reduce(raw_restrict,
+ uselist=built_use, flat=True)
+ else:
+ # Use matchnone=True to ignore USE conditional parts
+ # of RESTRICT, since we want to know whether to mask
+ # the "test" flag _before_ we know the USE values
+ # that would be needed to evaluate the USE
+ # conditionals (see bug #273272).
+ restrict = use_reduce(raw_restrict,
+ matchnone=True, flat=True)
+ except PortageException:
+ pass
+ else:
+ restrict_test = "test" in restrict
+
+ if not restrict_test and ("test" in explicit_iuse or iuse_implicit_match("test")):
if "test" in self.features:
feature_use.append("test")
@@ -1721,30 +1745,6 @@ class config(object):
self.configdict["env"].addLazySingleton(
"PORTAGE_IUSE", _lazy_iuse_regex, portage_iuse)
- if pkg is None:
- raw_restrict = pkg_configdict.get("RESTRICT")
- else:
- raw_restrict = pkg._raw_metadata["RESTRICT"]
-
- restrict_test = False
- if raw_restrict:
- try:
- if built_use is not None:
- restrict = use_reduce(raw_restrict,
- uselist=built_use, flat=True)
- else:
- # Use matchnone=True to ignore USE conditional parts
- # of RESTRICT, since we want to know whether to mask
- # the "test" flag _before_ we know the USE values
- # that would be needed to evaluate the USE
- # conditionals (see bug #273272).
- restrict = use_reduce(raw_restrict,
- matchnone=True, flat=True)
- except PortageException:
- pass
- else:
- restrict_test = "test" in restrict
-
ebuild_force_test = not restrict_test and \
self.get("EBUILD_FORCE_TEST") == "1"
features USE flags when FEATURES=test is enabled, in order to preserve
default behavior for ebuilds that set RESTRICT=test. The code that sets
the restrict_test variable in the setcpv method must execute earlier
now, but the logic is unchanged. Note that it is still possible to
enable USE=test for ebuilds that set RESTRICT=test, but FEATURES=test
will not do it, so it will only be triggered by an explicit USE=test
setting by the user or profile.
Fixes: 8c5598c1af2c ("Replace implicit {FEATURES->USE}=test forcing with USE default")
Bug: https://bugs.gentoo.org/663278
---
lib/portage/package/ebuild/config.py | 50 ++++++++++++++++++------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 3e0081829..220fa31bb 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -1663,7 +1663,31 @@ class config(object):
else:
iuse_implicit_match = self._iuse_implicit_match
- if "test" in explicit_iuse or iuse_implicit_match("test"):
+ if pkg is None:
+ raw_restrict = pkg_configdict.get("RESTRICT")
+ else:
+ raw_restrict = pkg._raw_metadata["RESTRICT"]
+
+ restrict_test = False
+ if raw_restrict:
+ try:
+ if built_use is not None:
+ restrict = use_reduce(raw_restrict,
+ uselist=built_use, flat=True)
+ else:
+ # Use matchnone=True to ignore USE conditional parts
+ # of RESTRICT, since we want to know whether to mask
+ # the "test" flag _before_ we know the USE values
+ # that would be needed to evaluate the USE
+ # conditionals (see bug #273272).
+ restrict = use_reduce(raw_restrict,
+ matchnone=True, flat=True)
+ except PortageException:
+ pass
+ else:
+ restrict_test = "test" in restrict
+
+ if not restrict_test and ("test" in explicit_iuse or iuse_implicit_match("test")):
if "test" in self.features:
feature_use.append("test")
@@ -1721,30 +1745,6 @@ class config(object):
self.configdict["env"].addLazySingleton(
"PORTAGE_IUSE", _lazy_iuse_regex, portage_iuse)
- if pkg is None:
- raw_restrict = pkg_configdict.get("RESTRICT")
- else:
- raw_restrict = pkg._raw_metadata["RESTRICT"]
-
- restrict_test = False
- if raw_restrict:
- try:
- if built_use is not None:
- restrict = use_reduce(raw_restrict,
- uselist=built_use, flat=True)
- else:
- # Use matchnone=True to ignore USE conditional parts
- # of RESTRICT, since we want to know whether to mask
- # the "test" flag _before_ we know the USE values
- # that would be needed to evaluate the USE
- # conditionals (see bug #273272).
- restrict = use_reduce(raw_restrict,
- matchnone=True, flat=True)
- except PortageException:
- pass
- else:
- restrict_test = "test" in restrict
-
ebuild_force_test = not restrict_test and \
self.get("EBUILD_FORCE_TEST") == "1"
--
2.16.4
2.16.4