Gentoo Archives: gentoo-dev

From: Simon Stelling <blubb@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour
Date: Thu, 22 Feb 2007 21:08:20
Message-Id: 45DE04E3.7020703@gentoo.org
In Reply to: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour by Ciaran McCreesh
1 Ciaran McCreesh wrote:
2 > || (
3 > sdl? ( media-libs/libsdl )
4 > svga? ( media-libs/svgalib )
5 > opengl? ( virtual/opengl )
6 > ggi? ( media-libs/libggi )
7 > virtual/x
8 > )
9
10 > As has been discussed in the past, the only correct way of handling
11 > this from an ebuild perspective is lots of use && has_version calls
12 > (relying upon use only is insufficient, since if two or more flags are
13 > used, only one of the dependencies need be installed; relying upon
14 > has_version only is insufficient, since a dependency may be installed
15 > but its associated use flag could still be turned off).
16
17 It's doable with just use. For the example above, this would be the
18 solution:
19
20 interface="x11"
21 use ggi && interface="ggi"
22 use opengl && interface="opengl"
23 use svgalib && interface="svga"
24 use sdl && interface="libsdl"
25
26 After that, instead of using "use $flag", just use
27 "[[ ${interface} == $flag ]]"
28
29 A combination of use and has_version which does not use the concept
30 shown above wouldn't work reliably anyway as a non-dependency might be
31 installed and its flag turned on, but another interface should be
32 selected since its flag has a higher priority.
33
34 > So, is there a legitimate reason for this complication to exist? Or
35 > should use? blocks being direct children of || ( ) be forbidden?
36
37 I don't see how this is a complication, tbh. The alternative would be to
38 have the same DEPEND but without the ||(). But then you would have to a)
39 let the ebuild die if more then one flag is turned on or b) have it
40 follow the same logic as shown above.
41
42 I also don't see how it is a nuisance to explain. Explain how ||() works
43 with a "normal" dependency, explain how use? () dependencies work and it
44 will become clear to everybody how it will work. TBH, it looks to me
45 like you were to explain how an if statement in a while loop works, even
46 though it is well-known how both of them work if they aren't nested.
47
48 --
49 Kind Regards,
50
51 Simon Stelling
52 Gentoo/AMD64 developer
53 --
54 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour Simon Stelling <blubb@g.o>
Re: [gentoo-dev] Reliance upon || ( use? ( ) ) behaviour Ciaran McCreesh <ciaranm@×××××××.org>