aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-09-01 10:12:21 -0700
committerZac Medico <zmedico@gentoo.org>2020-09-01 10:44:11 -0700
commit7d2f40b076de343fac08fe026e0c1704ef7db2c8 (patch)
tree5ec61adbafa6d482c0b9df29e06e593fb5731fcf
parentUpdates for portage-3.0.5 release (diff)
downloadportage-7d2f40b076de343fac08fe026e0c1704ef7db2c8.tar.gz
portage-7d2f40b076de343fac08fe026e0c1704ef7db2c8.tar.bz2
portage-7d2f40b076de343fac08fe026e0c1704ef7db2c8.zip
ChangedDepsSet: use strip_slots function like --changed-deps (bug 739908)
Bug: https://bugs.gentoo.org/739908 Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/_sets/dbapi.py51
1 files 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: