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

Replies