-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ciaran McCreesh wrote:
> On Sun, 30 Aug 2009 19:06:02 +0200
> Mounir Lamouri <[email protected]> wrote:
>> So I think we should add a new feature in PMS already used in Exherbo
>> EAPI, USE flags requirements [1]. That means an ebuild should be able
>> to say a USE flag is available only if some other ones are in a
>> specific state. Let's take the mplayer example, if we have a line
>> like this: USE_REQUIREMENTS="encode? ( mp2 mp3 faac x264 xvid )", PM
>> should be able to show the user USE="mp3" will be ignored because he
>> didn't set USE="encode" and the PM will disable this USE flag by
>> himself. The same way, for ekiga:
>> USE_REQUIREMENTS="kde? ( kontact )", PM should be able to show thed
>> user if he set USE="kontact", kde USE flag is enabled and the PM will
>> enable this USE flag by himself.
> 
> Is the less expressive solution you're describing still useful enough
> to make it worthwhile? When we were doing this for Exherbo, we
> identified five types of inter-use-flag dependency:
> 
> * if a then b
> * if a then not b
> * at least one of a b c, possibly only if d
> * exactly one of a b c, possibly only if d
> * at most one of a b c, possibly only if d
> 
> Does Gentoo make use of all of these, and are there any cases that the
> above doesn't cover? How would you express each of the above using
> USE_REQUIREMENTS?
> 
> From a package manager perspective, it's much easier to give good
> advice to the user if we're told by the ebuild exactly what's going on.

I've said this before, but maybe now the time is right.

I think that many of these issues are caused by use flags being binary which
causes the total number of options to be a power of 2. If the real total number
of options is not a pwoer of 2 then some combinations of use flags are a priori
bad and thus currently we try to work around this.
I propose that use flag are not merely binary flags, but can take a value out of
a range of possible values. Binary use flags could be `on' or `off'. Other use
flags could range over a wider range of values. We could then catch errors early
as "use flag $flag has bad value $badvalue".

> * if a then b

This means that the situation +a -b is bad. So going with the ekiga example
above, there could be a `kontact' use flag with possible values `off&-kde',
`off&+kde' and `on'. The same situation can also be modeled by a `kde' use flag
with possible values `on-with-kontact', `on-without-kontact', `off'.

> * if a then not b

Basically the same as above: +a +b is bad, so use flag `f' could range over
"a&-b" "-a&-b" "-a&b" and signal an error for any other value.

> * at least one of a b c, possibly only if d

I would be interested in knowing the specifics of packages wanting this. (It
could possibly be addressed by use flags that take a set of values 
simultaneously.)

> * exactly one of a b c, possibly only if d

There should be a use flag `d' with possible values in `a', `b', `c' and
possibly `off'. This is really the situation where my proposal shines. This
covers the situation where you need an implementation of $proglang but don't
care whether it is $progimpl-lolcat, $progimpl-fuzzycat, $progimpl-dog or any
one of a number of other supported implementations.

> * at most one of a b c, possibly only if d

This situation is equivalent to the situation:
* exactly one of `a' `b' `c' `none', possibly only if d which was solved above.

4 out of 5 ain't bad ;P

Marijn

- --
If you cannot read my mind, then listen to what I say.

Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqbq4YACgkQp/VmCx0OL2wyLQCgiZz5l+UyPEMc8Ci35C/muAmd
IZEAniGWrm52eWZTsyJUDGzVJjx8uRlH
=iieZ
-----END PGP SIGNATURE-----

Reply via email to