Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: Zac Medico <zmedico@g.o>, gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH v2] Move INSTALL_MASK handling into merging
Date: Sun, 12 Jun 2016 20:52:34
Message-Id: 575DCB8A.8010708@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH v2] Move INSTALL_MASK handling into merging by Zac Medico
1 On 06/12/2016 01:43 PM, Zac Medico wrote:
2 > On 06/12/2016 01:29 PM, Zac Medico wrote:
3 >> On 05/22/2016 01:21 AM, Michał Górny wrote:
4 >>> diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
5 >>> index fcc7ce5..9d13703 100644
6 >>> --- a/pym/portage/package/ebuild/config.py
7 >>> +++ b/pym/portage/package/ebuild/config.py
8 >>> @@ -1774,14 +1774,14 @@ class config(object):
9 >>> _eapi_cache.clear()
10 >>>
11 >>> # Prepare the final value of INSTALL_MASK
12 >>> - install_mask = self["INSTALL_MASK"].split()
13 >>> + install_mask = self.get("INSTALL_MASK", "").split()
14 >>> if 'nodoc' in self.features:
15 >>> install_mask.append("/usr/share/doc")
16 >>> if 'noinfo' in self.features:
17 >>> install_mask.append("/usr/share/info")
18 >>> if 'noman' in self.features:
19 >>> install_mask.append("/usr/share/man")
20 >>> - self["INSTALL_MASK"] = ' '.join(install_mask)
21 >>> + self.install_mask = install_mask
22 >>>
23 >>> def _grab_pkg_env(self, penv, container, protected_keys=None):
24 >>> if protected_keys is None:
25 >>>
26 >>
27 >> The config.reset method should reset self.install_mask to match the
28 >> global INSTALL_MASK setting.
29 >>
30 >
31 > For the benefit of those who may not be as familiar with the config
32 > class, here is some of the related irc discussion:
33 >
34 > <zmedico> mgorny: config.setcpv put's the config into per-package state,
35 > and config.reset reverts it to global state
36 > <mgorny> i see
37 > <mgorny> so how does that affect me? ;-D
38 > <zmedico> because yout set self.install_mask in config.setcpv
39 > <zmedico> so you also have to handle global setting of that attribute
40 > <zmedico> every attribute has global and per-package state
41 > <zmedico> for example the usemask attribute is similar
42 > <zmedico> initially it has global use.mask settings
43 > <mgorny> hmm, so you mean i can't rely on both being combined properly
44 > in .setcpv() ?
45 > <mgorny> hmm, but wait, do i need to care about global state at all?
46 > <zmedico> yes, that's what config.reset is for
47 > <zmedico> it transitions back to global state
48 > <mgorny> but is there any case when i need the global state?
49 > <mgorny> i don't think the mask is used without packages
50 > <zmedico> if that's the case, the you can set it to None whien the
51 > config is in global mode
52 > <zmedico> careful though, setcpv returns early in some cases
53 > <zmedico> and you set self.install_mask at the very end of that method
54 > <zmedico> so it's not guaranteed to execute
55 > <zmedico> so you have end up with self.install_mask having the global
56 > setting after a setcpv call
57 > <zmedico> which is fine if there's no package.env setting for that package
58 >
59
60 <zmedico> mgorny: also, you should copy self.install_mask in the clone
61 part of the config constructor
62 --
63 Thanks,
64 Zac