Gentoo Archives: gentoo-dev

From: Doug Goldstein <cardoe@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] virtualx eclass
Date: Tue, 28 Oct 2008 17:32:22
Message-Id: 49074CA2.8030807@gentoo.org
In Reply to: Re: [gentoo-dev] virtualx eclass by "Petteri Räty"
1 Petteri Räty wrote:
2 > Doug Goldstein wrote:
3 >
4 >> Doug Goldstein wrote:
5 >>
6 >>> Doug Goldstein wrote:
7 >>>
8 >>>
9 >>>> While the rule of thumb has been if an eclass needs something it should
10 >>>> provide it's own depends. However the virtualx eclass needs to be
11 >>>> different simply because in some cases it's only uses for tests (this is
12 >>>> it's most common usage in the whole) tree. When it's used for tests
13 >>>> pulling in the xorg-server the most ideal situation would be if
14 >>>> xorg-server was only pulled in on USE=test because currently for anyone
15 >>>> emerging an app that uses GTK+ they have a weird situation in the fact
16 >>>> that all of GTK+'s depends that have USE=X use it to mean libX11 (as do
17 >>>> most usages of the X USE flag), however GTK+ itself due to it's usage of
18 >>>> the virtualx eclass pulls in xorg-server when USE=X, which is only used
19 >>>> for tests. This results in a confusing experience for users looking to
20 >>>> built a headless machine.
21 >>>>
22 >>>> It'd be a lot more consistent if ebuilds provided a USE flag or directly
23 >>>> depended on the xorg-server and then used the functions in the eclass.
24 >>>> So in summary, those are the changes I plan on making very shortly. If
25 >>>> someone's got some input, please speak up.
26 >>>>
27 >>>>
28 >>>>
29 >>>>
30 >>> Alright... after talking to Diego, Dave, and Remi the final result that
31 >>> I've come up with is the following:
32 >>>
33 >>> VIRTUALX_CONDITIONAL_USE="test"
34 >>>
35 >>> inherit virtualx
36 >>>
37 >>> That'll result in virtualx adding the following:
38 >>>
39 >>> DEPEND="test? ( x11-base/xorg-server x11-apps/xhost )"
40 >>>
41 >>> if VIRTUALX_CONDITIONAL_USE is unset (as it will be for all ebuilds
42 >>> initially) the default will be "X". Which means the default is the same
43 >>> as what we've got today. If it's set to an empty string, it'll always be
44 >>> required. Otherwise, it will use the supplied USE flag.
45 >>>
46 >>>
47 >>>
48 >> Turns out this situation breaks down when multiple USE flags are
49 >> required/used. One suggestion is to allow for that via:
50 >>
51 >> VIRTUALX_CONDITIONAL_USE="test X"
52 >>
53 >> but needs someone to write some elegant shell to make that expansion
54 >> happen. Also, it'll happen in the global scope when the data is cached
55 >> so a little ugh on that part.
56 >>
57 >>
58 >
59 > Huh?
60 >
61 > VIRTUALX_DEPS="<insert eclass needed atoms here>"
62 > for flag in ${VIRTUALX_CONDITIONAL_USE}; do
63 > DEPEND="${DEPEND} ${flag}? ( ${VIRTUALX_DEPS )"
64 > done
65 >
66 > Am I missing something here?
67 > The ebuild itself can then check if both need to be enabled etc.
68 >
69 > Regards,
70 > Petteri
71 >
72 >
73 All that's going to do is create the following..
74
75 DEPEND="X? ( ${VIRTUALX_DEPS} ) test? ( ${VIRTUALX_DEPS} )"
76
77 Which would make it depend on the dependencies when either USE="test" or
78 USE="X", which is not what we want. We want it when BOTH are set.
79
80 Right now there's no viable solution short of my original proposal which
81 involves having each ebuild stick ${VIRTUALX_DEPS} where it needs them.