public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
Date: Mon,  5 Feb 2018 19:25:34 +0000 (UTC)	[thread overview]
Message-ID: <1517858714.fa3f1ba8153644e07be3215d8862522a0de12134.mgorny@gentoo> (raw)

commit:     fa3f1ba8153644e07be3215d8862522a0de12134
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 06:54:19 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Feb  5 19:25:14 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa3f1ba8

portage.package.ebuild.config: Always export filtered USE_EXPAND vars

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.

Bug: https://bugs.gentoo.org/582140
Closes: https://github.com/gentoo/portage/pull/254
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ebuild.sh                        |  8 +-----
 pym/portage/package/ebuild/config.py | 55 ++----------------------------------
 2 files changed, 4 insertions(+), 59 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 4a80fdd06..d63b0a0ba 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Prevent aliases from causing portage to act inappropriately.
@@ -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..432520ba8 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)
+					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 )


             reply	other threads:[~2018-02-05 19:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 19:25 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-16 17:52 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ Arfrever Frehtes Taifersar Arahesis
2013-01-15 20:52 Zac Medico
2012-09-18  2:59 Zac Medico
2012-09-14  7:26 Zac Medico
2012-09-13 18:25 Zac Medico
2012-04-22 17:56 Zac Medico
2011-11-10  3:12 Zac Medico
2011-11-09  0:21 Zac Medico
2011-11-05 18:53 Zac Medico
2011-10-15 18:38 Zac Medico
2011-09-22  0:05 Zac Medico
2011-08-28 23:32 Zac Medico
2011-05-07 22:00 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517858714.fa3f1ba8153644e07be3215d8862522a0de12134.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox