From: Zac Medico <zmedico@gentoo.org>
To: Matt Turner <mattst88@gentoo.org>
Cc: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps
Date: Mon, 2 Mar 2020 19:38:36 -0800 [thread overview]
Message-ID: <9438a358-d6ac-155c-826e-93becfdc7aa8@gentoo.org> (raw)
In-Reply-To: <CAEdQ38Fo+vRbBav+pEr4MPz_ERRQWEWXiwUzN0xwhXhj4eainA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2355 bytes --]
On 3/2/20 1:02 PM, Matt Turner wrote:
> On Mon, Mar 2, 2020 at 12:40 PM Matt Turner <mattst88@gentoo.org> wrote:
>>
>> On Sun, Mar 1, 2020 at 10:32 PM Zac Medico <zmedico@gentoo.org> wrote:
>>>
>>> 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, that makes the code a lot nicer too.
>
> Actually, use_reduce wants a list (it calls .split). Wrapping those in
> list() looks like it works, but I suspect that's not as you intended.
> What does the zip add over just doing this?
>
> binpkg_deps = bin_dbapi.aux_get(cpv, keys)
> ebuild_deps = port_dbapi.aux_get(cpv, keys)
Using dict(zip(keys, port_dbapi.aux_get(cpv, keys)) is only useful if
you want to use a dictionary to access the values. However, if lists are
good enough then you might just use those instead. You could even join
the values together like this:
ebuild_deps = ' '.join(port_dbapi.aux_get(cpv, keys))
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
next prev parent reply other threads:[~2020-03-03 3:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Zac Medico
2020-03-02 20:40 ` Matt Turner
2020-03-02 21:02 ` Matt Turner
2020-03-03 3:38 ` Zac Medico [this message]
2020-03-02 6:39 ` Zac Medico
2020-03-02 21:11 ` Matt Turner
2020-03-03 5:15 ` Zac Medico
2020-03-07 6:10 ` Matt Turner
2020-02-21 5:34 ` [gentoo-portage-dev] Re: [PATCH gentoolkit 1/2] eclean: Rewrite findPackages() Matt Turner
2020-02-21 5:36 ` [gentoo-portage-dev] " Michael 'veremitz' Everitt
2020-03-02 6:25 ` Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9438a358-d6ac-155c-826e-93becfdc7aa8@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=mattst88@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox