For those who aren't familiar, pkg_pretend is in EAPI4- the main usage
of it is will be use dep checking- this email is specifically
regarding an alternative to it that *should* be superior for that use
case, but I'm looking for feedback.
Basically, we use the original VALID_USE proposal from way back in
'05- if you're familiar w/ MYOPTIONS, they're reasonably similar.
Roughly, VALID_USE is a list of constraints stating what the allowed
use flag combinations are for this pkg. If you think of normal
depdencies (I must have openssl and python merged prior), it's the
# if build is set, python and openssl must be unset
VALID_USE="build? ( !python !openssl )"
# if mysql is set, sqlite must not be, and vice versa.
# note mysql/sqlite do *not* have to be set also.
VALID_USE="mysql? ( !sqlite ) !sqlite? ( mysql )"
# mysql or sqlite must be set; exclusive or.
VALID_USE="mysql? ( !sqlite ) !mysql ( sqlite )"
# alternative syntax, adding an xor group operator
# note xor isn't required- you can do the same thing
# via spelling it out, it's just a convenient thing to have.
VALID_USE="^^ ( mysql sqlite )"
# if gui is enabled, a widget set must be specified- can build
# multiple widget bindings
VALID_USE="X? ( || ( gtk qt motif ) )"
Note that like dependencies, these are assertions. More importantly,
they're also data rather then executable code. Via it being data, up
front GUI's can tell you exactly what conflicts arise, and what needs
to be adjusted.
Doing it as executable, can, but it's iterative and reliant on the dev
writing a clear message every time (rather then the UI tool getting
it right once). Clarifying iterative, consider
w/ valid use states being-
VALID_USE="build? ( !X !python ) X? ( ^^ ( gtk qt ) ) gtk? ( ssl )"
The user first flips off build. They rerun emerge- next they're told
"you must choose gtk or qt, not both". They change to USE="X gtk".
Next they're told "you need ssl turned on if you want gtk".
At this point, the user goes and gets a beer because aparently Murphy
hates them and it's going to be a long, long night.
There also is one major issue with relying on pkg_pretend
(executable) for use state validation vs doing it as VALID_USE
(data)- the package manager cannot know what states are valid thus
limiting the things it can do. Literally the pkg manager is screwed
when it comes to use cycle breaking. If the pkg manager doesn't know
what states are valid, when it encounters a use cycle it doesn't know
what intermediate builds it can do to break that cycle- literally if
USE state validation is in pkg_pretend, the *user* will have to walk
the PM through breaking the cycle instead of the PM figuring out the
proper steps to break it.
Executive summary: if use validation is implemented via pkg_pretend,
1) it still has the iterative issue
2) it's harder for configuration tools to deal with (iterative issues
above, plus the fact they get a blob of text they're stuck trying to
3) it pretty much eliminates the possibility of doing use cycle
breaking properly (which is already an issue, only going to get worse-
hence why this was proposed in '04/'05 when we started playing w/ use
deps in portage 3 at the time).
Comments desired; assuming no significant blowback, I'll be pushing
this to the council level since eapi4 is annoying feature locked right