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] prepare_build_dirs: Fix duplicate override of DISTDIR for 'ebuild'
Date: Sat, 27 Jan 2018 09:01:17
Message-Id: 20180127090108.14887-1-mgorny@gentoo.org
1 Fix the duplicate override of DISTDIR that happens when using
2 the 'ebuild' tool to run ebuilds. In this case, both the 'config'
3 code and the 'prepare_build_dirs' code attempt to replace DISTDIR,
4 and the shadow distdir symlinks end up pointing to themselves.
5
6 Apparently the _prepare_fake_distdir() is passed settings containing
7 the original DISTDIR by emerge, while ebuild passes an instance
8 contaning the DISTDIR override. Try PORTAGE_ACTUAL_DISTDIR first
9 to account for both cases.
10 ---
11 pym/portage/package/ebuild/prepare_build_dirs.py | 8 ++++----
12 1 file changed, 4 insertions(+), 4 deletions(-)
13
14 diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py
15 index 16afc3f98..0b6a3a4df 100644
16 --- a/pym/portage/package/ebuild/prepare_build_dirs.py
17 +++ b/pym/portage/package/ebuild/prepare_build_dirs.py
18 @@ -411,10 +411,10 @@ def _prepare_fake_filesdir(settings):
19 os.symlink(real_filesdir, symlink_path)
20
21 def _prepare_fake_distdir(settings, alist):
22 - orig_distdir = settings["DISTDIR"]
23 - settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir
24 - edpath = settings["DISTDIR"] = \
25 - os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
26 + orig_distdir = settings.get("PORTAGE_ACTUAL_DISTDIR",
27 + settings.get("DISTDIR"))
28 + assert orig_distdir
29 + edpath = os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
30 portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755)
31
32 # Remove any unexpected files or directories.
33 --
34 2.16.1

Replies