Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFD: EAPI specification in ebuilds
Date: Thu, 08 Mar 2012 19:05:56
Message-Id: 20313.727.252505.854931@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] RFD: EAPI specification in ebuilds by "Michał Górny"
1 >>>>> On Thu, 8 Mar 2012, Micha³ Górny wrote:
2
3 >> *** Proposal 1: "Parse the EAPI assignment statement" ***
4 >>
5 >> [...]
6 >>
7 >> Written in a more formal way, appropriate for a specification:
8 >> - Ebuilds must contain at most one EAPI assignment statement.
9 >> - It must occur within the first N lines of the ebuild (N=10 and N=30
10 >> have been suggested).
11 >> - The statement must match the following regular expression (extended
12 >> regexp syntax):
13 >> ^[ \t]*EAPI=(['"]?)([A-Za-z0-9._+-]*)\1[ \t]*(#.*)?$
14
15 > I'd make the regexp less strict -- at least allow whitespace around '='.
16 > If the intent is to not rely on a specific bash version for a global
17 > scope, why should we limit it to the (current) bash syntax?
18
19 This could certainly be done ...
20
21 > And it may be also a good idea to not rely on a specific line format,
22 > so e.g. 'dnl EAPI=4' will work as well.
23
24 ... but loosening it too much looks a little dangerous, because it
25 would probably match comments and could produce unintended matches.
26
27 If we allow for a general syntax, we should restrict it to the first
28 line of the ebuild. But that is proposal 2 then.
29
30 >> 1b) It is only applied for EAPI 5 and later (which means that the
31 >> result of the EAPI parsing would be discarded for earlier EAPIs).
32
33 > Err... so what happens if 'new parsing' detects EAPI 4 and 'old
34 > parsing' detects EAPI 5?
35
36 This cannot happen for a legal ebuild:
37 - If the ebuild is EAPI 4, then sourcing it ("old parsing") must
38 detect EAPI 4.
39 - If the ebuild is EAPI 5, then "new parsing" must detect EAPI 5.
40
41 > Or more exactly, how does it know when an older EAPI is used if it
42 > is supposed to not use the value it uses to detect EAPI?
43
44 If new parsing detects EAPI 5 or later, then use this value (and do a
45 sanity check after the ebuild has been sourced). Otherwise, discard
46 the value determined by new parsing and detect the EAPI in the
47 traditional way by sourcing the ebuild.
48
49 Ulrich

Replies

Subject Author
Re: [gentoo-dev] RFD: EAPI specification in ebuilds Alexis Ballier <aballier@g.o>