1 |
>>>>> On Sat, 7 Apr 2012, Ulrich Mueller wrote: |
2 |
|
3 |
>>>>> On Fri, 6 Apr 2012, David Leverton wrote: |
4 |
>>> Right, assigning the same EAPI twice would be an example for an |
5 |
>>> ebuild that is invalid but accepted by the package manager. But |
6 |
>>> would this cause any problems? |
7 |
|
8 |
>> It's not that it's a problem in itself, it just struck me as an edge |
9 |
>> case with the potential for implementations to differ. As long as |
10 |
>> everyone's clear what the rules are it's fine. |
11 |
|
12 |
> Maybe the spec should say that the first match must be used: |
13 |
|
14 |
> "The package manager may optionally determine the EAPI of an ebuild by |
15 |
> parsing it, using the first match for the above regular expression |
16 |
> within the above line number limit." |
17 |
|
18 |
See updated patch below. |
19 |
|
20 |
Ulrich |
21 |
|
22 |
|
23 |
--- a/ebuild-vars.tex |
24 |
+++ b/ebuild-vars.tex |
25 |
@@ -75,7 +75,7 @@ |
26 |
|
27 |
\begin{description} |
28 |
\item[DEPEND] See section~\ref{sec:dependencies}. |
29 |
-\item[EAPI] The EAPI. See below for defaults. |
30 |
+\item[EAPI] The EAPI. See below. |
31 |
\item[PDEPEND] See section~\ref{sec:dependencies}. |
32 |
\item[RDEPEND] See section~\ref{sec:dependencies}. For some EAPIs, \t{RDEPEND} has special behaviour |
33 |
for its value if unset and when used with an eclass. See section~\ref{sec:rdepend-depend} for |
34 |
@@ -124,6 +124,23 @@ |
35 |
If any of these variables are set to invalid values, the package manager's behaviour is undefined; |
36 |
ideally, an error in one ebuild should not prevent operations upon other ebuilds or packages. |
37 |
|
38 |
+To enable parsing of ebuilds for the \t{EAPI} value, the \t{EAPI} assignment statement must adhere |
39 |
+to the following syntax: It must consist of the string \t{EAPI}, followed by an equals sign, |
40 |
+followed by the \t{EAPI} value, optionally enclosed in single or double quotes. The statement must |
41 |
+be on its own line, optionally preceded or followed by whitespace (spaces or tabs), optionally |
42 |
+followed by a comment. Thus, the line must match the following regular expression: |
43 |
+\begin{verbatim} |
44 |
+^[ \t]*EAPI=(['"]?)([A-Za-z0-9+_.-]*)\1[ \t]*(#.*)?$ |
45 |
+\end{verbatim} |
46 |
+If an ebuild contains an \t{EAPI} assignment, the statement must occur within the first 20 lines. |
47 |
+An ebuild must not contain more than one \t{EAPI} assignment. |
48 |
+ |
49 |
+The package manager may optionally determine the \t{EAPI} of an ebuild by parsing it, using the |
50 |
+first match for the above regular expression within the above line number limit. If a recognised |
51 |
+\t{EAPI} has been determined such, then the package manager must make sure that the \t{EAPI} value |
52 |
+obtained by sourcing the ebuild with bash is identical to the one obtained by parsing. The ebuild |
53 |
+must be treated as invalid if these values are different. |
54 |
+ |
55 |
\subsection{\t{RDEPEND} value} |
56 |
\label{sec:rdepend-depend} |