Gentoo Archives: gentoo-dev

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

Replies