Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Zac Medico <zmedico@g.o>, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] prepare_build_dirs: Fix duplicate override of DISTDIR for 'ebuild'
Date: Sat, 27 Jan 2018 09:44:43
Message-Id: bdc46aa9-4ba4-e095-29b0-b8dc668172da@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] prepare_build_dirs: Fix duplicate override of DISTDIR for 'ebuild' by Zac Medico
1 On 01/27/2018 01:38 AM, Zac Medico wrote:
2 > On 01/27/2018 01:01 AM, Michał Górny wrote:
3 >> Fix the duplicate override of DISTDIR that happens when using
4 >> the 'ebuild' tool to run ebuilds. In this case, both the 'config'
5 >> code and the 'prepare_build_dirs' code attempt to replace DISTDIR,
6 >> and the shadow distdir symlinks end up pointing to themselves.
7 >>
8 >> Apparently the _prepare_fake_distdir() is passed settings containing
9 >> the original DISTDIR by emerge, while ebuild passes an instance
10 >> contaning the DISTDIR override. Try PORTAGE_ACTUAL_DISTDIR first
11 >> to account for both cases.
12 >> ---
13 >> pym/portage/package/ebuild/prepare_build_dirs.py | 8 ++++----
14 >> 1 file changed, 4 insertions(+), 4 deletions(-)
15 >>
16 >> diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py
17 >> index 16afc3f98..0b6a3a4df 100644
18 >> --- a/pym/portage/package/ebuild/prepare_build_dirs.py
19 >> +++ b/pym/portage/package/ebuild/prepare_build_dirs.py
20 >> @@ -411,10 +411,10 @@ def _prepare_fake_filesdir(settings):
21 >> os.symlink(real_filesdir, symlink_path)
22 >>
23 >> def _prepare_fake_distdir(settings, alist):
24 >> - orig_distdir = settings["DISTDIR"]
25 >> - settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir
26 >> - edpath = settings["DISTDIR"] = \
27 >> - os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
28 >
29 > Above you've removed the only code that overrode settings["DISTDIR"],
30 > which is good.
31 >
32 >> + orig_distdir = settings.get("PORTAGE_ACTUAL_DISTDIR",
33 >> + settings.get("DISTDIR"))
34 >> + assert orig_distdir
35 >
36 > Since settings["DISTDIR"] is no longer overridden, now this is all
37 > that's needed:
38 >
39 > orig_distdir = settings["DISTDIR"]
40
41 Also, we don't need this code in the doebuild function anymore:
42
43 if "PORTAGE_ACTUAL_DISTDIR" in mysettings:
44 mysettings["DISTDIR"] = mysettings["PORTAGE_ACTUAL_DISTDIR"]
45 del mysettings["PORTAGE_ACTUAL_DISTDIR"]
46 --
47 Thanks,
48 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature