Gentoo Archives: gentoo-dev

From: "Marijn Schouten (hkBst)" <hkBst@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] USE flags requirements (EAPI-4 ?)
Date: Mon, 31 Aug 2009 05:59:19
Message-Id: 4A9BAB86.30500@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] USE flags requirements (EAPI-4 ?) by Ciaran McCreesh
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Ciaran McCreesh wrote:
5 > On Sun, 30 Aug 2009 19:06:02 +0200
6 > Mounir Lamouri <volkmar@g.o> wrote:
7 >> So I think we should add a new feature in PMS already used in Exherbo
8 >> EAPI, USE flags requirements [1]. That means an ebuild should be able
9 >> to say a USE flag is available only if some other ones are in a
10 >> specific state. Let's take the mplayer example, if we have a line
11 >> like this: USE_REQUIREMENTS="encode? ( mp2 mp3 faac x264 xvid )", PM
12 >> should be able to show the user USE="mp3" will be ignored because he
13 >> didn't set USE="encode" and the PM will disable this USE flag by
14 >> himself. The same way, for ekiga:
15 >> USE_REQUIREMENTS="kde? ( kontact )", PM should be able to show thed
16 >> user if he set USE="kontact", kde USE flag is enabled and the PM will
17 >> enable this USE flag by himself.
18 >
19 > Is the less expressive solution you're describing still useful enough
20 > to make it worthwhile? When we were doing this for Exherbo, we
21 > identified five types of inter-use-flag dependency:
22 >
23 > * if a then b
24 > * if a then not b
25 > * at least one of a b c, possibly only if d
26 > * exactly one of a b c, possibly only if d
27 > * at most one of a b c, possibly only if d
28 >
29 > Does Gentoo make use of all of these, and are there any cases that the
30 > above doesn't cover? How would you express each of the above using
31 > USE_REQUIREMENTS?
32 >
33 > From a package manager perspective, it's much easier to give good
34 > advice to the user if we're told by the ebuild exactly what's going on.
35
36 I've said this before, but maybe now the time is right.
37
38 I think that many of these issues are caused by use flags being binary which
39 causes the total number of options to be a power of 2. If the real total number
40 of options is not a pwoer of 2 then some combinations of use flags are a priori
41 bad and thus currently we try to work around this.
42 I propose that use flag are not merely binary flags, but can take a value out of
43 a range of possible values. Binary use flags could be `on' or `off'. Other use
44 flags could range over a wider range of values. We could then catch errors early
45 as "use flag $flag has bad value $badvalue".
46
47 > * if a then b
48
49 This means that the situation +a -b is bad. So going with the ekiga example
50 above, there could be a `kontact' use flag with possible values `off&-kde',
51 `off&+kde' and `on'. The same situation can also be modeled by a `kde' use flag
52 with possible values `on-with-kontact', `on-without-kontact', `off'.
53
54 > * if a then not b
55
56 Basically the same as above: +a +b is bad, so use flag `f' could range over
57 "a&-b" "-a&-b" "-a&b" and signal an error for any other value.
58
59 > * at least one of a b c, possibly only if d
60
61 I would be interested in knowing the specifics of packages wanting this. (It
62 could possibly be addressed by use flags that take a set of values simultaneously.)
63
64 > * exactly one of a b c, possibly only if d
65
66 There should be a use flag `d' with possible values in `a', `b', `c' and
67 possibly `off'. This is really the situation where my proposal shines. This
68 covers the situation where you need an implementation of $proglang but don't
69 care whether it is $progimpl-lolcat, $progimpl-fuzzycat, $progimpl-dog or any
70 one of a number of other supported implementations.
71
72 > * at most one of a b c, possibly only if d
73
74 This situation is equivalent to the situation:
75 * exactly one of `a' `b' `c' `none', possibly only if d which was solved above.
76
77 4 out of 5 ain't bad ;P
78
79 Marijn
80
81 - --
82 If you cannot read my mind, then listen to what I say.
83
84 Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
85 <http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
86 -----BEGIN PGP SIGNATURE-----
87 Version: GnuPG v2.0.11 (GNU/Linux)
88 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
89
90 iEYEARECAAYFAkqbq4YACgkQp/VmCx0OL2wyLQCgiZz5l+UyPEMc8Ci35C/muAmd
91 IZEAniGWrm52eWZTsyJUDGzVJjx8uRlH
92 =iieZ
93 -----END PGP SIGNATURE-----