1 |
On Friday 02 September 2005 07:27, Zac Medico wrote: |
2 |
> Paul de Vrieze wrote: |
3 |
> > On Wednesday 31 August 2005 14:57, Brian Harring wrote: |
4 |
> >> Re: tagging EAPI at the top of a file, infra would probably shoot me |
5 |
> >> for doing such- till a live, fully compatible and *roughly* |
6 |
> >> equivalent parser is available, portage would have to do a bit of |
7 |
> >> grepping, jacking up the regen times. |
8 |
> > |
9 |
> > If in cache EAPI can be gotten from the cache. If not, I don't think |
10 |
> > it matters where in the file EAPI occurs from the standpoint of |
11 |
> > getting it's value. The only thing would be that in the future a fast |
12 |
> > EAPI parser could be made that would just look at EAPI and get its |
13 |
> > version. I could easilly write you such a parser. |
14 |
> |
15 |
> It is impossible write a parser for an unconstrained and unknown format |
16 |
> that may exist in the future. If we put a constraint on the format, in |
17 |
> order to parse the EAPI, then we contradict our original goal (to |
18 |
> unconstrain the format). |
19 |
|
20 |
It would be possible to make these restrictions small. A workable |
21 |
restriction could be to put the EAPI statement in the front of the file |
22 |
only preceded by whitespace and comments. After the line with the EAPI |
23 |
statement anything could happen. Even a completely binary format could be |
24 |
used. But indeed no constraints is impossible, so putting the format |
25 |
statement in the start of the file is the best solution. Besides the fact |
26 |
that it makes detecting the format that much faster, and allows bailing |
27 |
out before parsing the whole file if an unsupported api is detected. |
28 |
|
29 |
> A better approach IMO would be to store the EAPI in a separate file |
30 |
> such as metadata.xml. This would allow *absolute* flexibility in the |
31 |
> "ebuild" format. Portage would be able to select an appropriate parser |
32 |
> with no need to examine the "ebuild" itself. |
33 |
|
34 |
Please don't. Parsing xml is a lot harder than recognizing lines. A simple |
35 |
EAPI parser would probably use canned (library) line reading functions |
36 |
and then look if the line starts with "EAPI=". If so it reads the EAPI, |
37 |
else it checks the next line. No need to understand anything else of the |
38 |
file format. |
39 |
|
40 |
Paul |
41 |
|
42 |
-- |
43 |
Paul de Vrieze |
44 |
Gentoo Developer |
45 |
Mail: pauldv@g.o |
46 |
Homepage: http://www.devrieze.net |