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 3ECD51382C5 for ; Sun, 4 Feb 2018 13:40:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B8E5EE0C08; Sun, 4 Feb 2018 13:40:54 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 7C879E0B05 for ; Sun, 4 Feb 2018 13:40:54 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 1208A335C43; Sun, 4 Feb 2018 13:40:51 +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] portage.package.ebuild.config: Always export filtered USE_EXPAND vars Date: Sun, 4 Feb 2018 14:40:46 +0100 Message-Id: <20180204134046.26868-2-mgorny@gentoo.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180204134046.26868-1-mgorny@gentoo.org> References: <20180204134046.26868-1-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: 5cf56d1f-e04f-41ea-84fb-fe317178711d X-Archives-Hash: 3d101ecb45aee324a5f9767587c1cc05 Ensure that all USE_EXPAND variables are always exported with filtered USE flags inside, even if none of those flags are declared in IUSE. This is the behavior required for EAPI 5+ by the PMS. Since the behavior for earlier EAPIs is left undefined and having different behavior would be confusing to users, apply it in earlier EAPIs as well. --- bin/ebuild.sh | 6 ---- pym/portage/package/ebuild/config.py | 55 ++---------------------------------- 2 files changed, 3 insertions(+), 58 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 94a44d534..a914384d6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -704,12 +704,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then fi fi -# unset USE_EXPAND variables that contain only the special "*" token -for x in ${USE_EXPAND} ; do - [ "${!x}" == "*" ] && unset ${x} -done -unset x - if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} then export DEBUGBUILD=1 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 35cf4f614..739896923 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1359,47 +1359,7 @@ class config(object): filtered_var_split.append(x) var_split = filtered_var_split - if var_split: - value = ' '.join(var_split) - else: - # Don't export empty USE_EXPAND vars unless the user config - # exports them as empty. This is required for vars such as - # LINGUAS, where unset and empty have different meanings. - # The special '*' token is understood by ebuild.sh, which - # will unset the variable so that things like LINGUAS work - # properly (see bug #459350). - if has_wildcard: - value = '*' - else: - if has_iuse: - already_set = False - # Skip the first 'env' configdict, in order to - # avoid infinite recursion here, since that dict's - # __getitem__ calls the current __getitem__. - for d in self._settings.lookuplist[1:]: - if key in d: - already_set = True - break - - if not already_set: - for x in self._unfiltered_use: - if x[:prefix_len] == prefix: - already_set = True - break - - if already_set: - value = '' - else: - value = '*' - else: - # It's not in IUSE, so just allow the variable content - # to pass through if it is defined somewhere. This - # allows packages that support LINGUAS but don't - # declare it in IUSE to use the variable outside of the - # USE_EXPAND context. - value = None - - return value + return ' '.join(var_split) def _setcpv_recursion_gate(f): """ @@ -1775,7 +1735,7 @@ class config(object): self, unfiltered_use, use, self.usemask, portage_iuse, use_expand_split, self._use_expand_dict) - use_expand_iuses = {} + use_expand_iuses = dict((k, set()) for k in use_expand_split) for x in portage_iuse: x_split = x.split('_') if len(x_split) == 1: @@ -1783,18 +1743,9 @@ class config(object): for i in range(len(x_split) - 1): k = '_'.join(x_split[:i+1]) if k in use_expand_split: - v = use_expand_iuses.get(k) - if v is None: - v = set() - use_expand_iuses[k] = v - v.add(x) + v = use_expand_iuses[k].add(x) break - # If it's not in IUSE, variable content is allowed - # to pass through if it is defined somewhere. This - # allows packages that support LINGUAS but don't - # declare it in IUSE to use the variable outside of the - # USE_EXPAND context. for k, use_expand_iuse in use_expand_iuses.items(): if k + '_*' in use: use.update( x for x in use_expand_iuse if x not in usemask ) -- 2.16.1