Gentoo Archives: gentoo-dev

From: Marien Zwart <marienz@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [pre-GLEP] Optional runtime dependencies via runtime-switchable USE flags
Date: Wed, 20 Jun 2012 15:06:45
In Reply to: Re: [gentoo-dev] [pre-GLEP] Optional runtime dependencies via runtime-switchable USE flags by hasufell
On di, 2012-06-19 at 18:53 +0200, hasufell wrote:
> On 06/17/2012 10:31 PM, Michał Górny wrote: > > Hello, > > > > A simple solution to a program long-unsolved. In GLEP form. > > > > Both attached and published as a gist: > > > > > > > > (please note that github doesn't render GLEP headers correctly) > > > > As already stated I like this idea, because I already got some optional > dep bloat in x11-misc/spacefm and media-sound/gmusicbrowser. > > However I have a few objections: > > 1. Optional deps are SUGGESTIONS from the dev which he considered > nice/good/sane at the time of writing the ebuild. Other people might > totally disagree with those suggestions. > As useflags in IUSE_RUNTIME can pick from global useflags as well or > even set "+foo" the user might have a hard time to turn off things he > does not want without turning them off for regular IUSE as well.
I think we're not all agreeing on which problem is being solved here. I see IUSE_RUNTIME as an improvement for packages that have a runtime dependency on another package to provide a certain feature, but no way of turning this feature off at build time. Examples of this kind of dependency are executables or python imports, where the executable or library being absent is dealt with at runtime. For such packages putting the dependency behind a USE flag makes sense, and for other packages to depend on the package with that USE flag set also makes sense. This already works today. However, if you originally built the package with the USE flag off, and now try to install something that depends on the package with the USE flag on, you force a rebuild. That's not so nice, as there's no change to the installed package at all: the rebuild is a waste of time. IUSE_RUNTIME allows the package manager to skip that rebuild, as it now knows it is unnecessary. What you are describing is more like "suggested" dependencies. Those may also be useful, but do not solve quite the same problem. I do not think they quite replace the USE flag-based approach described above, as it makes sense for other ebuilds to depend on "foo with support for feature blah" through the "blah" USE flag without all those other packages having to know which specific dependencies this adds to foo, or whether foo needs a rebuild to enable the feature or not. Also, even in packages in which IUSE_RUNTIME is used for something like "suggested" dependencies it is not terribly hard for the user to turn the USE flag off (package.use) and install the interesting bits by hand.
> 2. Afais useflags that are already in IUSE and used for build-time stuff > must not be used for IUSE_RUNTIME too. > This is a random rule IMO. I don't have many cases in mind where this > would be annoying (could think of "debug" enabling some in-source > switches and adding optional debug tools in RDEPEND. Having one flag > here would make it cleaner and tighter for the user to interact with > useflags.). > However... this is not a logical rule, rather a technical issue. If > there is a way to avoid this restriction that would be nice.
I do not see where you are going with this. If it makes sense to turn on the build-time support for a feature without installing all the dependencies then the extra dependencies should go behind a separate USE flag (and that separate USE flag may depend on the USE flag controlling the build-time support using REQUIRED_USE). Or perhaps the additional dependencies should be in some new kind of "suggested" depend.
> 3. There are no unconditional optional deps possible. > ssuominen had an example: > "virtualx.eclass could have suggestion/recommendation to enable USE=xvfb > in x11-base/xorg-server"
I do not see where you are going with this. Can you refer me to where this suggestion was made? virtualx.eclass adds a hard dependency if the test USE flag (or some other USE flag) is set, and no dependency if this USE flag is not set. When would virtualx.eclass add an optional dependency? -- Marien Zwart