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: signature.asc
Description: Digital signature

Reply via email to