Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Cc: gentoo-council@l.g.o, pms-bugs@g.o
Subject: [gentoo-dev] pkg_pretend USE validation and VALID_USE alternative
Date: Wed, 31 Mar 2010 09:22:59
Message-Id: 20100331092035.GA11663@hrair
1 Hola all-
3 For those who aren't familiar, pkg_pretend is in EAPI4- the main usage
4 of it is will be use dep checking- this email is specifically
5 regarding an alternative to it that *should* be superior for that use
6 case, but I'm looking for feedback.
8 Basically, we use the original VALID_USE proposal from way back in
9 '05- if you're familiar w/ MYOPTIONS, they're reasonably similar.
11 Roughly, VALID_USE is a list of constraints stating what the allowed
12 use flag combinations are for this pkg. If you think of normal
13 depdencies (I must have openssl and python merged prior), it's the
14 same machinery.
16 Examples:
18 # if build is set, python and openssl must be unset
19 VALID_USE="build? ( !python !openssl )"
21 # if mysql is set, sqlite must not be, and vice versa.
22 # note mysql/sqlite do *not* have to be set also.
23 VALID_USE="mysql? ( !sqlite ) !sqlite? ( mysql )"
25 # mysql or sqlite must be set; exclusive or.
26 VALID_USE="mysql? ( !sqlite ) !mysql ( sqlite )"
28 # alternative syntax, adding an xor group operator
29 # note xor isn't required- you can do the same thing
30 # via spelling it out, it's just a convenient thing to have.
31 VALID_USE="^^ ( mysql sqlite )"
33 # if gui is enabled, a widget set must be specified- can build
34 # multiple widget bindings
35 VALID_USE="X? ( || ( gtk qt motif ) )"
38 Note that like dependencies, these are assertions. More importantly,
39 they're also data rather then executable code. Via it being data, up
40 front GUI's can tell you exactly what conflicts arise, and what needs
41 to be adjusted.
43 Doing it as executable, can, but it's iterative and reliant on the dev
44 writing a clear message every time (rather then the UI tool getting
45 it right once). Clarifying iterative, consider
47 USE="build X"
48 w/ valid use states being-
49 VALID_USE="build? ( !X !python ) X? ( ^^ ( gtk qt ) ) gtk? ( ssl )"
51 The user first flips off build. They rerun emerge- next they're told
52 "you must choose gtk or qt, not both". They change to USE="X gtk".
53 Next they're told "you need ssl turned on if you want gtk".
55 At this point, the user goes and gets a beer because aparently Murphy
56 hates them and it's going to be a long, long night.
59 There also is one major issue with relying on pkg_pretend
60 (executable) for use state validation vs doing it as VALID_USE
61 (data)- the package manager cannot know what states are valid thus
62 limiting the things it can do. Literally the pkg manager is screwed
63 when it comes to use cycle breaking. If the pkg manager doesn't know
64 what states are valid, when it encounters a use cycle it doesn't know
65 what intermediate builds it can do to break that cycle- literally if
66 USE state validation is in pkg_pretend, the *user* will have to walk
67 the PM through breaking the cycle instead of the PM figuring out the
68 proper steps to break it.
70 Executive summary: if use validation is implemented via pkg_pretend,
71 1) it still has the iterative issue
72 2) it's harder for configuration tools to deal with (iterative issues
73 above, plus the fact they get a blob of text they're stuck trying to
74 parse)
75 3) it pretty much eliminates the possibility of doing use cycle
76 breaking properly (which is already an issue, only going to get worse-
77 hence why this was proposed in '04/'05 when we started playing w/ use
78 deps in portage 3 at the time).
81 Comments desired; assuming no significant blowback, I'll be pushing
82 this to the council level since eapi4 is annoying feature locked right
83 now.
85 Thanks-
86 ~harring