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 21:03:02
Message-Id: CAEdQ38Fo+vRbBav+pEr4MPz_ERRQWEWXiwUzN0xwhXhj4eainA@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps by Matt Turner
1 On Mon, Mar 2, 2020 at 12:40 PM Matt Turner <mattst88@g.o> wrote:
2 >
3 > On Sun, Mar 1, 2020 at 10:32 PM Zac Medico <zmedico@g.o> wrote:
4 > >
5 > > On 2/20/20 9:29 PM, Matt Turner wrote:
6 > > > +
7 > > > def findPackages(
8 > > > options,
9 > > > exclude=None,
10 > > > @@ -564,7 +577,22 @@ def findPackages(
11 > > >
12 > > > # Exclude if binpkg exists in the porttree and not --deep
13 > > > if not destructive and port_dbapi.cpv_exists(cpv):
14 > > > - continue
15 > > > + if not options['changed-deps']:
16 > > > + continue
17 > > > +
18 > > > + uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split()
19 > > > + all_equal = True
20 > > > +
21 > > > + for k in ('RDEPEND', 'PDEPEND'):
22 > > > + binpkg_deps = bin_dbapi.aux_get(cpv, [k])
23 > > > + ebuild_deps = port_dbapi.aux_get(cpv, [k])
24 > > > +
25 > > > + if not _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, uselist):
26 > > > + all_equal = False
27 > > > + break
28 > > > +
29 > > > + if all_equal:
30 > > > + continue
31 > > >
32 > > > if destructive and var_dbapi.cpv_exists(cpv):
33 > > > # Exclude if an instance of the package is installed due to
34 > > >
35 > >
36 > > The aux_get calls are expensive, so it's more efficient to get multiple
37 > > values with each call like:
38 > > keys = ('RDEPEND', 'PDEPEND')
39 > > binpkg_deps = dict(zip(keys, bin_dbapi.aux_get(cpv, keys))
40 > > ebuild_deps = dict(zip(keys, port_dbapi.aux_get(cpv, keys))
41 > >
42 > > Otherwise, looks good.
43 >
44 > Thanks, that makes the code a lot nicer too.
45
46 Actually, use_reduce wants a list (it calls .split). Wrapping those in
47 list() looks like it works, but I suspect that's not as you intended.
48 What does the zip add over just doing this?
49
50 binpkg_deps = bin_dbapi.aux_get(cpv, keys)
51 ebuild_deps = port_dbapi.aux_get(cpv, keys)

Replies