public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files
Date: Thu, 22 Jan 2015 13:21:16 -0800	[thread overview]
Message-ID: <54C169CC.1000902@gentoo.org> (raw)
In-Reply-To: <1421752723-2045-1-git-send-email-mgorny@gentoo.org>

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


  parent reply	other threads:[~2015-01-22 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-01-24  9:18   ` Michał Górny

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=54C169CC.1000902@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    --cc=mgorny@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