From: Zac Medico Date: Sat, 2 Feb 2013 09:03:09 +0000 (-0800) Subject: Mask USE=test if RESTRICT=test, for bug #273272. X-Git-Tag: v2.2.0_alpha162~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e746c0bf48eab6974e0537056fa93a356432b5ba;p=portage.git Mask USE=test if RESTRICT=test, for bug #273272. This just handles the simple case where RESTRICT=test is not conditional on any USE flags. --- diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 352b2982a..a40cdd7c2 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1514,7 +1514,33 @@ class config(object): self.configdict["env"].addLazySingleton( "PORTAGE_IUSE", _lazy_iuse_regex, portage_iuse) - ebuild_force_test = self.get("EBUILD_FORCE_TEST") == "1" + 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" + if ebuild_force_test and \ not hasattr(self, "_ebuild_force_test_msg_shown"): self._ebuild_force_test_msg_shown = True @@ -1523,7 +1549,8 @@ class config(object): if "test" in explicit_iuse or iuse_implicit_match("test"): if "test" not in self.features: use.discard("test") - elif "test" in self.usemask and not ebuild_force_test: + elif restrict_test or \ + ("test" in self.usemask and not ebuild_force_test): # "test" is in IUSE and USE=test is masked, so execution # of src_test() probably is not reliable. Therefore, # temporarily disable FEATURES=test just for this package.