From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 83C69138334 for ; Sat, 11 Aug 2018 21:06:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 32753E077A; Sat, 11 Aug 2018 21:06:33 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EDCDAE077A for ; Sat, 11 Aug 2018 21:06:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 24227335C95 for ; Sat, 11 Aug 2018 21:06:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D00DE38A for ; Sat, 11 Aug 2018 21:06:27 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1534021520.abf6f36a2785671f183f5f898f03c29cd5a915b9.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/package/ebuild/config.py X-VCS-Directories: lib/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: abf6f36a2785671f183f5f898f03c29cd5a915b9 X-VCS-Branch: master Date: Sat, 11 Aug 2018 21:06:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 20324f16-f52b-4890-afdb-26803e8e02a8 X-Archives-Hash: f0974fedd78e88b078e76edbd0be3838 commit: abf6f36a2785671f183f5f898f03c29cd5a915b9 Author: Zac Medico gentoo org> AuthorDate: Sat Aug 11 19:48:01 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Aug 11 21:05:20 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=abf6f36a Make features USE respect RESTRICT=test (bug 663278) 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 Reviewed-by: Michał Górny gentoo.org> 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"