Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH v3] ebuild.sh: force fresh env for pkg_setup (528274)
Date: Thu, 27 Nov 2014 20:39:59
Message-Id: 1417120789-3809-1-git-send-email-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] ebuild.sh: force fresh env for pkg_setup (528274) by Zac Medico
1 In ebuild.sh, $T/environment is loaded for most phases, but it should
2 always start with a fresh environment for pkg_setup. Therefore, skip
3 environment loading for pkg_setup, and force the ebuild to be sourced.
4
5 This also requires a change in the config.environ method, in order
6 to ensure that the calling environment is inherited by pkg_setup
7 (even though $T/environment may exist).
8
9 X-Gentoo-Bug: 528274
10 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=528274
11 ---
12 PATCH v3 fixes ebuild.sh to force the ebuild to be sourced for
13 pkg_setup.
14
15 bin/ebuild.sh | 4 ++--
16 pym/portage/package/ebuild/config.py | 2 +-
17 2 files changed, 3 insertions(+), 3 deletions(-)
18
19 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
20 index 658884a..232bf44 100755
21 --- a/bin/ebuild.sh
22 +++ b/bin/ebuild.sh
23 @@ -501,7 +501,7 @@ fi
24 export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
25 trap 'exit 1' SIGTERM
26
27 -if ! has "$EBUILD_PHASE" clean cleanrm depend && \
28 +if ! has "$EBUILD_PHASE" clean cleanrm depend setup && \
29 [ -f "${T}"/environment ] ; then
30 # The environment may have been extracted from environment.bz2 or
31 # may have come from another version of ebuild.sh or something.
32 @@ -550,7 +550,7 @@ eval "PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS})"
33 # Source the ebuild every time for FEATURES=noauto, so that ebuild
34 # modifications take effect immediately.
35 if ! has "$EBUILD_PHASE" clean cleanrm ; then
36 - if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
37 + if [[ $EBUILD_PHASE =~ ^(depend|setup)$ || ! -f $T/environment || \
38 -f $PORTAGE_BUILDDIR/.ebuild_changed || \
39 " ${FEATURES} " == *" noauto "* ]] ; then
40 # The bashrcs get an opportunity here to set aliases that will be expanded
41 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
42 index aca27f2..ca15f81 100644
43 --- a/pym/portage/package/ebuild/config.py
44 +++ b/pym/portage/package/ebuild/config.py
45 @@ -2665,7 +2665,7 @@ class config(object):
46 phase = self.get('EBUILD_PHASE')
47 filter_calling_env = False
48 if self.mycpv is not None and \
49 - phase not in ('clean', 'cleanrm', 'depend', 'fetch'):
50 + phase not in ('clean', 'cleanrm', 'depend', 'fetch', 'setup'):
51 temp_dir = self.get('T')
52 if temp_dir is not None and \
53 os.path.exists(os.path.join(temp_dir, 'environment')):
54 --
55 2.0.4