Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Michael Orlitzky <mjo@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Global USE=gui
Date: Wed, 08 Jun 2016 06:35:11
Message-Id: 20160608083448.3b857d5f.mgorny@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] Global USE=gui by Michael Orlitzky
1 On Tue, 7 Jun 2016 17:31:49 -0400
2 Michael Orlitzky <mjo@g.o> wrote:
3
4 > On 06/07/2016 04:59 PM, Michał Górny wrote:
5 > >>
6 > >> I'll believe this when I see it =P
7 > >
8 > > You won't because the Gentoo way is to create a shitload of hacks
9 > > instead of fixing the root issue.
10 > >
11 >
12 > I'm not arguing for anything here, I'm just toying around with an idea
13 > for fun. What we want is a way to declare USE flag constraints within an
14 > ebuild that,
15 >
16 > 1) Runs quickly
17 > 2) Prevents a package from being installed with conflicting flags
18 > 3) Preferably has a simple grammar and doesn't require bash
19 > 4) Outputs a sensible message to the user upon conflict
20 >
21 > The error message is the one clear point that pkg_pretend holds over
22 > REQUIRED_USE. If we can make portage do something sensible when it hits
23 > a REQUIRED_USE conflict, that would be ideal. But aren't (2) and (4) the
24 > most important points?
25 >
26 >
27 > >>
28 > >> So 7 minutes for an understandable English description of the error and
29 > >> how to fix it, versus 5 minutes for line noise? There's a great story in
30 > >> The Psychology of Computer Programming that ends like this:
31 > >
32 > > Not 5 minutes. Depending on the context, Portage can complain about
33 > > REQUIRED_USE in a few seconds because it has no further point
34 > > in evaluating the depgraph.
35 > >
36 >
37 > It doesn't do this, does it? I think it waits until the end. It *could*
38 > run pkg_pretend earlier, too, but it doesn't.
39 >
40 >
41 > >
42 > >>> 3. REQUIRED_USE can take USE dependencies into account. pkg_pretend()
43 > >>> can't.
44 > >>
45 > >> What do you mean here?
46 > >
47 > > I mean that if A depends on B[gtk2], and you have ^^ ( gtk2 gtk3 ),
48 > > Portage will clearly know gtk2 is the only solution. Your pkg_pretend()
49 > > will tell user to enable gtk3, then Portage will hit unsolvable deps.
50 > > Congratulations, your helpful output just resulted in even worse
51 > > output!
52 > >
53 >
54 > gtk2 is not the only solution: I could set B[gtk2] and A[gtk3] in
55 > package.use. (If gtk2 *were* the only solution, then why would you have
56 > the REQUIRED_USE in the first place? Just pass --with-gtk2.)
57 >
58 > In practice, I would set A[gtk3] in package.use, and then try to emerge
59 > it again. Portage would tell me that I needed to set B[gtk2] first, and
60 > I would do that and start over.
61 >
62 >
63 > >> See #2, but "each package" is an overestimate. Only the ones with a
64 > >> non-trivial pkg_pretend() phase would take any time.
65 > >
66 > > Have you tried it, or is it wild guess? What I'm saying is that
67 > > *pkg_pretend implementation in Portage is TERRIBLY SLOW*. Even
68 > > a complete no-op takes a lot of time because Portage needs to do a lot
69 > > of setup to run it, and can't do multiple packages in parallel.
70 > >
71 >
72 > Of course I haven't tried it =)
73 >
74 > One of two scenarios holds, though:
75 >
76 > * if a trivial pkg_pretend() is slow, then one that checks for USE
77 > flag conflicts isn't actually that much slower.
78 >
79 > * if a trivial pkg_pretend() is fast, then only those packages that
80 > have a non-trivial pkg_pretend() make it slower.
81 >
82 > REQUIRED_USE should be faster either way, but that's currently at the
83 > expense of the error messages and I'm not sure those *can* be fixed.
84
85 To summarize your point: bad solution is good because it's not much
86 worse than itself.
87
88 --
89 Best regards,
90 Michał Górny
91 <http://dev.gentoo.org/~mgorny/>