On Tue, 7 Jun 2016 14:50:36 -0400
Michael Orlitzky <[email protected]> wrote:

> 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.

The point is that:

1. REQUIRED_USE is semi-machine-understandable while pkg_pretend() is
some random function crap. Portage can be improved to take some
sensible action on it. With pkg_pretend, we can't do anything but print.

2. REQUIRED_USE can be handled early during dependency resolution.
pkg_pretend() is like I want 5 minutes for Portage to calculate
the dependencies, then 2 minutes to run pkg_pretend()s, then it tells
me I am supposed to change one thing and start over.

3. REQUIRED_USE can take USE dependencies into account. pkg_pretend()
can't.

4. pkg_pretend() is slow, and should be used scarcely. Adding
an additional slow step for each package on the list, before starting to
build packages is not really helpful.

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

Attachment: pgpwx35ii79pB.pgp
Description: OpenPGP digital signature

Reply via email to