public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective
@ 2016-05-20 22:26 Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2016-05-20 22:26 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Rename the iuse_implicit variable used in USE_EXPAND handling to
iuse_effective, since that is what is actually passed there. Correct
naming makes figuring out what the function does much easier.
---
 pym/portage/package/ebuild/config.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 45b7d08..5f19996 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1278,13 +1278,13 @@ class config(object):
 		"""
 
 		def __init__(self, settings, unfiltered_use,
-			use, usemask, iuse_implicit,
+			use, usemask, iuse_effective,
 			use_expand_split, use_expand_dict):
 			self._settings = settings
 			self._unfiltered_use = unfiltered_use
 			self._use = use
 			self._usemask = usemask
-			self._iuse_implicit = iuse_implicit
+			self._iuse_effective = iuse_effective
 			self._use_expand_split = use_expand_split
 			self._use_expand_dict = use_expand_dict
 
@@ -1302,7 +1302,7 @@ class config(object):
 			if has_wildcard:
 				var_split = [ x for x in var_split if x != "*" ]
 			has_iuse = set()
-			for x in self._iuse_implicit:
+			for x in self._iuse_effective:
 				if x[:prefix_len] == prefix:
 					has_iuse.add(x[prefix_len:])
 			if has_wildcard:
-- 
2.8.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective
@ 2018-02-04 13:40 Michał Górny
  2018-02-04 13:40 ` [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars Michał Górny
  2018-02-05 22:46 ` [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michael Lienhardt
  0 siblings, 2 replies; 7+ messages in thread
From: Michał Górny @ 2018-02-04 13:40 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Rename the iuse_implicit variable used in USE_EXPAND handling to
iuse_effective, since that is what is actually passed there. Correct
naming makes figuring out what the function does much easier.
---
 pym/portage/package/ebuild/config.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 5624e86d3..35cf4f614 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1307,13 +1307,13 @@ class config(object):
 		"""
 
 		def __init__(self, settings, unfiltered_use,
-			use, usemask, iuse_implicit,
+			use, usemask, iuse_effective,
 			use_expand_split, use_expand_dict):
 			self._settings = settings
 			self._unfiltered_use = unfiltered_use
 			self._use = use
 			self._usemask = usemask
-			self._iuse_implicit = iuse_implicit
+			self._iuse_effective = iuse_effective
 			self._use_expand_split = use_expand_split
 			self._use_expand_dict = use_expand_dict
 
@@ -1331,7 +1331,7 @@ class config(object):
 			if has_wildcard:
 				var_split = [ x for x in var_split if x != "*" ]
 			has_iuse = set()
-			for x in self._iuse_implicit:
+			for x in self._iuse_effective:
 				if x[:prefix_len] == prefix:
 					has_iuse.add(x[prefix_len:])
 			if has_wildcard:
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars
  2018-02-04 13:40 [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michał Górny
@ 2018-02-04 13:40 ` Michał Górny
  2018-02-05  2:48   ` Zac Medico
  2018-02-05 22:46 ` [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michael Lienhardt
  1 sibling, 1 reply; 7+ messages in thread
From: Michał Górny @ 2018-02-04 13:40 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars
  2018-02-04 13:40 ` [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars Michał Górny
@ 2018-02-05  2:48   ` Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2018-02-05  2:48 UTC (permalink / raw
  To: gentoo-portage-dev, Michał Górny


[-- Attachment #1.1: Type: text/plain, Size: 3770 bytes --]

On 02/04/2018 05:40 AM, Michał Górny wrote:
> 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)

This assignment to v is unnecessary, but otherwise both patches look good.
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 224 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective
  2018-02-04 13:40 [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michał Górny
  2018-02-04 13:40 ` [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars Michał Górny
@ 2018-02-05 22:46 ` Michael Lienhardt
  2018-02-05 23:05   ` Zac Medico
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Lienhardt @ 2018-02-05 22:46 UTC (permalink / raw
  To: gentoo-portage-dev

Is the IUSE_IMPLICIT variable in the make.defaults also changed into IUSE_EFFECTIVE?

I'm sorry if this question was already discussed/answered somewhere else.

Michael

Il 04/02/2018 14:40, Michał Górny ha scritto:
> Rename the iuse_implicit variable used in USE_EXPAND handling to
> iuse_effective, since that is what is actually passed there. Correct
> naming makes figuring out what the function does much easier.
> ---
>   pym/portage/package/ebuild/config.py | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
> index 5624e86d3..35cf4f614 100644
> --- a/pym/portage/package/ebuild/config.py
> +++ b/pym/portage/package/ebuild/config.py
> @@ -1307,13 +1307,13 @@ class config(object):
>   		"""
>   
>   		def __init__(self, settings, unfiltered_use,
> -			use, usemask, iuse_implicit,
> +			use, usemask, iuse_effective,
>   			use_expand_split, use_expand_dict):
>   			self._settings = settings
>   			self._unfiltered_use = unfiltered_use
>   			self._use = use
>   			self._usemask = usemask
> -			self._iuse_implicit = iuse_implicit
> +			self._iuse_effective = iuse_effective
>   			self._use_expand_split = use_expand_split
>   			self._use_expand_dict = use_expand_dict
>   
> @@ -1331,7 +1331,7 @@ class config(object):
>   			if has_wildcard:
>   				var_split = [ x for x in var_split if x != "*" ]
>   			has_iuse = set()
> -			for x in self._iuse_implicit:
> +			for x in self._iuse_effective:
>   				if x[:prefix_len] == prefix:
>   					has_iuse.add(x[prefix_len:])
>   			if has_wildcard:
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective
  2018-02-05 22:46 ` [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michael Lienhardt
@ 2018-02-05 23:05   ` Zac Medico
  2018-02-06  8:36     ` Michael Lienhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Zac Medico @ 2018-02-05 23:05 UTC (permalink / raw
  To: gentoo-portage-dev, Michael Lienhardt


[-- Attachment #1.1: Type: text/plain, Size: 460 bytes --]

On 02/05/2018 02:46 PM, Michael Lienhardt wrote:
> Is the IUSE_IMPLICIT variable in the make.defaults also changed into
> IUSE_EFFECTIVE?
> 
> I'm sorry if this question was already discussed/answered somewhere else.

The IUSE_EFFECTIVE variable is generated from IUSE_IMPLICIT and some
other variables. It's documented in the "USE and IUSE handling" section
here:

https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-11900011.1.1
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 224 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective
  2018-02-05 23:05   ` Zac Medico
@ 2018-02-06  8:36     ` Michael Lienhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Lienhardt @ 2018-02-06  8:36 UTC (permalink / raw
  To: Zac Medico, gentoo-portage-dev

Many thanks.

I should definitively read this document, that is far more precise that anything I have found on the wiki or on devmanual.

Il 06/02/2018 00:05, Zac Medico ha scritto:
> On 02/05/2018 02:46 PM, Michael Lienhardt wrote:
>> Is the IUSE_IMPLICIT variable in the make.defaults also changed into
>> IUSE_EFFECTIVE?
>>
>> I'm sorry if this question was already discussed/answered somewhere else.
> 
> The IUSE_EFFECTIVE variable is generated from IUSE_IMPLICIT and some
> other variables. It's documented in the "USE and IUSE handling" section
> here:
> 
> https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-11900011.1.1
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-06  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-04 13:40 [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michał Górny
2018-02-04 13:40 ` [gentoo-portage-dev] [PATCH 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars Michał Górny
2018-02-05  2:48   ` Zac Medico
2018-02-05 22:46 ` [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michael Lienhardt
2018-02-05 23:05   ` Zac Medico
2018-02-06  8:36     ` Michael Lienhardt
  -- strict thread matches above, loose matches on Subject: below --
2016-05-20 22:26 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox