1 |
Ensure that DISTDIR is always defined to the path to the shadow |
2 |
directory. This ensures that PMS rules for consistent value are |
3 |
followed, and that no global scope calls should be able to access |
4 |
the distfile directory. This also ensures that global-scope assignments |
5 |
(e.g. in PATCHES) do not work around the shadow directory. |
6 |
--- |
7 |
pym/portage/package/ebuild/doebuild.py | 9 +++++---- |
8 |
pym/portage/package/ebuild/prepare_build_dirs.py | 6 ++---- |
9 |
2 files changed, 7 insertions(+), 8 deletions(-) |
10 |
|
11 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
12 |
index 15e4abb48..8efc08334 100644 |
13 |
--- a/pym/portage/package/ebuild/doebuild.py |
14 |
+++ b/pym/portage/package/ebuild/doebuild.py |
15 |
@@ -348,7 +348,8 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, |
16 |
|
17 |
mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"]) |
18 |
mysettings.pop("PORTDIR_OVERLAY", None) |
19 |
- mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"]) |
20 |
+ if "PORTAGE_ACTUAL_DISTDIR" not in mysettings: |
21 |
+ mysettings["PORTAGE_ACTUAL_DISTDIR"] = os.path.realpath(mysettings["DISTDIR"]) |
22 |
mysettings["RPMDIR"] = os.path.realpath(mysettings["RPMDIR"]) |
23 |
|
24 |
mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass" |
25 |
@@ -390,6 +391,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, |
26 |
mysettings["WORKDIR"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "work") |
27 |
mysettings["D"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image") + os.sep |
28 |
mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp") |
29 |
+ mysettings["DISTDIR"] = os.path.join(settings["PORTAGE_BUILDDIR"], "distdir") |
30 |
mysettings["FILESDIR"] = os.path.join(settings["PORTAGE_BUILDDIR"], "files") |
31 |
|
32 |
# Prefix forward compatability |
33 |
@@ -1207,9 +1209,8 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, |
34 |
mysettings.pop("REPLACING_VERSIONS", None) |
35 |
|
36 |
# Make sure that DISTDIR is restored to it's normal value before we return! |
37 |
- if "PORTAGE_ACTUAL_DISTDIR" in mysettings: |
38 |
- mysettings["DISTDIR"] = mysettings["PORTAGE_ACTUAL_DISTDIR"] |
39 |
- del mysettings["PORTAGE_ACTUAL_DISTDIR"] |
40 |
+ mysettings["DISTDIR"] = mysettings["PORTAGE_ACTUAL_DISTDIR"] |
41 |
+ del mysettings["PORTAGE_ACTUAL_DISTDIR"] |
42 |
|
43 |
if logfile and not returnpid: |
44 |
try: |
45 |
diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py |
46 |
index 0fa43ba59..6528d550e 100644 |
47 |
--- a/pym/portage/package/ebuild/prepare_build_dirs.py |
48 |
+++ b/pym/portage/package/ebuild/prepare_build_dirs.py |
49 |
@@ -411,10 +411,8 @@ def _prepare_fake_filesdir(settings): |
50 |
os.symlink(real_filesdir, symlink_path) |
51 |
|
52 |
def _prepare_fake_distdir(settings, alist): |
53 |
- orig_distdir = settings["DISTDIR"] |
54 |
- settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir |
55 |
- edpath = settings["DISTDIR"] = \ |
56 |
- os.path.join(settings["PORTAGE_BUILDDIR"], "distdir") |
57 |
+ orig_distdir = settings["PORTAGE_ACTUAL_DISTDIR"] |
58 |
+ edpath = settings["DISTDIR"] |
59 |
portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755) |
60 |
|
61 |
# Remove any unexpected files or directories. |
62 |
-- |
63 |
2.12.0 |