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 |
PATCH v2 fixes the doebuild function to export the internal EMERGE_FROM |
11 |
variable unconditionally. |
12 |
|
13 |
bin/ebuild.sh | 6 ++++-- |
14 |
pym/portage/package/ebuild/config.py | 4 +++- |
15 |
pym/portage/package/ebuild/doebuild.py | 7 +++++-- |
16 |
3 files changed, 12 insertions(+), 5 deletions(-) |
17 |
|
18 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
19 |
index 232bf44..2ed1335 100755 |
20 |
--- a/bin/ebuild.sh |
21 |
+++ b/bin/ebuild.sh |
22 |
@@ -501,7 +501,8 @@ fi |
23 |
export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} |
24 |
trap 'exit 1' SIGTERM |
25 |
|
26 |
-if ! has "$EBUILD_PHASE" clean cleanrm depend setup && \ |
27 |
+if ! has "$EBUILD_PHASE" clean cleanrm depend && \ |
28 |
+ ! [[ $EMERGE_FROM = ebuild && $EBUILD_PHASE = 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 +551,8 @@ 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|setup)$ || ! -f $T/environment || \ |
37 |
+ if [[ $EBUILD_PHASE = setup && $EMERGE_FROM = ebuild ]] || \ |
38 |
+ [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ |
39 |
-f $PORTAGE_BUILDDIR/.ebuild_changed || \ |
40 |
" ${FEATURES} " == *" noauto "* ]] ; then |
41 |
# The bashrcs get an opportunity here to set aliases that will be expanded |
42 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
43 |
index ca15f81..59e239b 100644 |
44 |
--- a/pym/portage/package/ebuild/config.py |
45 |
+++ b/pym/portage/package/ebuild/config.py |
46 |
@@ -2663,9 +2663,11 @@ class config(object): |
47 |
eapi = self.get('EAPI') |
48 |
eapi_attrs = _get_eapi_attrs(eapi) |
49 |
phase = self.get('EBUILD_PHASE') |
50 |
+ emerge_from = self.get('EMERGE_FROM') |
51 |
filter_calling_env = False |
52 |
if self.mycpv is not None and \ |
53 |
- phase not in ('clean', 'cleanrm', 'depend', 'fetch', 'setup'): |
54 |
+ not (emerge_from == 'ebuild' and phase == 'setup') and \ |
55 |
+ phase not in ('clean', 'cleanrm', 'depend', 'fetch'): |
56 |
temp_dir = self.get('T') |
57 |
if temp_dir is not None and \ |
58 |
os.path.exists(os.path.join(temp_dir, 'environment')): |
59 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
60 |
index 6df3c69..bf97660 100644 |
61 |
--- a/pym/portage/package/ebuild/doebuild.py |
62 |
+++ b/pym/portage/package/ebuild/doebuild.py |
63 |
@@ -913,12 +913,15 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, |
64 |
if eapi_exports_merge_type(mysettings["EAPI"]) and \ |
65 |
"MERGE_TYPE" not in mysettings.configdict["pkg"]: |
66 |
if tree == "porttree": |
67 |
- mysettings.configdict["pkg"]["EMERGE_FROM"] = "ebuild" |
68 |
mysettings.configdict["pkg"]["MERGE_TYPE"] = "source" |
69 |
elif tree == "bintree": |
70 |
- mysettings.configdict["pkg"]["EMERGE_FROM"] = "binary" |
71 |
mysettings.configdict["pkg"]["MERGE_TYPE"] = "binary" |
72 |
|
73 |
+ if tree == "porttree": |
74 |
+ mysettings.configdict["pkg"]["EMERGE_FROM"] = "ebuild" |
75 |
+ elif tree == "bintree": |
76 |
+ mysettings.configdict["pkg"]["EMERGE_FROM"] = "binary" |
77 |
+ |
78 |
# NOTE: It's not possible to set REPLACED_BY_VERSION for prerm |
79 |
# and postrm here, since we don't necessarily know what |
80 |
# versions are being installed. This could be a problem |
81 |
-- |
82 |
2.0.4 |