Gentoo Archives: gentoo-dev

From: Thomas de Grenier de Latour <degrenier@×××××××××××.fr>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Handling "exactly one of many" dependencies
Date: Thu, 07 Jul 2005 16:07:58
Message-Id: 20050707180459.059a1f2c@eusebe
In Reply to: Re: [gentoo-dev] Handling "exactly one of many" dependencies by Mike Frysinger
1 On Thu, 7 Jul 2005 11:17:48 -0400
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > the only argument ive heard against using || ( ) is binary
5 > packages due to the 'accept any' nature of || ( )
6
7 There are issues that don't affect only binary package but also
8 from-sources installation. The example was:
9 || ( sdl? ( media-libs/libsdl )
10 svga? ( media-libs/svgalib )
11 opengl? ( virtual/opengl )
12 ggi? ( media-libs/libggi )
13 virtual/x11
14 )
15
16 First problem is that if a user has just added 'sdl' to his USE
17 flags, don't have SDL installed yet, but have Xorg already
18 installed, this deps won't make SDL to install. That's probably
19 not what he would have expect.
20
21 Second problem is that in src_compile, USE flags give no clue
22 about what optionnal deps are satisfied. If for instance the
23 program is a game with several make targets, this will break,
24 because SDL may not be installed:
25 if use sdl ; then
26 emake game.sdl || die
27 elif use ...
28
29 Thus, the src_compile should use some has_version instead:
30 if has_version media-lib/sdl ; then
31 emake game.sdl || die
32 elif has_version ...
33
34 It works, but is ugly, and kill the usefulness of USE flags (no
35 chance to force the game to build against svga for instance if
36 both SDL and svgalib are installed).
37
38 So yes, in such a case i think it's much better to make the
39 depend string determinisc. I would not write it exactly the way
40 twofourtysix did tho (no need to have the !flag several times):
41 sdl? ( media-libs/libsdl )
42 !sdl? ( svga? ( media-libs/svgalib )
43 !svga? ( opengl? ( virtual/opengl )
44 !opengl? ( ...
45
46 (with lot of closing parenthesis at the end. )
47
48 --
49 TGL.
50 --
51 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Handling "exactly one of many" dependencies Ciaran McCreesh <ciaran.mccreesh@×××××××××××××.uk>