Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] HDEPEND (host dependencies for cross-compilation) for EAPI 5?
Date: Thu, 06 Sep 2012 08:12:42
Message-Id: 20120906081145.GC18495@localhost
In Reply to: Re: [gentoo-dev] HDEPEND (host dependencies for cross-compilation) for EAPI 5? by "Jorge Manuel B. S. Vicetto"
1 On Wed, Sep 05, 2012 at 12:06:45AM +0000, Jorge Manuel B. S. Vicetto wrote:
2 > -----BEGIN PGP SIGNED MESSAGE-----
3 > Hash: SHA1
4 >
5 > On 31-08-2012 20:46, Ciaran McCreesh wrote:
6 >
7 > <snip>
8 >
9 > > Also, we're getting rather a lot of *DEPEND variables here... If
10 > > we're making people make major changes to their deps, which for
11 > > HDEPEND we definitely would be, then the "it's expensive since
12 > > people would have to redo their deps" argument against a combined
13 > > DEPENDENCIES variable goes out of the window, so we should rethink
14 > > that too.
15 >
16 > I have to agree with Ciaran, instead of multiplying DEPEND variables,
17 > it's probably time we move to a single DEPENDENCIES variable.
18
19 Personally, my complaints re: it are that 1) while minor, the
20 labels in some cases are overly verbose; recommendations instead of
21 recommends, suggestions instead of suggests, etc. 2) An actual
22 flaw in their design (imo): it tries to intermix two different
23 forms of parsing, without any real justification for *why* beyond
24 *hey look kids, I can!*; The two can intersect in slightly fucked
25 up ways, case in point:
26
27 DEPENDENCIES="
28 run+build:
29 cat/the
30 x? ( cat/cow
31 test:
32 y? ( cat/says
33 z? ( cat/moo
34 )))
35
36 Now, there may be some unstated rules that disallow that, but if that
37 *is* allowed, that's frankly dumb. As to if it's disallowed, it's
38 kind of a design flaw that the situation can occur requiring an
39 explicit suppression.
40
41
42 Rather than invent and try intermixing a secondary form, just using
43 the existing strikes me as saner; either we can have a specific
44 use_expand group like thus:
45
46 DEPENDENCIES="
47 dep_run? ( cat/monkeys )
48 dep_run+build? ( cat/foo )"
49
50 Or, preferable imo, do away w/ the +, use a more natural ',' for phase
51 separation, and use ':';
52
53 DEPENDENCIES="
54 dep:run? ( cat/monkeys )
55 dep:run,build? ( cat/foo )"
56
57 Doing it that way reuses the existing parsing infrastructure (good)
58 via just requiring a change to the use validation machinery (easy if
59 the PM is implemented sanely).
60
61 It also is able to express things that exheres variation can't do as
62 cleanly; considering build/fetch/post/run/test as the viable dep
63 targets:
64
65 DEPENDENCIES="
66 build+fetch+post+test:
67 some-dep"
68 vs
69 DEPENDENCIES="!dep:run? ( some-dep )"
70
71 I don't much expect that to occur, but the potential exists, thus
72 mentioning it.
73
74
75 One unstated fault re: DEPENDENCIES btw, is it will not play nice w/
76 exactly one of blocks. Treating '^^' as "exactly one of", consider:
77
78 DEPENDENCIES="
79 ^^ (
80 run:
81 cat/blah
82 build:
83 cat/dar
84 cat/foon
85 )"
86
87 Is that a stupid dep? You bet your ass it is.. But it would have to
88 be explicitly suppressed by the parser for any such construct- moreso,
89 repoman would have to spot it which is slightly unfun.
90
91 Finally, one note; while certain folk have been making lots of noise
92 about DEPENDENCIES being the best thing since sliced bread, their
93 isn't much comment about how one actually transitions to it without
94 making eclass authors who have to support both pre-DEPENDENCIES, and
95 post-DEPENDENCIES eapis happy; kind of swiss cheeses the hell out of
96 the code frankly.
97
98 A compatibility hack that stacks them is strongly advisable; something
99 akin to the following:
100
101 Literally, we do the following:
102 inherit() {
103 if eapi blah; then
104 local DEPEND PDEPEND RDEPEND
105 <usual saving/protection of DEPENDENCIES var>
106 else
107 <usual saving/protection of DEPEND/PDEPEND/RDEPEND vars>
108 fi
109 <normal sourcing machinery>
110 if eapi blah; then
111 local _deps=( ) _x
112 for _x in DEPENDENCIES DEPEND RDEPEND PDEPEND; do
113 [ -n "${!_x}" ] && deps+=( "${!_x}" )
114 done
115 [ ${#deps} -ne 0 ] && DEPENDENCIES="${deps[*]}"
116 unset DEPEND RDEPEND PDEPEND _x _deps
117 <normal stacking/restoration of DEPENDENCIES rules>
118 else
119 <normal stacking/restoration of RDEPEND/PDEPEND/DEPEND>
120 fi
121 }
122
123 Via that, we eclasses that are pure DEPENDENCIES eapi wise, just set
124 the DEPENDENCIES directly; those that have to support multiple eapi's
125 (aka, every fricking eclass that exists right now) can just use the
126 old form, shifting into the new form as things progress.
127
128
129 Either way, the dual parsing required for exheres version I'm -1 on;
130 I'm generally wary of NIH modifications, but the form I've mentioned
131 that reuses our existing machinery is +.5...ish... from my standpoint
132 (+1 on the form, just kind of 'meh' on the single var angle despite
133 mostly agreeing w/ the reasoning).
134
135 Either way, on w/ the flaming/insinuations of
136 idiocy/counter-insinuations of being a wee bit too friendly w/
137 sheep...
138 ~harring

Replies