public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH 2/2] ebuild.config: Fix filtering all USE_EXPAND variables in EAPI 5+
Date: Sat, 21 May 2016 08:48:09 +0200	[thread overview]
Message-ID: <20160521084809.33f53d7f.mgorny@gentoo.org> (raw)
In-Reply-To: <1463783200-9039-2-git-send-email-mgorny@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]

On Sat, 21 May 2016 00:26:40 +0200
Michał Górny <mgorny@gentoo.org> wrote:

> 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:

After some thinking, I'll prepare another patch that applies the change
to all EAPIs. The behavior for earlier EAPIs is implementation-defined
by PMS and having it inconsistent will only confuse users.

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

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

      reply	other threads:[~2016-05-21  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 22:26 [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective Michał Górny
2016-05-20 22:26 ` [gentoo-portage-dev] [PATCH 2/2] ebuild.config: Fix filtering all USE_EXPAND variables in EAPI 5+ Michał Górny
2016-05-21  6:48   ` Michał Górny [this message]

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=20160521084809.33f53d7f.mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-portage-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