public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps
  @ 2020-03-02  6:32 99%   ` Zac Medico
  0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2020-03-02  6:32 UTC (permalink / raw
  To: gentoo-portage-dev, Matt Turner


[-- Attachment #1.1: Type: text/plain, Size: 1357 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-02-21  5:29     [gentoo-portage-dev] [PATCH gentoolkit 1/2] eclean: Rewrite findPackages() Matt Turner
2020-02-21  5:29     ` [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps Matt Turner
2020-03-02  6:32 99%   ` Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox