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] ebuild.sh: fix pkg_setup env for binary packages (528274)
Date: Sat, 29 Nov 2014 23:46:48
Message-Id: 1417304796-30780-1-git-send-email-zmedico@gentoo.org
1 In commit 743b3337644fbb3ea461d3a9137c9ac85e163f03, support for binary
2 packages broke, since binary packages must load the environment from
3 $T/environment. This patch fixes the logic to handle binary packages
4 correctly.
5
6 Fixes: 743b3337644f ("ebuild.sh: force fresh env for pkg_setup (528274)")
7 X-Gentoo-Bug: 528274
8 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=528274
9 ---
10 bin/ebuild.sh | 6 ++++--
11 pym/portage/package/ebuild/config.py | 4 +++-
12 2 files changed, 7 insertions(+), 3 deletions(-)
13
14 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
15 index 232bf44..2ed1335 100755
16 --- a/bin/ebuild.sh
17 +++ b/bin/ebuild.sh
18 @@ -501,7 +501,8 @@ fi
19 export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
20 trap 'exit 1' SIGTERM
21
22 -if ! has "$EBUILD_PHASE" clean cleanrm depend setup && \
23 +if ! has "$EBUILD_PHASE" clean cleanrm depend && \
24 + ! [[ $EMERGE_FROM = ebuild && $EBUILD_PHASE = setup ]] && \
25 [ -f "${T}"/environment ] ; then
26 # The environment may have been extracted from environment.bz2 or
27 # may have come from another version of ebuild.sh or something.
28 @@ -550,7 +551,8 @@ eval "PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS})"
29 # Source the ebuild every time for FEATURES=noauto, so that ebuild
30 # modifications take effect immediately.
31 if ! has "$EBUILD_PHASE" clean cleanrm ; then
32 - if [[ $EBUILD_PHASE =~ ^(depend|setup)$ || ! -f $T/environment || \
33 + if [[ $EBUILD_PHASE = setup && $EMERGE_FROM = ebuild ]] || \
34 + [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
35 -f $PORTAGE_BUILDDIR/.ebuild_changed || \
36 " ${FEATURES} " == *" noauto "* ]] ; then
37 # The bashrcs get an opportunity here to set aliases that will be expanded
38 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
39 index ca15f81..59e239b 100644
40 --- a/pym/portage/package/ebuild/config.py
41 +++ b/pym/portage/package/ebuild/config.py
42 @@ -2663,9 +2663,11 @@ class config(object):
43 eapi = self.get('EAPI')
44 eapi_attrs = _get_eapi_attrs(eapi)
45 phase = self.get('EBUILD_PHASE')
46 + emerge_from = self.get('EMERGE_FROM')
47 filter_calling_env = False
48 if self.mycpv is not None and \
49 - phase not in ('clean', 'cleanrm', 'depend', 'fetch', 'setup'):
50 + not (emerge_from == 'ebuild' and phase == 'setup') and \
51 + phase not in ('clean', 'cleanrm', 'depend', 'fetch'):
52 temp_dir = self.get('T')
53 if temp_dir is not None and \
54 os.path.exists(os.path.join(temp_dir, 'environment')):
55 --
56 2.0.4

Replies