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 CC8E6138334 for ; Mon, 20 Aug 2018 23:11:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B17EDE083E; Mon, 20 Aug 2018 23:11:23 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 7020AE083E for ; Mon, 20 Aug 2018 23:11:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 7EDA8335CE7 for ; Mon, 20 Aug 2018 23:11:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 726F53B5 for ; Mon, 20 Aug 2018 23:11:18 +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: <1534803239.cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21.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: cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21 X-VCS-Branch: master Date: Mon, 20 Aug 2018 23:11:18 +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: 471a2e14-6139-467b-93d4-60c9c4f61f09 X-Archives-Hash: 367d74dbf6cc116c0e53f36b3575cb25 commit: cbe6f8cac95f5db7b35018a01c56dc3d9c76bb21 Author: Zac Medico gentoo org> AuthorDate: Mon Aug 20 21:54:14 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Aug 20 22:13:59 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cbe6f8ca 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 lib/portage/package/ebuild/config.py | 39 ++++++++++++++++++------------------ 1 file 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