commit:     8aa99e78bb89615bb25044183e160a7bf7facc2d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 25 08:29:07 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan 26 14:58:59 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8aa99e78

portage.package.ebuild.config: Override DISTDIR unconditionally

Ensure that DISTDIR is always defined to the path to the shadow
directory. This ensures that PMS rules for consistent value are
followed, and that no global scope calls should be able to access
the distfile directory. This also ensures that global-scope assignments
(e.g. in PATCHES) do not work around the shadow directory.

Bug: https://bugs.gentoo.org/612972
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 pym/portage/package/ebuild/config.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pym/portage/package/ebuild/config.py 
b/pym/portage/package/ebuild/config.py
index d0225a311..5624e86d3 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2016 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -2848,6 +2848,15 @@ class config(object):
                                else:
                                        raise AssertionError("C locale did not 
pass the test!")
 
+               try:
+                       builddir = mydict["PORTAGE_BUILDDIR"]
+                       distdir = mydict["DISTDIR"]
+               except KeyError:
+                       pass
+               else:
+                       mydict["PORTAGE_ACTUAL_DISTDIR"] = distdir
+                       mydict["DISTDIR"] = os.path.join(builddir, "distdir")
+
                return mydict
 
        def thirdpartymirrors(self):

Reply via email to