Gentoo Archives: gentoo-dev

From: Ben de Groot <yngwin@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] EAPI5: require ebuilds/eclasses to not use any vars/funcs prefixed with __
Date: Thu, 13 Sep 2012 03:31:52
Message-Id: CAB9SyzSgdGHvAG5VGPLyvin-CiVQTb1rBTcbfudCntys2+ArGQ@mail.gmail.com
In Reply to: [gentoo-dev] EAPI5: require ebuilds/eclasses to not use any vars/funcs prefixed with __ by Brian Harring
1 On 13 September 2012 04:36, Brian Harring <ferringb@×××××.com> wrote:
2 > Hola folks.
3 >
4 > Currently portage exposes a fair amount of it's internal
5 > implementation via vars/funcs into the ebulid env; this frankly makes
6 > it easier for ebuilds/eclasses to localize themselves to portage
7 > (rather than PMS), leading to breakage.
8 >
9 > Thus a proposal for EAPI5 has been made, banning ebuilds/eclasses from
10 > using/accessing __, and requiring the PM to store it's internals in
11 > that namespace.
12 >
13 > Basically, instead of portage doing thus:
14 >
15 > is_function dyn_pkg_preinst && dyn_pkg_preinst
16 >
17 > It does thus:
18 >
19 > __is_function __dyn_pkg_preinst && __dyn_pkg_preinst.
20 >
21 > Aside from avoiding accidental conflicts/usage, the standardized
22 > namespacing makes it a helluva lot easier to have repoman/qa tools
23 > look for bad usage.
24 >
25 > Currently, there is a minor amount of ebuild/eclass usage of things
26 > named __*; ~90% of it is 'import once' eclass code like the following:
27 >
28 > """
29 > if [[ ${___ECLASS_ONCE_LIBTOOL} != "recur -_+^+_- spank" ]] ; then
30 > ___ECLASS_ONCE_LIBTOOL="recur -_+^+_- spank
31 > """
32 >
33 > Converting that is easy enough, and I'll be doing that work for
34 > gentoo-x86 if folks don't have an issue.
35 >
36 > Note there is a few vars we need to exempt; that list is currently
37 > SANDBOX_* and FEATURES. FEATURES is fine to exempt from this rule.
38 >
39 > For SANDBOX_*, while that's a PM internal, that's a bit of a grey
40 > zone; regardless, we can actually address that via extending the
41 > sandbox functions a bit:
42 >
43 > addwrite [-r|--remove] pathway # for example, to do a removal.
44 >
45 > For instances where the sandbox needs to be turned off for a command-
46 > we do the same thing we did w/ nonfatal;
47 >
48 > sandboxless <the command and args>
49 >
50 > which is just
51 > sandboxless() {
52 > SANDBOX_ON=0 "$@"
53 > }
54 >
55 > or SYDBOX_ON=0 (or their equivalent var) for sydbox usage.
56 >
57 > Comments?
58 > ~harring
59 >
60
61 I support this. It seems very sane.
62
63 --
64 Cheers,
65
66 Ben | yngwin
67 Gentoo developer
68 Gentoo Qt project lead, Gentoo Wiki admin