Gentoo Archives: gentoo-portage-dev

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

Attachments

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

Replies