1 |
On Fri, 15 May 2009 14:43:29 -0500 |
2 |
William Hubbs <williamh@g.o> wrote: |
3 |
> On Thu, May 14, 2009 at 10:53:37PM +0100, Ciaran McCreesh wrote: |
4 |
> > It can't, because it doesn't know the EAPI until it's sourced the |
5 |
> > thing using bash. Using things like += in global scope will break |
6 |
> > older bash versions to the point that they can't reliably extract |
7 |
> > EAPI. |
8 |
> |
9 |
> I just figured out a line in bash that will get an EAPI without |
10 |
> sourcing the ebuild: |
11 |
> |
12 |
> eval `grep '^EAPI=' ebuildfile | head -n 1` |
13 |
> |
14 |
> will set EAPI in the current scope to EAPI in the ebuild, without |
15 |
> sourcing it, unless the issue with something like this would be its |
16 |
> use of grep and head, but these are both in the system set, so unless |
17 |
> you don't want to depend on the system set, I don't know what the |
18 |
> objection would be. |
19 |
|
20 |
The objection is that your code doesn't work. It's entirely legal to |
21 |
do, say: |
22 |
|
23 |
export EAPI="1" |
24 |
|
25 |
or: |
26 |
|
27 |
inherit versionator |
28 |
|
29 |
if version_is_at_least 2 ; then |
30 |
EAPI="2" |
31 |
else |
32 |
EAPI="0" |
33 |
fi |
34 |
|
35 |
Besides, if we were able to do what your code does, we'd just code it |
36 |
natively, not use external programs. |
37 |
|
38 |
-- |
39 |
Ciaran McCreesh |