On 06/07/2016 12:20 PM, Michał Górny wrote:
>>
>> A pkg_pretend() message would certainly make sense and IMO be a good
>> idea, but again this isn't any different than the situation as it
>> stands now WITHOUT a USE=gui. Regardless I don't see this as a
>> blocker to the idea.
>
> Nope, it won't. It will only make things slower, more clumsy
> and provide no real benefit. pkg_pretend() should be reserved for
> checks really needed to build packages and not abused to do some early
> output.
>
I forgot to reply to this.
The benefit of pkg_pretend is that it lets you give a sensible error
message. This is not a complex problem we're asking the user to resolve.
Here's what the error would say if I used pkg_pretend:
This package supports two different toolkits, gtk2 and gtk3. Please
choose one and add it to your USE flags for <pkg>.
Here's what it says with REQUIRED_USE:
!!! Problem resolving dependencies for x11-drivers/nvidia-drivers
from @selected
... done!
!!! The ebuild selected to satisfy "x11-drivers/nvidia-drivers" has
unmet requirements.
- x11-drivers/nvidia-drivers-352.30::gentoo USE="X multilib tools
-acpi -gtk2 -gtk3 -pax_kernel -uvm" ABI_X86="64"
The following REQUIRED_USE flag constraints are unsatisfied:
tools? ( any-of ( gtk2 gtk3 ) )
The above constraints are a subset of the following complete
expression:
tools? ( X any-of ( gtk2 gtk3 ) )
We could make the portage output a little better, but that's going to be
an uphill battle and still won't be as informative or short as the
pkg_pretend version.
What we really need is a way to tie an error message to a REQUIRED_USE
clause. I think I remember Ciaran sarcastically suggesting that we make
REQUIRED_USE a dictionary lookup from clause => message. The sarcasm was
probably because all we'd be doing is replacing the if/then/die
statements (that we'd use in pkg_pretend) with ?,(), and => in
REQUIRED_USE. It's an abstraction without any benefit at that point.