Gentoo Archives: gentoo-dev

From: David Leverton <levertond@××××××××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [pre-GLEP] Optional runtime dependencies via runtime-switchable USE flags
Date: Thu, 21 Jun 2012 19:06:52
Message-Id: 4FE3708A.1090602@googlemail.com
In Reply to: [gentoo-dev] [pre-GLEP] Optional runtime dependencies via runtime-switchable USE flags by "Michał Górny"
1 Michał Górny wrote:
2 > Hello,
3 >
4 > A simple solution to a program long-unsolved. In GLEP form.
5
6 Just a couple of minor points/nitpicks:
7
8 1) If an installed package has both IUSE_RUNTIME and REQUIRED_USE,
9 should REQUIRED_USE be re-verified:
10
11 a) for every dep resolution
12 b) when the package is involved in the resolution for some other reason
13 (not necessarily being reinstalled, just when the resolver has some
14 reason to look at it)
15 c) something else?
16
17 I think b) should be sufficient (and probably easier to implement), but
18 is there any reason why it wouldn't be?
19
20 2) It's not forbidden for package A to depend on an IUSE_RUNTIME flag of
21 package B being disabled, but it's unlikely to be useful. To make this
22 more concrete, a fictional but vaguely plausible example:
23
24 app-text/docmangler:
25
26 # links to poppler to handle PDFs, and can use Ghostscript for
27 # PostScript support if available
28 IUSE="postscript"
29 IUSE_RUNTIME="postscript"
30 DEPEND="app-text/poppler"
31 RDEPEND="${DEPEND}
32 postscript? ( app-text/ghostscript )"
33
34 app-misc/coolapp:
35
36 IUSE="doc"
37 # if Ghostscript is installed, docmangler uses it for both
38 # PostScript and PDF files, but Ghostscript misrenders our PDFs
39 DEPEND="doc? ( app-text/docmangler[-postscript] )"
40
41 Here, the [-postscript] dep would force the user to disable that flag,
42 but it wouldn't do much good because Ghostscript would still be
43 installed. This doesn't happen with regular USE flags because (if the
44 ebuild is written correctly) disabling the flag removes the feature even
45 if its dependencies happen to be installed.
46
47 Possible solutions:
48
49 a) automatically rewrite the dep as
50 postscript? ( app-text/ghostscript )
51 !postscript? ( !app-text/ghostscript )
52 b) forbid [-foo]-style deps for IUSE_RUNTIME flags (would also make
53 sense in that case to disallow them in !foo-style conditionals in the
54 dependencies of the package itself, as that could cause similar paradoxes)
55 c) don't address it in the spec itself, and require people to manually
56 write the dep in the blocker form if it's required
57 d) something else?
58
59 a) is pretty icky IMHO, especially if the flag pulls in multiple
60 packages. I could live with either b) or c), but b) is less flexible
61 and c) leaves a potential trap for the unwary. Any opinions?

Replies