From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 20CD0138262 for ; Fri, 20 May 2016 22:26:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 432E314217; Fri, 20 May 2016 22:26:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6C0C214215 for ; Fri, 20 May 2016 22:26:48 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 00FB9340C30; Fri, 20 May 2016 22:26:46 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 2/2] ebuild.config: Fix filtering all USE_EXPAND variables in EAPI 5+ Date: Sat, 21 May 2016 00:26:40 +0200 Message-Id: <1463783200-9039-2-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1463783200-9039-1-git-send-email-mgorny@gentoo.org> References: <1463783200-9039-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 9cd09bf9-4acd-4755-aac8-01685df30228 X-Archives-Hash: b79fc6bd174a356c62bda59d0b0e9e8e Ensure that all USE_EXPAND variables are properly filtered and exported in EAPI 5 and newer, as required by the PMS. This includes exporting an empty value if no matching flag is provided in IUSE. Bug: https://bugs.gentoo.org/show_bug.cgi?id=582140 --- pym/portage/eapi.py | 6 +++++- pym/portage/package/ebuild/config.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index 1709026..c4fb374 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -50,6 +50,9 @@ def eapi_exports_EBUILD_PHASE_FUNC(eapi): def eapi_exports_REPOSITORY(eapi): return eapi in ("4-python", "5-progress") +def eapi_exports_USE_EXPAND_variables(eapi): + return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi") + def eapi_has_pkg_pretend(eapi): return eapi not in ("0", "1", "2", "3") @@ -101,7 +104,7 @@ def eapi_has_targetroot(eapi): _eapi_attrs = collections.namedtuple('_eapi_attrs', 'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC ' - 'feature_flag_test feature_flag_targetroot ' + 'exports_USE_EXPAND_variables feature_flag_test feature_flag_targetroot ' 'hdepend iuse_defaults iuse_effective posixish_locale ' 'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps ' 'src_uri_arrows strong_blocks use_deps use_dep_defaults') @@ -128,6 +131,7 @@ def _get_eapi_attrs(eapi): dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)), dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)), exports_EBUILD_PHASE_FUNC = (eapi is None or eapi_exports_EBUILD_PHASE_FUNC(eapi)), + exports_USE_EXPAND_variables = (eapi is None or eapi_exports_USE_EXPAND_variables(eapi)), feature_flag_test = True, feature_flag_targetroot = (eapi is not None and eapi_has_targetroot(eapi)), hdepend = (eapi is not None and eapi_has_hdepend(eapi)), diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 5f19996..ee1fadb 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1279,7 +1279,7 @@ class config(object): def __init__(self, settings, unfiltered_use, use, usemask, iuse_effective, - use_expand_split, use_expand_dict): + use_expand_split, use_expand_dict, eapi_exports_USE_EXPAND_variables): self._settings = settings self._unfiltered_use = unfiltered_use self._use = use @@ -1287,6 +1287,7 @@ class config(object): self._iuse_effective = iuse_effective self._use_expand_split = use_expand_split self._use_expand_dict = use_expand_dict + self._eapi_exports_USE_EXPAND_variables = eapi_exports_USE_EXPAND_variables def __getitem__(self, key): prefix = key.lower() + '_' @@ -1330,7 +1331,7 @@ class config(object): filtered_var_split.append(x) var_split = filtered_var_split - if var_split: + if var_split or self._eapi_exports_USE_EXPAND_variables: value = ' '.join(var_split) else: # Don't export empty USE_EXPAND vars unless the user config @@ -1725,9 +1726,13 @@ class config(object): x in self.get('USE_EXPAND', '').split()) lazy_use_expand = self._lazy_use_expand( self, unfiltered_use, use, self.usemask, - portage_iuse, use_expand_split, self._use_expand_dict) + portage_iuse, use_expand_split, self._use_expand_dict, + eapi_attrs.exports_USE_EXPAND_variables) use_expand_iuses = {} + if eapi_attrs.exports_USE_EXPAND_variables: + for k in use_expand_split: + use_expand_iuses[k] = set() for x in portage_iuse: x_split = x.split('_') if len(x_split) == 1: -- 2.8.2