From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 16F46138350 for ; Mon, 2 Mar 2020 21:03:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3BB29E0896; Mon, 2 Mar 2020 21:03:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1F55FE0896 for ; Mon, 2 Mar 2020 21:03:01 +0000 (UTC) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mattst88) by smtp.gentoo.org (Postfix) with ESMTPSA id EE67A34F50D for ; Mon, 2 Mar 2020 21:02:59 +0000 (UTC) Received: by mail-io1-f47.google.com with SMTP id m22so1009549ioj.7 for ; Mon, 02 Mar 2020 13:02:59 -0800 (PST) X-Gm-Message-State: ANhLgQ29kebBqeLk7DD8g1rIi0yRz7ilIv/nZujHqy/k9fGQPYQ6Vr/v +PwoPTvF1BXKZHnl+20eC1CBXpMWoqcHRNnUWJI= X-Google-Smtp-Source: ADFU+vtKZ/uqBXo5MyUbRGQq1Gt1UOzoegiLX8BZ5iB15Q1O4kR3lFaeCCHfbxbhE9OgYnVjzfD+XOzGMWlfxZZFosA= X-Received: by 2002:a6b:5b15:: with SMTP id v21mr1322307ioh.100.1583182978102; Mon, 02 Mar 2020 13:02:58 -0800 (PST) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 References: <20200221052945.972092-1-mattst88@gentoo.org> <20200221052945.972092-2-mattst88@gentoo.org> <5cf53fcc-4ee7-4855-42e1-46784bf340e9@gentoo.org> In-Reply-To: From: Matt Turner Date: Mon, 2 Mar 2020 13:02:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [gentoo-portage-dev] [PATCH gentoolkit 2/2] eclean: Add option to delete binpkgs with changed deps To: Zac Medico Cc: gentoo-portage-dev@lists.gentoo.org Content-Type: text/plain; charset="UTF-8" X-Archives-Salt: b7ae7b19-af55-4476-83b4-a72b8e9e86b4 X-Archives-Hash: 911055501e31d8085f665a1565c2bd83 On Mon, Mar 2, 2020 at 12:40 PM Matt Turner wrote: > > On Sun, Mar 1, 2020 at 10:32 PM Zac Medico 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)