Gentoo Archives: gentoo-portage-dev

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

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies