Gentoo Archives: gentoo-portage-dev

From: Matt Turner <mattst88@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps
Date: Mon, 02 Mar 2020 20:40:36
Message-Id: CAEdQ38Ha5N5sVJwM4dEH_XxMof5ytPX5noxrQiVS+rUdeVP5GQ@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps by Zac Medico
1 On Sun, Mar 1, 2020 at 10:32 PM Zac Medico <zmedico@g.o> wrote:
2 >
3 > On 2/20/20 9:29 PM, Matt Turner wrote:
4 > > +
5 > > def findPackages(
6 > > options,
7 > > exclude=None,
8 > > @@ -564,7 +577,22 @@ def findPackages(
9 > >
10 > > # Exclude if binpkg exists in the porttree and not --deep
11 > > if not destructive and port_dbapi.cpv_exists(cpv):
12 > > - continue
13 > > + if not options['changed-deps']:
14 > > + continue
15 > > +
16 > > + uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split()
17 > > + all_equal = True
18 > > +
19 > > + for k in ('RDEPEND', 'PDEPEND'):
20 > > + binpkg_deps = bin_dbapi.aux_get(cpv, [k])
21 > > + ebuild_deps = port_dbapi.aux_get(cpv, [k])
22 > > +
23 > > + if not _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, uselist):
24 > > + all_equal = False
25 > > + break
26 > > +
27 > > + if all_equal:
28 > > + continue
29 > >
30 > > if destructive and var_dbapi.cpv_exists(cpv):
31 > > # Exclude if an instance of the package is installed due to
32 > >
33 >
34 > The aux_get calls are expensive, so it's more efficient to get multiple
35 > values with each call like:
36 > keys = ('RDEPEND', 'PDEPEND')
37 > binpkg_deps = dict(zip(keys, bin_dbapi.aux_get(cpv, keys))
38 > ebuild_deps = dict(zip(keys, port_dbapi.aux_get(cpv, keys))
39 >
40 > Otherwise, looks good.
41
42 Thanks, that makes the code a lot nicer too.

Replies