Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH v2 2/3] portage.package.ebuild.config: Override DISTDIR unconditionally
Date: Thu, 25 Jan 2018 08:50:53
Message-Id: 20180125085035.17397-3-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCHES v2] DISTDIR shadow updates by "Michał Górny"
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 Bug: https://bugs.gentoo.org/612972
8 ---
9 pym/portage/package/ebuild/config.py | 11 ++++++++++-
10 1 file changed, 10 insertions(+), 1 deletion(-)
11
12 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
13 index d0225a311..5624e86d3 100644
14 --- a/pym/portage/package/ebuild/config.py
15 +++ b/pym/portage/package/ebuild/config.py
16 @@ -1,4 +1,4 @@
17 -# Copyright 2010-2016 Gentoo Foundation
18 +# Copyright 2010-2018 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20
21 from __future__ import unicode_literals
22 @@ -2848,6 +2848,15 @@ class config(object):
23 else:
24 raise AssertionError("C locale did not pass the test!")
25
26 + try:
27 + builddir = mydict["PORTAGE_BUILDDIR"]
28 + distdir = mydict["DISTDIR"]
29 + except KeyError:
30 + pass
31 + else:
32 + mydict["PORTAGE_ACTUAL_DISTDIR"] = distdir
33 + mydict["DISTDIR"] = os.path.join(builddir, "distdir")
34 +
35 return mydict
36
37 def thirdpartymirrors(self):
38 --
39 2.16.1