* [gentoo-portage-dev] [PATCH 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective @ 2016-05-20 22:26 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 0 siblings, 1 reply; 3+ 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] 3+ messages in thread
* [gentoo-portage-dev] [PATCH 2/2] ebuild.config: Fix filtering all USE_EXPAND variables in EAPI 5+ 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 ` Michał Górny 2016-05-21 6:48 ` Michał Górny 0 siblings, 1 reply; 3+ messages in thread From: Michał Górny @ 2016-05-20 22:26 UTC (permalink / raw To: gentoo-portage-dev; +Cc: Michał Górny 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH 2/2] ebuild.config: Fix filtering all USE_EXPAND variables in EAPI 5+ 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 0 siblings, 0 replies; 3+ messages in thread From: Michał Górny @ 2016-05-21 6:48 UTC (permalink / raw To: gentoo-portage-dev [-- 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 --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-21 6:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox