1 |
On 12 March 2012 21:27, Michał Górny <mgorny@g.o> wrote: |
2 |
> And we could just use a good regex for that instead. |
3 |
> |
4 |
> Something like: [eE][aA][pP][iI] <whitespace-or-symbols> [a-z0-9-+]+ |
5 |
> |
6 |
> and just require users for this to be the first thing declared in |
7 |
> an ebuild. Of course, this could make problems with stuff like: |
8 |
> |
9 |
> # EAPI 4 because of foobarbaz |
10 |
> EAPI=4 |
11 |
> |
12 |
> (on the other hand, in this particular case it will fetch '4' anyway). |
13 |
> |
14 |
> And this will work as well with: |
15 |
> |
16 |
> <eapi>15-xml</eapi> |
17 |
> |
18 |
> and |
19 |
> |
20 |
> - eapi: 15-yaml |
21 |
> |
22 |
|
23 |
Also, remember the proposal is to read it only from the first 10-30 |
24 |
lines of the file, and if you're *generating* YAML/XML , then this is |
25 |
not necessarily guaranteed. |
26 |
|
27 |
Some generation tools emit keys in alphanumeric ordering, others |
28 |
psuedo-randomly, and the EAPI declaration line in some formats could |
29 |
easily be on the very last line of the file. |
30 |
|
31 |
And then the regexp could falsely detect something in another key the |
32 |
original author had not intended as an EAPI definition, but merely a |
33 |
comment, ... |
34 |
|
35 |
ie: |
36 |
|
37 |
<generateddata> |
38 |
<comment> This is a user comment, hurr, I hate EAPI 5 </comment> |
39 |
<eapi value="15" /> |
40 |
</generateddata> |
41 |
|
42 |
|
43 |
-- |
44 |
Kent |
45 |
|
46 |
perl -e "print substr( \"edrgmaM SPA NOcomil.ic\\@tfrken\", \$_ * 3, |
47 |
3 ) for ( 9,8,0,7,1,6,5,4,3,2 );" |