* [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
@ 2015-01-20 11:18 Michał Górny
2015-01-22 17:47 ` Brian Dolbec
2015-01-22 21:21 ` Zac Medico
0 siblings, 2 replies; 4+ messages in thread
From: Michał Górny @ 2015-01-20 11:18 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in user
configuration package.use and similar files. This provides a convenient
way of declaring specifying multiple USE_EXPAND flags and matches the
syntax supported by Paludis. Example:
dev-util/netbeans NETBEANS_MODULES: php webcommon extide
media-libs/mesa osmesa VIDEO_CARDS: intel nouveau
---
pym/portage/package/ebuild/_config/UseManager.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
index 3a4ec22..59f474e 100644
--- a/pym/portage/package/ebuild/_config/UseManager.py
+++ b/pym/portage/package/ebuild/_config/UseManager.py
@@ -202,10 +202,17 @@ class UseManager(object):
useflag_re = _get_useflag_re(eapi)
for k, v in file_dict.items():
useflags = []
+ use_expand_prefix = ''
for prefixed_useflag in v:
+ if extended_syntax and prefixed_useflag[-1] == ":":
+ use_expand_prefix = prefixed_useflag[:-1].lower() + "_"
+ continue
+
if prefixed_useflag[:1] == "-":
useflag = prefixed_useflag[1:]
+ prefixed_useflag = "-" + use_expand_prefix + useflag
else:
+ prefixed_useflag = use_expand_prefix + prefixed_useflag
useflag = prefixed_useflag
if useflag_re.match(useflag) is None:
writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") %
@@ -227,7 +234,18 @@ class UseManager(object):
pusedict = grabdict_package(
os.path.join(location, file_name), recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False)
for k, v in pusedict.items():
- ret.setdefault(k.cp, {})[k] = tuple(v)
+ l = []
+ use_expand_prefix = ''
+ for flag in v:
+ if flag[-1] == ":":
+ use_expand_prefix = flag[:-1].lower() + "_"
+ continue
+ if flag[0] == "-":
+ nv = "-" + use_expand_prefix + flag[1:]
+ else:
+ nv = use_expand_prefix + flag
+ l.append(nv)
+ ret.setdefault(k.cp, {})[k] = tuple(l)
return ret
--
2.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
2015-01-20 11:18 [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files Michał Górny
@ 2015-01-22 17:47 ` Brian Dolbec
2015-01-22 21:21 ` Zac Medico
1 sibling, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2015-01-22 17:47 UTC (permalink / raw
To: gentoo-portage-dev
On Tue, 20 Jan 2015 12:18:43 +0100
Michał Górny <mgorny@gentoo.org> wrote:
> Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in
> user configuration package.use and similar files. This provides a
> convenient way of declaring specifying multiple USE_EXPAND flags and
> matches the syntax supported by Paludis. Example:
>
> dev-util/netbeans NETBEANS_MODULES: php webcommon extide
> media-libs/mesa osmesa VIDEO_CARDS: intel nouveau
> ---
> pym/portage/package/ebuild/_config/UseManager.py | 20
> +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/pym/portage/package/ebuild/_config/UseManager.py
> b/pym/portage/package/ebuild/_config/UseManager.py index
> 3a4ec22..59f474e 100644 ---
> a/pym/portage/package/ebuild/_config/UseManager.py +++
> b/pym/portage/package/ebuild/_config/UseManager.py @@ -202,10 +202,17
> @@ class UseManager(object): useflag_re = _get_useflag_re(eapi)
> for k, v in file_dict.items():
> useflags = []
> + use_expand_prefix = ''
> for prefixed_useflag in v:
> + if extended_syntax and
> prefixed_useflag[-1] == ":":
> + use_expand_prefix =
> prefixed_useflag[:-1].lower() + "_"
> + continue
> +
> if prefixed_useflag[:1] == "-":
> useflag =
> prefixed_useflag[1:]
> + prefixed_useflag = "-" +
> use_expand_prefix + useflag else:
> + prefixed_useflag =
> use_expand_prefix + prefixed_useflag useflag = prefixed_useflag
> if useflag_re.match(useflag) is None:
> writemsg(_("--- Invalid USE
> flag for '%s' in '%s': '%s'\n") % @@ -227,7 +234,18 @@ class
> UseManager(object): pusedict = grabdict_package(
> os.path.join(location, file_name),
> recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False)
> for k, v in pusedict.items():
> - ret.setdefault(k.cp, {})[k] =
> tuple(v)
> + l = []
> + use_expand_prefix = ''
> + for flag in v:
> + if flag[-1] == ":":
> + use_expand_prefix =
> flag[:-1].lower() + "_"
> + continue
> + if flag[0] == "-":
> + nv = "-" +
> use_expand_prefix + flag[1:]
> + else:
> + nv =
> use_expand_prefix + flag
> + l.append(nv)
> + ret.setdefault(k.cp, {})[k] =
> tuple(l)
> return ret
>
It looks harmless enough, but I'd like to wait a bit before merge I
think. This also needs a man page description update somewhere.
We need to have another meeting, decide where to cut off for the next
release.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
2015-01-20 11:18 [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files Michał Górny
2015-01-22 17:47 ` Brian Dolbec
@ 2015-01-22 21:21 ` Zac Medico
2015-01-24 9:18 ` Michał Górny
1 sibling, 1 reply; 4+ messages in thread
From: Zac Medico @ 2015-01-22 21:21 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
On 01/20/2015 03:18 AM, Michał Górny wrote:
> Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in user
> configuration package.use and similar files. This provides a convenient
> way of declaring specifying multiple USE_EXPAND flags and matches the
> syntax supported by Paludis. Example:
>
> dev-util/netbeans NETBEANS_MODULES: php webcommon extide
> media-libs/mesa osmesa VIDEO_CARDS: intel nouveau
> ---
> pym/portage/package/ebuild/_config/UseManager.py | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
> index 3a4ec22..59f474e 100644
> --- a/pym/portage/package/ebuild/_config/UseManager.py
> +++ b/pym/portage/package/ebuild/_config/UseManager.py
> @@ -202,10 +202,17 @@ class UseManager(object):
> useflag_re = _get_useflag_re(eapi)
> for k, v in file_dict.items():
> useflags = []
> + use_expand_prefix = ''
> for prefixed_useflag in v:
> + if extended_syntax and prefixed_useflag[-1] == ":":
> + use_expand_prefix = prefixed_useflag[:-1].lower() + "_"
> + continue
> +
> if prefixed_useflag[:1] == "-":
> useflag = prefixed_useflag[1:]
> + prefixed_useflag = "-" + use_expand_prefix + useflag
> else:
> + prefixed_useflag = use_expand_prefix + prefixed_useflag
> useflag = prefixed_useflag
> if useflag_re.match(useflag) is None:
> writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") %
We could match useflag_re against (use_expand_prefix + useflag) here, so
that the use_expand_prefix is also validated. Otherwise, the patch looks
good.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
2015-01-22 21:21 ` Zac Medico
@ 2015-01-24 9:18 ` Michał Górny
0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2015-01-24 9:18 UTC (permalink / raw
To: Zac Medico; +Cc: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]
Dnia 2015-01-22, o godz. 13:21:16
Zac Medico <zmedico@gentoo.org> napisał(a):
> On 01/20/2015 03:18 AM, Michał Górny wrote:
> > Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in user
> > configuration package.use and similar files. This provides a convenient
> > way of declaring specifying multiple USE_EXPAND flags and matches the
> > syntax supported by Paludis. Example:
> >
> > dev-util/netbeans NETBEANS_MODULES: php webcommon extide
> > media-libs/mesa osmesa VIDEO_CARDS: intel nouveau
> > ---
> > pym/portage/package/ebuild/_config/UseManager.py | 20 +++++++++++++++++++-
> > 1 file changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
> > index 3a4ec22..59f474e 100644
> > --- a/pym/portage/package/ebuild/_config/UseManager.py
> > +++ b/pym/portage/package/ebuild/_config/UseManager.py
> > @@ -202,10 +202,17 @@ class UseManager(object):
> > useflag_re = _get_useflag_re(eapi)
> > for k, v in file_dict.items():
> > useflags = []
> > + use_expand_prefix = ''
> > for prefixed_useflag in v:
> > + if extended_syntax and prefixed_useflag[-1] == ":":
> > + use_expand_prefix = prefixed_useflag[:-1].lower() + "_"
> > + continue
> > +
> > if prefixed_useflag[:1] == "-":
> > useflag = prefixed_useflag[1:]
> > + prefixed_useflag = "-" + use_expand_prefix + useflag
> > else:
> > + prefixed_useflag = use_expand_prefix + prefixed_useflag
> > useflag = prefixed_useflag
> > if useflag_re.match(useflag) is None:
> > writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") %
>
> We could match useflag_re against (use_expand_prefix + useflag) here, so
> that the use_expand_prefix is also validated. Otherwise, the patch looks
> good.
Yeah, updated the message, failed to update the match :).
--
Best regards,
Michał Górny
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-24 9:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 11:18 [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files Michał Górny
2015-01-22 17:47 ` Brian Dolbec
2015-01-22 21:21 ` Zac Medico
2015-01-24 9:18 ` 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