[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-portage-dev
Subject:    Re: [gentoo-portage-dev] [Patch] Repoman rewrite stage2 modularization conversion complete
From:       Zac Medico <zmedico () gentoo ! org>
Date:       2016-03-15 22:37:03
Message-ID: 56E88E8F.5090907 () gentoo ! org
[Download RAW message or body]

On 03/15/2016 02:19 PM, Brian Dolbec wrote:
> On Tue, 15 Mar 2016 14:03:41 -0700
> Zac Medico <zmedico@gentoo.org> wrote:
> 
>> On 03/15/2016 01:57 PM, Brian Dolbec wrote:
>>> On Tue, 15 Mar 2016 13:31:24 -0700
>>> Zac Medico <zmedico@gentoo.org> wrote:
>>>   
>>>>>
>>>>> Also, now that we are using Fuse, can't we stop returning things
>>>>> from these functions entirely, so that dynamic_data is only
>>>>> updated by side-effects?
>>>>>     
>>>>
>>>> I think 'continue' is the only one left. We could just return a
>>>> single boolean, or use an exception to do what 'continue' does.  
>>>
>>> NOPE :(  not without a lot more work...
>>>
>>> arches.py: return {'continue': False, 'arches': arches}
>>> depend.py: return {'continue': False, 'unknown_pkgs': unknown_pkgs,
>>> 'type_list': type_list, 'badlicsyntax': badlicsyntax,
>>> 'baddepsyntax': baddepsyntax}
>>> ebuild.py: return {'continue': False, 'ebuild': self}
>>>            return {'continue': False, 'pkg': self.pkg}
>>> isebuild.py: return {'continue': self.continue_, 'pkgs': pkgs,
>>> 			'can_force': not self.continue_}
>>> live.py: return {'continue': False,
>>> 			'live_ebuild': LIVE_ECLASSES.intersection(
>>> 				kwargs.get('ebuild').inherited)}
>>> fetches.py: return {'continue': False, 'src_uri_error':
>>>                     self._src_uri_error}
>>> pkgmetadata.py: return {'continue': False, 'muselist':
>>>                         frozenset(self.musedict)}
>>>                 return {'continue': False, 'muselist':
>>>                         frozenset(self.musedict)}
>>> scan.py: return {'continue': False, 'eadded':
>>>                  self.vcs_settings.status.eadded}
>>> use_flags.py: return {'continue': False, 'ebuild_UsedUseFlags':
>>>                        self.usedUseFlags, 'used_useflags':
>>>                        used_useflags}
>>>
>>>
>>> But we can define a generic dynamic_data class that holds the
>>> data that can be modified in a similar way to the Fuse class.  That
>>> way we don't have to update it like we do a dictionary. 
>>>   
>>
>> Can't we add all these things to the dynamic_data dict that's
>> initialized in Scanner.scan_pkgs (along with Fuse instances), and just
>> let them get passed in as arguments, so that the functions can act on
>> them without having to return them?
> 
> Yeah, /me is being a dummy.  The modules are currently being passed
> the dict as a **kwargs.  So the individual attributes are accessible
> directly.  We could just pass it as one arg instead then the modules can
> just modify the dictionary directly since it is passed in by pointer.

Multiple args work fine too, as long as those args refer to mutable
instances that persist outside the function.

> Sorry, my head is bouncing back and forth between this and other work
> code...  But I like how we're getting the code in better shape...
> something I had reserved for stage3 ;)

I just feel like each step should result in code that is more
maintainable than the last, and in the current step we have gone
somewhat backwards in maintainability in a specific area.

> The current method is the first
> thing that came to me when I discovered I needed to get new data back
> into the dynamic_data for trailing modules in the queue.

You can see how the new approaches we are coming up with are much more
maintainable and easier for people to wrap their heads around.
-- 
Thanks,
Zac

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic