Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 3/4] portage.package.ebuild.doebuild: Override DISTDIR unconditionally, #612972
Date: Sat, 18 Mar 2017 21:16:26
Message-Id: 1489871772.25327.0.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 3/4] portage.package.ebuild.doebuild: Override DISTDIR unconditionally, #612972 by Zac Medico
1 On sob, 2017-03-18 at 13:45 -0700, Zac Medico wrote:
2 > On Sat, Mar 18, 2017 at 1:12 PM, Zac Medico <zmedico@g.o> wrote:
3 > > On Sat, Mar 18, 2017 at 12:57 PM, Zac Medico <zmedico@g.o> wrote:
4 > > > On Sat, Mar 18, 2017 at 12:04 PM, Michał Górny <mgorny@g.o> wrote:
5 > > > > Ensure that DISTDIR is always defined to the path to the shadow
6 > > > > directory. This ensures that PMS rules for consistent value are
7 > > > > followed, and that no global scope calls should be able to access
8 > > > > the distfile directory. This also ensures that global-scope assignments
9 > > > > (e.g. in PATCHES) do not work around the shadow directory.
10 > > > > ---
11 > > > > pym/portage/package/ebuild/doebuild.py | 9 +++++----
12 > > > > pym/portage/package/ebuild/prepare_build_dirs.py | 6 ++----
13 > > > > 2 files changed, 7 insertions(+), 8 deletions(-)
14 > > > >
15 > > > > diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
16 > > > > index 15e4abb48..8efc08334 100644
17 > > > > --- a/pym/portage/package/ebuild/doebuild.py
18 > > > > +++ b/pym/portage/package/ebuild/doebuild.py
19 > > > > @@ -348,7 +348,8 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
20 > > > >
21 > > > > mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])
22 > > > > mysettings.pop("PORTDIR_OVERLAY", None)
23 > > > > - mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])
24 > > > > + if "PORTAGE_ACTUAL_DISTDIR" not in mysettings:
25 > > > > + mysettings["PORTAGE_ACTUAL_DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])
26 > > > > mysettings["RPMDIR"] = os.path.realpath(mysettings["RPMDIR"])
27 > > > >
28 > > > > mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass"
29 > > > > @@ -390,6 +391,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
30 > > > > mysettings["WORKDIR"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "work")
31 > > > > mysettings["D"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image") + os.sep
32 > > > > mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
33 > > > > + mysettings["DISTDIR"] = os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
34 > > > > mysettings["FILESDIR"] = os.path.join(settings["PORTAGE_BUILDDIR"], "files")
35 > > >
36 > > > The EbuildFetcher already_fetched and _prefetch_size_ok methods use
37 > > > DISTDIR after doebuild_environment has been called, so they need to be
38 > > > updated to use PORTAGE_ACTUAL_DISTDIR.
39 > >
40 > > Also, this code in doebuild uses DISTDIR before _prepare_fake_distdir
41 > > gets called called:
42 > >
43 > > for x in alist:
44 > > writemsg_stdout(">>> Checking %s's mtime...\n" % x)
45 > > try:
46 > > x_st = os.stat(os.path.join(
47 > > mysettings["DISTDIR"], x))
48 > >
49 > > Also, bin/ebuild calls doebuild_environment before doebuild, which
50 > > means that this doebuild code also needs to use PORTAGE_ACTUAL_DISTDIR
51 > > if it's in mysettings:
52 > >
53 > > mf = repo_config.load_manifest(pkgdir, mysettings["DISTDIR"])
54 >
55 > We should probably implement the fake DISTDIR setting inside the
56 > config environ method, so that we can eliminate all of this
57 > error-prone DISTDIR/PORTAGE_ACTUAL_DISTDIR stuff.
58
59 You're the expert here. I'm just the person who hammers it till it seems
60 to work semi-reliably, and curse on whoever designed it ;-P. Would you
61 be able to take it from here? I barely understand what you're talking
62 about.
63
64 --
65 Best regards,
66 Michał Górny

Attachments

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

Replies