1 |
On Tue, Mar 13, 2012 at 07:30:22AM +0000, Ciaran McCreesh wrote |
2 |
|
3 |
> EAPI is special. You need to know EAPI to be able to get the rest of |
4 |
> the metadata. |
5 |
> |
6 |
> > 2) Any potential ebuild processor that's incapable of looking for |
7 |
> > regex "^EAPI=" in a textfile, amd parsing the numbers that follow, |
8 |
> > has no business being used to process ebuilds. |
9 |
> |
10 |
> That doesn't get you the EAPI. |
11 |
|
12 |
On Tue, Mar 13, 2012 at 12:03:34AM -0700, Brian Harring wrote |
13 |
|
14 |
> Perfectly valid, if stupid, bash: |
15 |
> |
16 |
> EAPI=3 |
17 |
> EAPI=4 |
18 |
> |
19 |
> Which is the PM to choose? Because if your answer is "the first", |
20 |
> then you need to keep in mind that any following code (including |
21 |
> eclasses that test eapi) will be seeing the second during sourcing. |
22 |
> Nice little gotcha, that one. |
23 |
> |
24 |
> I'm aware people have suggested "make EAPI readonly" to try and deal |
25 |
> w/ this; that however means it'll break any PM that uses eval for |
26 |
> loading the ebuild, and means that every ebuild sourcing for phase |
27 |
> running will throw a complaint about EAPI being readonly. |
28 |
> |
29 |
> I don't hugely expect PMs to screw up the ordering of which to chose, |
30 |
> although it exists; trying to ban secondary settings is also an |
31 |
> approach... but all of it points to the fact it's a fricking hack and |
32 |
> isn't really worth doing. |
33 |
|
34 |
I'm answering Ciaran's and Brian's posts together, because the answer |
35 |
is the same for both... namely, we need a 2-pass processor, regardless |
36 |
of whether it's bash/perl/python/whatever. Pass 1 checks for syntax |
37 |
errors and retrieves "special" variables, answering Ciaran's concern. |
38 |
Today, it's EAPI. In future, there may be others. Pass 2 does the |
39 |
build, assuming no errors detected in pass 1. |
40 |
|
41 |
Under the heading of "syntax errors", I would include multiple EAPI |
42 |
declarations. My response to Brian is that portage should not try to |
43 |
outguess or fix or override an obviously broken ebuild. It should |
44 |
return an error message (in this case "Multiple EAPI declarations not |
45 |
allowed") and then halt. It is the ebuild-writer's job to come up with |
46 |
a syntactically correct ebuild. |
47 |
|
48 |
-- |
49 |
Walter Dnes <waltdnes@××××××××.org> |