Gentoo Archives: gentoo-dev

From: "Fernando J. Pereda" <ferdy@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [GLEP] Use EAPI-suffixed ebuilds (.ebuild-EAPI)
Date: Tue, 18 Dec 2007 17:24:56
Message-Id: 20071218172143.GB4423@ferdyx.org
In Reply to: [gentoo-dev] Re: [GLEP] Use EAPI-suffixed ebuilds (.ebuild-EAPI) by Steve Long
1 On Tue, Dec 18, 2007 at 05:05:13PM +0000, Steve Long wrote:
2 > Thomas de Grenier de Latour wrote:
3 >
4 > > On 2007/12/18, Ciaran McCreesh <ciaran.mccreesh@×××××××××××××.uk> wrote:
5 > >
6 > >> On Mon, 17 Dec 2007 17:10:46 -0700
7 > >> Joe Peterson <lavajoe@g.o> wrote:
8 > >> > I probably missed some of the stuff leading up to this GLEP, but
9 > >> > what is the problem with having the EAPI in the file and
10 > >> > determining it by looking at the file contents?
11 > >>
12 > >> Motivation, second bullet point:
13 > >>
14 > >> | Possibility to extend the behaviour of inherit and add new global
15 > >> | scope functions (as a result of not sourcing ebuilds with
16 > >> | unsupported EAPI).
17 > >
18 > > Why can't it be in the file but readable without sourcing? For instance,
19 > > it could be mandatory that EAPI=X, if present, must be the first
20 > > non-blank and non-comment line of the ebuild (and it would then be
21 > > checked after sourcing, if the ebuild is sourced, to bug on cases where
22 > > it's redefined or unset afterwards).
23 > >
24 > There's _no_ need to source, nor constrain like that, for a simple one-line
25 > variable, eg:
26 > $ sed -nr '/^[[:space:]]*DESCRIPTION="([^"]*)".*/ { s//\1/p;q; }' \
27 > app-portage/autounmask/autounmask-0.21.ebuild
28 > autounmask - Unmasking packages the easy way
29 >
30 > eapi=$(sed -nr '/^[[:space:]]*EAPI="([^"]*)".*/ { s//\1/p;q; }' foo.ebuild)
31 > [[ $eapi ]] && checkAPI "$eapi"
32 > ..would do it in bash (empty if unset in ebuild) assuming the conventional
33 > EAPI="xx" format is used. Other languages can call system() easily enough.
34
35 This is just *brillant*. Lets see how useful your solution is:
36
37 --- 8< ---
38 # EAPI has to be set differently based upon tests on PV
39 if [[ -z ${PV/?.?/} ]] ; then
40 EAPI="bar-1"
41 elif [[ -z ${PV/?.?.?/} ]] ; then
42 EAPI="0"
43 else
44 EAPI="1"
45 fi
46 --- 8< ---
47
48 So please, no hacks.
49
50 - ferdy
51
52 --
53 Fernando J. Pereda Garcimartín
54 20BB BDC3 761A 4781 E6ED ED0B 0A48 5B0C 60BD 28D4

Replies

Subject Author
[gentoo-dev] Re: Re: [GLEP] Use EAPI-suffixed ebuilds (.ebuild-EAPI) Steve Long <slong@××××××××××××××××××.uk>