On 06/12/2016 01:43 PM, Zac Medico wrote:
> On 06/12/2016 01:29 PM, Zac Medico wrote:
>> On 05/22/2016 01:21 AM, Michał Górny wrote:
>>> diff --git a/pym/portage/package/ebuild/config.py 
>>> b/pym/portage/package/ebuild/config.py
>>> index fcc7ce5..9d13703 100644
>>> --- a/pym/portage/package/ebuild/config.py
>>> +++ b/pym/portage/package/ebuild/config.py
>>> @@ -1774,14 +1774,14 @@ class config(object):
>>>             _eapi_cache.clear()
>>>  
>>>             # Prepare the final value of INSTALL_MASK
>>> -           install_mask = self["INSTALL_MASK"].split()
>>> +           install_mask = self.get("INSTALL_MASK", "").split()
>>>             if 'nodoc' in self.features:
>>>                     install_mask.append("/usr/share/doc")
>>>             if 'noinfo' in self.features:
>>>                     install_mask.append("/usr/share/info")
>>>             if 'noman' in self.features:
>>>                     install_mask.append("/usr/share/man")
>>> -           self["INSTALL_MASK"] = ' '.join(install_mask)
>>> +           self.install_mask = install_mask
>>>  
>>>     def _grab_pkg_env(self, penv, container, protected_keys=None):
>>>             if protected_keys is None:
>>>
>>
>> The config.reset method should reset self.install_mask to match the
>> global INSTALL_MASK setting.
>>
> 
> For the benefit of those who may not be as familiar with the config
> class, here is some of the related irc discussion:
> 
> <zmedico> mgorny: config.setcpv put's the config into per-package state,
> and config.reset reverts it to global state
> <mgorny> i see
> <mgorny> so how does that affect me? ;-D
> <zmedico> because yout set self.install_mask in config.setcpv
> <zmedico> so you also have to handle global setting of that attribute
> <zmedico> every attribute has global and per-package state
> <zmedico> for example the usemask attribute is similar
> <zmedico> initially it has global use.mask settings
> <mgorny> hmm, so you mean i can't rely on both being combined properly
> in .setcpv() ?
> <mgorny> hmm, but wait, do i need to care about global state at all?
> <zmedico> yes, that's what config.reset is for
> <zmedico> it transitions back to global state
> <mgorny> but is there any case when i need the global state?
> <mgorny> i don't think the mask is used without packages
> <zmedico> if that's the case, the you can set it to None whien the
> config is in global mode
> <zmedico> careful though, setcpv returns early in some cases
> <zmedico> and you set self.install_mask at the very end of that method
> <zmedico> so it's not guaranteed to execute
> <zmedico> so you have end up with self.install_mask having the global
> setting after a setcpv call
> <zmedico> which is fine if there's no package.env setting for that package
> 

<zmedico> mgorny: also, you should copy self.install_mask in the clone
part of the config constructor
-- 
Thanks,
Zac

Reply via email to