Gentoo Archives: gentoo-pms

From: David Leverton <levertond@××××××××××.com>
To: gentoo-pms@l.g.o
Subject: Re: [gentoo-pms] License for code snippets included in PMS
Date: Sun, 13 Mar 2011 17:14:47
Message-Id: AANLkTikYN3imBPSNWbLd1b4V7gNjSeZvYQN424VP1oPw@mail.gmail.com
In Reply to: Re: [gentoo-pms] License for code snippets included in PMS by Brian Harring
1 On 13 March 2011 16:40, Brian Harring <ferringb@×××××.com> wrote:
2 > This section wasn't accurate, as such I threw it out- attached is a
3 > brain dump of exactly what characteristics can be relied on for
4 > env saving, and should be reasonably complete.
5 >
6 > Could stand to have some comments added though.
7
8 As discussed on IRC, the use of "declare" here is problematic, because
9 inside a function it acts like "local", even if said function is part
10 of the PM that sources the ebuild. This would put a pretty nasty
11 constraint on the PM implementation, and wouldn't work in eclasses
12 anyway because of the "inherit" function. Arrays can still be used
13 simply by not using "declare" and just assigning them, which doesn't
14 have the implicit local attached, so all that's needed is to change
15 "declare -a ARRAY_VARIABLE=( a b )" in the patch to simply
16 "ARRAY_VARIABLE=( a b )".
17
18 (See also http://bugs.gentoo.org/show_bug.cgi?id=309369, in which this
19 caused problems with loading environment.bz2 files.)
20
21 As an aside, bash 4.2 has "declare -g" to override the implicit local,
22 but it'll be a while before we can start using that in ebuilds.