Gentoo Archives: gentoo-dev

From: twofourtysix <twofourtysix@×××××.com>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Handling "exactly one of many" dependencies
Date: Thu, 07 Jul 2005 15:08:51
Message-Id: 6fd8e3c05070708051f3dd21a@mail.gmail.com
1 ebuild(5) provides an example of the DEPEND string for a package which
2 can handle exactly one of several different video interfaces:
3
4 || (
5 sdl? ( media-libs/libsdl )
6 svga? ( media-libs/svgalib )
7 opengl? ( virtual/opengl )
8 ggi? ( media-libs/libggi )
9 virtual/x11
10 )
11
12 I've been using a similar construct in one of my local ebuilds. My
13 build code is along the lines of:
14
15 if use sdl >/dev/null
16 then
17 # stuff
18 elif use svga >/dev/null
19 then
20 # stuff
21 elif ...
22
23 However, a recently overheard conversation on IRC suggests that this
24 is incorrect. Would someone with slightly less intolerance for
25 clueless newbies be kind enough to explain why exactly this is wrong,
26 and how to handle things correctly? I don't see why it is necessary to
27 use has_version rather than use, and I can't find any relevant
28 documentation (I have been lead to believe that has_version should be
29 avoided if at all possible?). I can find several ebuilds in the tree
30 that appear to use the same technique, however. Are these buggy? Do I
31 still need to use has_version if I switch my DEPEND string to
32 something like:
33
34 sdl? ( media-libs/libsdl )
35 !sdl? ( svga? ( media-libs/svgalib ) )
36 !sdl? ( !svga? ( opengl? ( virtual/opengl ) ) )
37 # ...
38
39 or is the problem something that only occurs with the first form?
40
41 --
42 gentoo-dev@g.o mailing list

Replies

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