public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: William Hubbs <williamh@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Re: RFC: USE flags in virtuals, to allow a specific provider to be determined
Date: Sun, 27 Jul 2014 10:38:49 -0500	[thread overview]
Message-ID: <20140727153849.GA17979@linux1> (raw)
In-Reply-To: <53D3E94A.9000100@gentoo.org>

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

On Sat, Jul 26, 2014 at 01:45:46PM -0400, Jonathan Callen wrote:
 
 *snip*

> If you want to say "At most one of the flags 'foo', 'bar', and 'baz'
> may be selected", then you say it like so (requires EAPI=5):
> 
> REQUIRED_USE="?? ( foo bar baz )"
> 
> If you want to say "Exactly one of the flags ...", then you use:
> 
> REQUIRED_USE="^^ ( foo bar baz )"
> 
> And, as always, you can say "At least one of the flags ..." with:
> 
> REQUIRED_USE="|| ( foo bar baz )"
> 
> While each of these can be written using the "foo? ( !bar )"-type
> primitives, the messages portage outputs are generally better with
> '??', '^^', and '||', as you might see something like:
> 
> "
>    The following REQUIRED_USE flag constraints are unsatisfied:
>      at-most-one-of ( foo bar baz )
> "
> 
> Which is, in my opinion, more readable.

Now I understand what ciaranm was suggesting in pkg_pretend. Note, this
is not shell syntax, but it conveys the idea...

pkg_pretend() {
	count=0
	for x in foo bar bas; do
		use $x && count += 1
	done
	# Now, if count == 0 none of the flags are used, and
	# if count > 1 more than one is used, so die whenever appropriate
	# with any error message you choose.
}

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2014-07-27 15:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 18:49 [gentoo-dev] RFC: USE flags in virtuals, to allow a specific provider to be determined Ian Stakenvicius
2014-07-25 19:04 ` Luis Ressel
2014-07-25 19:23   ` Ian Stakenvicius
2014-07-25 19:44     ` Luis Ressel
2014-07-25 19:46       ` Ciaran McCreesh
2014-07-25 19:49         ` Ian Stakenvicius
2014-07-25 19:51         ` Pacho Ramos
2014-07-25 19:54           ` Ian Stakenvicius
2014-07-25 20:12             ` Pacho Ramos
2014-07-25 20:18               ` Ciaran McCreesh
2014-07-26  8:28                 ` Pacho Ramos
2014-07-25 21:13               ` Ian Stakenvicius
2014-07-25 21:25                 ` Ciaran McCreesh
2014-07-25 21:23             ` William Hubbs
2014-07-25 21:25               ` Ciaran McCreesh
2014-07-25 21:46                 ` William Hubbs
2014-07-25 21:50                   ` Ciaran McCreesh
2014-07-26 17:45               ` [gentoo-dev] " Jonathan Callen
2014-07-27 15:38                 ` William Hubbs [this message]
2014-07-25 20:41 ` [gentoo-dev] " Michał Górny
2014-07-25 21:09   ` Ian Stakenvicius
2014-07-26  7:17     ` justin
2014-07-26  8:05 ` [gentoo-dev] " Duncan
2014-07-26  8:30   ` Pacho Ramos
2014-07-26  8:53   ` Michał Górny
2014-07-26  9:01     ` Duncan
2014-07-26 12:46     ` Ciaran McCreesh
2014-07-26  8:58   ` Duncan
2014-07-26 13:31   ` Ian Stakenvicius
2014-07-26 14:40 ` [gentoo-dev] " Manuel Rüger
2014-07-27 17:11   ` Peter Stuge
2014-07-28 14:20   ` Ian Stakenvicius
2014-07-28 14:42     ` Michał Górny
2014-07-28 15:11       ` Ian Stakenvicius
2014-07-28 11:21 ` Michał Górny
2014-07-28 17:02   ` Ian Stakenvicius
2014-07-29  4:23     ` James Potts
2014-07-29 11:06       ` Ciaran McCreesh
2014-07-29  4:51     ` 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=20140727153849.GA17979@linux1 \
    --to=williamh@gentoo.org \
    --cc=gentoo-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