commit: 7d2f40b076de343fac08fe026e0c1704ef7db2c8 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Tue Sep 1 17:12:21 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Tue Sep 1 17:44:11 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d2f40b0
ChangedDepsSet: use strip_slots function like --changed-deps (bug 739908) Bug: https://bugs.gentoo.org/739908 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/_sets/dbapi.py | 51 ++++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py index d73aedb8f..52367c4a6 100644 --- a/lib/portage/_sets/dbapi.py +++ b/lib/portage/_sets/dbapi.py @@ -2,13 +2,13 @@ # Distributed under the terms of the GNU General Public License v2 import glob -import re import time from portage import os +from portage.exception import PortageKeyError from portage.versions import best, catsplit, vercmp from portage.dep import Atom, use_reduce -from portage.exception import InvalidAtom +from portage.dep._slot_operator import strip_slots from portage.localization import _ from portage._sets.base import PackageSet from portage._sets import SetConfigError, get_boolean @@ -484,52 +484,31 @@ class ChangedDepsSet(PackageSet): def load(self): depvars = ('RDEPEND', 'PDEPEND') - - # regexp used to match atoms using subslot operator := - subslot_repl_re = re.compile(r':[^[]*=') + ebuild_vars = depvars + ('EAPI',) + installed_vars = depvars + ('USE', 'EAPI') atoms = [] for cpv in self._vardb.cpv_all(): # no ebuild, no update :). - if not self._portdb.cpv_exists(cpv): + try: + ebuild_metadata = dict(zip(ebuild_vars, self._portdb.aux_get(cpv, ebuild_vars))) + except PortageKeyError: continue # USE flags used to build the ebuild and EAPI # (needed for Atom & use_reduce()) - use, eapi = self._vardb.aux_get(cpv, ('USE', 'EAPI')) - usel = use.split() - - # function used to recursively process atoms in nested lists. - def clean_subslots(depatom, usel=None): - if isinstance(depatom, list): - # process the nested list. - return [clean_subslots(x, usel) for x in depatom] - - try: - # this can be either an atom or some special operator. - # in the latter case, we get InvalidAtom and pass it as-is. - a = Atom(depatom) - except InvalidAtom: - return depatom - # if we're processing portdb, we need to evaluate USE flag - # dependency conditionals to make them match vdb. this - # requires passing the list of USE flags, so we reuse it - # as conditional for the operation as well. - if usel is not None: - a = a.evaluate_conditionals(usel) - - # replace slot operator := dependencies with plain := - # since we can't properly compare expanded slots - # in vardb to abstract slots in portdb. - return subslot_repl_re.sub(':=', a) + installed_metadata = dict(zip(installed_vars, self._vardb.aux_get(cpv, installed_vars))) + usel = frozenset(installed_metadata['USE'].split()) # get all *DEPEND variables from vdb & portdb and compare them. # we need to do some cleaning up & expansion to make matching # meaningful since vdb dependencies are conditional-free. - vdbvars = [clean_subslots(use_reduce(x, uselist=usel, eapi=eapi)) - for x in self._vardb.aux_get(cpv, depvars)] - pdbvars = [clean_subslots(use_reduce(x, uselist=usel, eapi=eapi), usel) - for x in self._portdb.aux_get(cpv, depvars)] + vdbvars = [strip_slots(use_reduce(installed_metadata[k], + uselist=usel, eapi=installed_metadata['EAPI'], token_class=Atom)) + for k in depvars] + pdbvars = [strip_slots(use_reduce(ebuild_metadata[k], + uselist=usel, eapi=ebuild_metadata['EAPI'], token_class=Atom)) + for k in depvars] # if dependencies don't match, trigger the rebuild. if vdbvars != pdbvars:
