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 E7FDD138350 for ; Thu, 12 Mar 2020 16:51:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DD449E0936; Thu, 12 Mar 2020 16:51:47 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 B551EE0936 for ; Thu, 12 Mar 2020 16:51:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 934CD34EF3E for ; Thu, 12 Mar 2020 16:51:46 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 01374176 for ; Thu, 12 Mar 2020 16:51:44 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1583969581.98cdccea8f0abc88d360c0c7143263b210910611.mattst88@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/eclean/cli.py pym/gentoolkit/eclean/search.py X-VCS-Directories: pym/gentoolkit/eclean/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 98cdccea8f0abc88d360c0c7143263b210910611 X-VCS-Branch: master Date: Thu, 12 Mar 2020 16:51:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e3ec783a-71d6-407b-a003-37e2740e4d8e X-Archives-Hash: 940a555edc7ca386ff50a286a94ceeb5 commit: 98cdccea8f0abc88d360c0c7143263b210910611 Author: Matt Turner gentoo org> AuthorDate: Tue Feb 18 21:39:08 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Wed Mar 11 23:33:01 2020 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=98cdccea eclean: Add option to delete binpkgs with changed deps Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/eclean/cli.py | 7 ++++++- pym/gentoolkit/eclean/search.py | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py index 1a99b3e..39aafd3 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -147,6 +147,8 @@ def printUsage(_error=None, help=None): or help in ('all','packages'): print( "Available", yellow("options"),"for the", green("packages"),"action:", file=out) + print( yellow(" --changed-deps")+ + " - delete packages for which ebuild dependencies have changed", file=out) print( yellow(" -i, --ignore-failure")+ " - ignore failure to locate PKGDIR", file=out) print( file=out) @@ -263,6 +265,8 @@ def parseArgs(options={}): options['size-limit'] = parseSize(a) elif o in ("-v", "--verbose") and not options['quiet']: options['verbose'] = True + elif o in ("--changed-deps"): + options['changed-deps'] = True elif o in ("-i", "--ignore-failure"): options['ignore-failure'] = True else: @@ -290,7 +294,7 @@ def parseArgs(options={}): getopt_options['short']['distfiles'] = "fs:" getopt_options['long']['distfiles'] = ["fetch-restricted", "size-limit="] getopt_options['short']['packages'] = "i" - getopt_options['long']['packages'] = ["ignore-failure"] + getopt_options['long']['packages'] = ["ignore-failure", "changed-deps"] # set default options, except 'nocolor', which is set in main() options['interactive'] = False options['pretend'] = False @@ -303,6 +307,7 @@ def parseArgs(options={}): options['fetch-restricted'] = False options['size-limit'] = 0 options['verbose'] = False + options['changed-deps'] = False options['ignore-failure'] = False # if called by a well-named symlink, set the action accordingly: action = None diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 0efefdb..51edc63 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -13,6 +13,8 @@ import sys from functools import partial import portage +from portage.dep import Atom, use_reduce +from portage.dep._slot_operator import strip_slots import gentoolkit.pprinter as pp from gentoolkit.eclean.exclude import (exclDictMatchCP, exclDictExpand, @@ -488,6 +490,17 @@ class DistfilesSearch(object): return clean_me, saved +def _deps_equal(deps_a, deps_b, eapi, uselist=None): + """Compare two dependency lists given a set of USE flags""" + if deps_a == deps_b: return True + + deps_a = use_reduce(deps_a, uselist=uselist, eapi=eapi, token_class=Atom) + deps_b = use_reduce(deps_b, uselist=uselist, eapi=eapi, token_class=Atom) + strip_slots(deps_a) + strip_slots(deps_b) + return deps_a == deps_b + + def findPackages( options, exclude=None, @@ -562,7 +575,16 @@ 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 + + keys = ('RDEPEND', 'PDEPEND') + binpkg_deps = ' '.join(bin_dbapi.aux_get(cpv, keys)) + ebuild_deps = ' '.join(port_dbapi.aux_get(cpv, keys)) + uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split() + + if _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, uselist): + continue if destructive and var_dbapi.cpv_exists(cpv): # Exclude if an instance of the package is installed due to