Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 5/6] Support ENV_UNSET for EAPI 7
Date: Tue, 06 Mar 2018 16:55:40
Message-Id: 20180306165505.19087-6-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 0/6] EAPI 7, part II by "Michał Górny"
1 Bug: https://bugs.gentoo.org/499288
2 ---
3 bin/eapi.sh | 4 ++++
4 bin/ebuild.sh | 5 +++++
5 pym/_emerge/actions.py | 4 ++--
6 pym/portage/const.py | 3 ++-
7 pym/portage/package/ebuild/_config/special_env_vars.py | 2 +-
8 5 files changed, 14 insertions(+), 4 deletions(-)
9
10 diff --git a/bin/eapi.sh b/bin/eapi.sh
11 index cd2acad80..3e837f19d 100644
12 --- a/bin/eapi.sh
13 +++ b/bin/eapi.sh
14 @@ -223,3 +223,7 @@ ___eapi_bash_3_2() {
15 ___eapi_bash_4_2() {
16 ! ___eapi_bash_3_2 "$@"
17 }
18 +
19 +___eapi_has_ENV_UNSET() {
20 + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6)$ ]]
21 +}
22 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
23 index 47894b0e6..1b9557984 100755
24 --- a/bin/ebuild.sh
25 +++ b/bin/ebuild.sh
26 @@ -137,6 +137,11 @@ shift $#
27
28 # Unset some variables that break things.
29 unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
30 +if ___eapi_has_ENV_UNSET; then
31 + for x in ${ENV_UNSET}; do
32 + unset "${x}"
33 + done
34 +fi
35
36 [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
37
38 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
39 index 97df9f716..2293560c1 100644
40 --- a/pym/_emerge/actions.py
41 +++ b/pym/_emerge/actions.py
42 @@ -1,4 +1,4 @@
43 -# Copyright 1999-2016 Gentoo Foundation
44 +# Copyright 1999-2018 Gentoo Foundation
45 # Distributed under the terms of the GNU General Public License v2
46
47 from __future__ import division, print_function, unicode_literals
48 @@ -1817,7 +1817,7 @@ def action_info(settings, trees, myopts, myfiles):
49 myvars = list(settings)
50 else:
51 myvars = ['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
52 - 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR',
53 + 'DISTDIR', 'ENV_UNSET', 'PKGDIR', 'PORTAGE_TMPDIR',
54 'PORTAGE_BUNZIP2_COMMAND',
55 'PORTAGE_BZIP2_COMMAND',
56 'USE', 'CHOST', 'CFLAGS', 'CXXFLAGS',
57 diff --git a/pym/portage/const.py b/pym/portage/const.py
58 index 655be82b1..16922a5e6 100644
59 --- a/pym/portage/const.py
60 +++ b/pym/portage/const.py
61 @@ -1,5 +1,5 @@
62 # portage: Constants
63 -# Copyright 1998-2014 Gentoo Foundation
64 +# Copyright 1998-2018 Gentoo Foundation
65 # Distributed under the terms of the GNU General Public License v2
66
67 from __future__ import unicode_literals
68 @@ -89,6 +89,7 @@ INCREMENTALS = (
69 "ACCEPT_KEYWORDS",
70 "CONFIG_PROTECT",
71 "CONFIG_PROTECT_MASK",
72 + "ENV_UNSET",
73 "FEATURES",
74 "IUSE_IMPLICIT",
75 "PRELINK_PATH",
76 --
77 2.16.2