Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] ebuild: set up bash compat levels
Date: Wed, 11 Nov 2015 19:42:32
Message-Id: 56439A24.9060901@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] ebuild: set up bash compat levels by Mike Frysinger
1 On 11/10/2015 08:39 PM, Mike Frysinger wrote:
2 > To try and provide better stability across bash versions,
3 > set the language compat level based on the current EAPI.
4 > ---
5 > bin/eapi.sh | 8 ++++++++
6 > bin/ebuild.sh | 39 +++++++++++++++++++++++++++++++++++++++
7 > 2 files changed, 47 insertions(+)
8 >
9 > diff --git a/bin/eapi.sh b/bin/eapi.sh
10 > index 528e6f2..b236344 100644
11 > --- a/bin/eapi.sh
12 > +++ b/bin/eapi.sh
13 > @@ -191,3 +191,11 @@ ___eapi_enables_failglob_in_global_scope() {
14 > ___eapi_enables_globstar() {
15 > [[ ${1-${EAPI-0}} =~ ^(4-python|5-progress)$ ]]
16 > }
17 > +
18 > +__eapi_bash_3_2() {
19 > + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
20 > +}
21 > +
22 > +__eapi_bash_4_2() {
23 > + [[ ${1-${EAPI-0}} =~ ^(6)$ ]]
24 > +}
25 > diff --git a/bin/ebuild.sh b/bin/ebuild.sh
26 > index 75a9d24..2d09fb8 100755
27 > --- a/bin/ebuild.sh
28 > +++ b/bin/ebuild.sh
29 > @@ -6,8 +6,47 @@
30 > # Make sure it's before everything so we don't mess aliases that follow.
31 > unalias -a
32 >
33 > +# Make sure this isn't exported to scripts we execute.
34 > +unset BASH_COMPAT
35 > +
36 > source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
37 >
38 > +# Set up the bash version compatibility level.
39 > +__check_bash_version() {
40
41 Please unset all new internal function inside bin/save-ebuild-env.sh.
42 Note that it already uses this line to unset functions beginning with
43 ___eapi:
44
45 unset -f $(compgen -A function ___eapi_)
46
47 However, your __eapi functions will not be matched because they only
48 begin with 2 underscores.
49 --
50 Thanks,
51 Zac

Replies