Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps

2020-03-01 Thread Zac Medico
On 2/20/20 9:29 PM, Matt Turner wrote:
> @@ -564,7 +577,22 @@ def findPackages(
>  
>  # Exclude if binpkg exists in the porttree and not --deep
>  if not destructive and port_dbapi.cpv_exists(cpv):
> -continue
> +if not options['changed-deps']:
> +continue
> +
> +uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split()
> +all_equal = True
> +
> +for k in ('RDEPEND', 'PDEPEND'):
> +binpkg_deps = bin_dbapi.aux_get(cpv, [k])
> +ebuild_deps = port_dbapi.aux_get(cpv, [k])
> +
> +if not _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, 
> uselist):
> +all_equal = False
> +break
> +
> +if all_equal:
> +continue

If all_equal is True, then none of the other filters have an opportunity
to add this package to the dead_binpkgs set. That's not good is it?
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps

2020-03-01 Thread Zac Medico
On 2/20/20 9:29 PM, Matt Turner wrote:
> +
>  def findPackages(
>  options,
>  exclude=None,
> @@ -564,7 +577,22 @@ def findPackages(
>  
>  # Exclude if binpkg exists in the porttree and not --deep
>  if not destructive and port_dbapi.cpv_exists(cpv):
> -continue
> +if not options['changed-deps']:
> +continue
> +
> +uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split()
> +all_equal = True
> +
> +for k in ('RDEPEND', 'PDEPEND'):
> +binpkg_deps = bin_dbapi.aux_get(cpv, [k])
> +ebuild_deps = port_dbapi.aux_get(cpv, [k])
> +
> +if not _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, 
> uselist):
> +all_equal = False
> +break
> +
> +if all_equal:
> +continue
>  
>  if destructive and var_dbapi.cpv_exists(cpv):
>  # Exclude if an instance of the package is installed due to
> 

The aux_get calls are expensive, so it's more efficient to get multiple
values with each call like:
keys = ('RDEPEND', 'PDEPEND')
binpkg_deps = dict(zip(keys, bin_dbapi.aux_get(cpv, keys))
ebuild_deps = dict(zip(keys, port_dbapi.aux_get(cpv, keys))

Otherwise, looks good.
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-portage-dev] [PATCH gentoolkit 1/2] eclean: Rewrite findPackages()

2020-03-01 Thread Zac Medico
On 2/20/20 9:36 PM, Michael 'veremitz' Everitt wrote:
> On 21/02/20 05:29, Matt Turner wrote:
>> I found the original code to be nearly incomprehensible. Instead of
>> populating a dict of potential binpkgs to remove and then removing from
>> the to-be-removed list, just selectively add to-be-removed packages.
>>
>> Signed-off-by: Matt Turner 
>> ---
>> I switched from tabs to spaces in the process. I can revert back if
>> desired.
>>
> Probably best to stick to tabs for consistency with the other portage code,
> although naturally Zac probably better to ACK/NACK that.

Yeah lets stick with tabs unless we're converting everything to spaces.

> Otherwise I think this is a good refresh. +1.

Yes, looks good.
-- 
Thanks,
Zac