Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
Date: Thu, 22 Jan 2015 21:21:22
Message-Id: 54C169CC.1000902@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files by "Michał Górny"
1 On 01/20/2015 03:18 AM, Michał Górny wrote:
2 > Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in user
3 > configuration package.use and similar files. This provides a convenient
4 > way of declaring specifying multiple USE_EXPAND flags and matches the
5 > syntax supported by Paludis. Example:
6 >
7 > dev-util/netbeans NETBEANS_MODULES: php webcommon extide
8 > media-libs/mesa osmesa VIDEO_CARDS: intel nouveau
9 > ---
10 > pym/portage/package/ebuild/_config/UseManager.py | 20 +++++++++++++++++++-
11 > 1 file changed, 19 insertions(+), 1 deletion(-)
12 >
13 > diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
14 > index 3a4ec22..59f474e 100644
15 > --- a/pym/portage/package/ebuild/_config/UseManager.py
16 > +++ b/pym/portage/package/ebuild/_config/UseManager.py
17 > @@ -202,10 +202,17 @@ class UseManager(object):
18 > useflag_re = _get_useflag_re(eapi)
19 > for k, v in file_dict.items():
20 > useflags = []
21 > + use_expand_prefix = ''
22 > for prefixed_useflag in v:
23 > + if extended_syntax and prefixed_useflag[-1] == ":":
24 > + use_expand_prefix = prefixed_useflag[:-1].lower() + "_"
25 > + continue
26 > +
27 > if prefixed_useflag[:1] == "-":
28 > useflag = prefixed_useflag[1:]
29 > + prefixed_useflag = "-" + use_expand_prefix + useflag
30 > else:
31 > + prefixed_useflag = use_expand_prefix + prefixed_useflag
32 > useflag = prefixed_useflag
33 > if useflag_re.match(useflag) is None:
34 > writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") %
35
36 We could match useflag_re against (use_expand_prefix + useflag) here, so
37 that the use_expand_prefix is also validated. Otherwise, the patch looks
38 good.
39 --
40 Thanks,
41 Zac

Replies