Gentoo Archives: gentoo-pms

From: Ulrich Mueller <ulm@g.o>
To: gentoo-pms@l.g.o
Subject: [gentoo-pms] EAPI specification in ebuilds
Date: Fri, 06 Apr 2012 07:40:32

The council has decided in its April meeting [1] that we should take
the route of parsing the EAPI assignment in ebuilds. Please find below
a draft wording for PMS. Thanks to dleverton, ferringb, and zmedico
for their input.

The plan would be to allow optional parsing now, and make it mandatory
in future, when EAPI 5 is introduced (i.e. EAPI 5 aware package
managers would have to implement it).


[1] <>

--- a/ebuild-vars.tex
+++ b/ebuild-vars.tex
@@ -75,7 +75,7 @@ Ebuilds may define any of the following variables:
 \item[DEPEND] See section~\ref{sec:dependencies}.
-\item[EAPI] The EAPI. See below for defaults.
+\item[EAPI] The EAPI. See below.
 \item[PDEPEND] See section~\ref{sec:dependencies}.
 \item[RDEPEND] See section~\ref{sec:dependencies}. For some EAPIs, \t{RDEPEND} has special behaviour
     for its value if unset and when used with an eclass. See section~\ref{sec:rdepend-depend} for
@@ -124,6 +124,23 @@ ensure that it is unset.
 If any of these variables are set to invalid values, the package manager's behaviour is undefined;
 ideally, an error in one ebuild should not prevent operations upon other ebuilds or packages.
+To enable parsing of ebuilds for the \t{EAPI} value, the \t{EAPI} assignment statement must adhere
+to the following syntax: It must consist of the string \t{EAPI}, followed by an equals sign,
+followed by the \t{EAPI} value, optionally enclosed in single or double quotes. The statement must
+be on its own line, optionally preceded or followed by whitespace (spaces or tabs), optionally
+followed by a comment. Thus, the line must match the following regular expression:
+^[ \t]*EAPI=(['"]?)([A-Za-z0-9+_.-]*)\1[ \t]*(#.*)?$
+If an ebuild contains an \t{EAPI} assignment, the statement must occur within the first 20 lines.
+It is an error for an ebuild to contain more than one \t{EAPI} assignment.
+The package manager may optionally determine the \t{EAPI} of an ebuild by parsing it, using above
+regular expression and line number limit. If a recognised \t{EAPI} has been determined such, then
+the package manager must make sure that the \t{EAPI} value obtained by sourcing the ebuild with
+bash is identical to the one obtained by parsing. The ebuild must be treated as invalid if these
+values are different.
 \subsection{\t{RDEPEND} value}


Subject Author
Re: [gentoo-pms] EAPI specification in ebuilds "Robin H. Johnson" <robbat2@g.o>
Re: [gentoo-pms] EAPI specification in ebuilds Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>
Re: [gentoo-pms] EAPI specification in ebuilds David Leverton <levertond@××××××××××.com>