Gentoo Archives: gentoo-dev

From: Daniel Campbell <zlg@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] REQUIRED_USE, global USE flags, user-friendliness...
Date: Mon, 30 Jan 2017 12:00:06
Message-Id: 99c998a9-98e4-d88f-2065-18156d2d0102@gentoo.org
In Reply to: Re: [gentoo-dev] REQUIRED_USE, global USE flags, user-friendliness... by NP-Hardass
1 On 01/27/2017 12:51 PM, NP-Hardass wrote:
2 > On 01/27/2017 12:25 PM, Michael Orlitzky wrote:
3 >> Forked from the gdbm/berkdb thread, wall of text ensues...
4 >>
5 >>
6 >> On 01/27/2017 03:32 AM, Fabian Groffen wrote:
7 >>>
8 >>> You mention REQUIRED_USE should be used sparingly, I think I see your
9 >>> reasoning, but if so, then why did we add it in the first place?
10 >>
11 >> There are a few conflicting interests at play. Before REQUIRED_USE, we
12 >> would have a bunch of checks in pkg_pretend() to test if the user's
13 >> configuration was invalid. If it was, we could output a nice explanation
14 >> and tell him to try again. But, bash code in pkg_pretend can't be
15 >> understood by the package manager, and requires execution to determine
16 >> if a package can be installed. So we got REQUIRED_USE, which fixes those
17 >> problems, and introduces a new one: no one knows WTF to do when portage
18 >> outputs a REQUIRED_USE error. Now you get what looks like a core dump of
19 >> the dependency graph instead of "this package only uses one database, so
20 >> pick either mysql or sqlite."
21 >>
22 >> Both approaches have another problem: USE flag constraints on packages
23 >> simply don't work with global USE flags. Global USE flags don't work
24 >> that well to begin with, since the same flag means different things to
25 >> each package (and the fact that they're global means "enable foo" is all
26 >> we get for documentation). Regardless, when you have 100 flags enabled
27 >> globally and start installing thousands of packages with USE
28 >> constraints, you're eventually going to get to a point where everything
29 >> has conflicting requirements and you need to switch to package.use to
30 >> sort it all out.
31 >>
32 >> Both pkg_pretend and REQUIRED_USE have that problem and try to solve it
33 >> in different ways. If you don't care about machine-readability, then in
34 >> pkg_pretend you could try to choose "the best" of two conflicting flags
35 >> and just silently go with it. There are a lot of problems with that,
36 >> like what happens if you need to add a conditional dependency on those
37 >> flags (you can't change DEPEND in pkg_pretend). With REQUIRED_USE, you
38 >> instead need to set IUSE defaults to get it to do something without user
39 >> interaction, but the tricks that you can do with IUSE don't solve every
40 >> REQUIRED_USE conflict. In the harder cases, you can try to figure out
41 >> what to do on behalf of the user in the ebuild, but then you're right
42 >> back to the same set of problems that you had with pkg_pretend, because
43 >> the decision is being made in code and not in metadata/flags.
44 >>
45 >> I think a slow migration away from global USE flags is the only way out
46 >> of the jam. We get better USE flag docs for free, and no REQUIRED_USE
47 >> conflicts that the user didn't cause himself. We could probably also get
48 >> rid of a lot of IUSE defaults that serve only to undo various profile
49 >> defaults. It would be annoying at first, but once a few critical profile
50 >> defaults are moved into package.use, better.
51 >>
52 >
53 > I might be wrong, but my suspicion is that those that advocate for
54 > pkg_pretend over REQUIRED_USE tend to do so because of the blocking
55 > nature of REQUIRED_USE's current implementation rather than the
56 > construct of describing USE flag inter-dependencies itself.
57 >
58 > So, personally, I think that we should be discussing ways of adding
59 > interactivity to the package manager for resolution of REQUIRED_USE
60 > conflicts rather than discussing ways to work around or remove it. It's
61 > a good construct, we should take advantage of it, and work to make it
62 > more user friendly.
63 >
64 > My initial feeling is having flags, one for interactive handling, one
65 > for current behavior. Interactive has two modes, like --autounmask and
66 > --autounmask-write (and could even reuse these if possible), which does
67 > something similar to how Debian's apt handles dependency conflicts by
68 > calculating the alternatives and prompting the user to select a numbered
69 > option. So the autounmask equivalent displays the changes to the config
70 > files and the autounmask-write equivalent writes them to the appropriate
71 > config files. This is just a general idea that I just came up with
72 > right now, so I haven't put too much thought into it. It is mostly
73 > meant to get solutions for interactive handling discussed on the ML.
74 >
75 This is a fantastic idea. We need some way to handle it. Something like
76 ewarn/einfo to tell the user REQUIRED_USE has been triggered (and why),
77 but (depending on flags) then use the default or prompt for a selection.
78
79 To do this, we'd need a) a message to prompt the user with, b) a way to
80 convey and listen to choices, and c) a way to default to one of the
81 given choices in "automatic" or unattended merges.
82
83 A good portion of the information is already in the ebuilds. We have
84 IUSE for default flag state and REQUIRED_USE to show us which flags are
85 conflicting. The description for the USE flags can be gleaned from
86 metadata.xml or the profile's package.use.desc.
87
88 So the hard part is: how do we glue this together?
89 --
90 Daniel Campbell - Gentoo Developer
91 OpenPGP Key: 0x1EA055D6 @ hkp://keys.gnupg.net
92 fpr: AE03 9064 AE00 053C 270C 1DE4 6F7A 9091 1EA0 55D6

Attachments

File name MIME type
signature.asc application/pgp-signature