Gentoo Archives: gentoo-pms

From: Ulrich Mueller <ulm@g.o>
To: gentoo-pms@l.g.o
Subject: Re: [gentoo-pms] EAPI specification in ebuilds
Date: Sun, 13 May 2012 19:00:28
Message-Id: 20400.1217.575587.503643@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-pms] EAPI specification in ebuilds by David Leverton
1 >>>>> On Sun, 13 May 2012, David Leverton wrote:
2
3 > Apologies for not noticing these sooner, but now that I come to
4 > implement it...
5
6 >> +\begin{verbatim}
7 >> +^[ \t]*EAPI=(['"]?)([A-Za-z0-9+_.-]*)\1[ \t]*(#.*)?$
8 >> +\end{verbatim}
9
10 > 1) Should an empty value be allowed here?
11
12 That was the intention, because the spec says that an empty value is
13 equivalent to 0.
14
15 > 2) If there's a trailing comment it needs to have at least one
16 > whitespace between it and the end of the value:
17
18 > [dleverton@shiny-one pms] $ EAPI=123#foo
19 > [dleverton@shiny-one pms] $ echo ${EAPI}
20 > 123#foo
21
22 Darn. So we need another [ \t] in the last subexpression:
23
24 -^[ \t]*EAPI=(['"]?)([A-Za-z0-9+_.-]*)\1[ \t]*(#.*)?$
25 +^[ \t]*EAPI=(['"]?)([A-Za-z0-9+_.-]*)\1[ \t]*([ \t]#.*)?$
26
27 >> +The package manager may optionally determine the EAPI of an ebuild by parsing its first non-blank
28 >> +and non-comment line, using above regular expression. If a recognised EAPI has been determined
29 >> +such, then the package manager must make sure that the \t{EAPI} value obtained by sourcing the
30 >> +ebuild with bash is identical to the EAPI obtained by parsing. The ebuild must be treated as
31 >> +invalid if these values are different.
32
33 > 3) If the first non-blank non-comment /doesn't/ match the magic regexp,
34 > should the PM insist that the post-source EAPI is 0 (or unset), or
35 > should it accept whatever it gets?
36
37 The former. If the first non-blank non-comment doesn't match the
38 regexp, then the EAPI determined by parsing is 0 (or empty, which is
39 equivalent).
40
41 Do we need to clarify the wording here? (Patches are welcome.)
42
43 Ulrich

Replies

Subject Author
[gentoo-pms] [PATCH 1/2] Clarify wording for EAPI parsing David Leverton <levertond@××××××××××.com>
[gentoo-pms] [PATCH 2/2] Require a space before the trailing comment David Leverton <levertond@××××××××××.com>