1 |
commit: 7d2f40b076de343fac08fe026e0c1704ef7db2c8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 1 17:12:21 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 1 17:44:11 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d2f40b0 |
7 |
|
8 |
ChangedDepsSet: use strip_slots function like --changed-deps (bug 739908) |
9 |
|
10 |
Bug: https://bugs.gentoo.org/739908 |
11 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
12 |
|
13 |
lib/portage/_sets/dbapi.py | 51 ++++++++++++++-------------------------------- |
14 |
1 file changed, 15 insertions(+), 36 deletions(-) |
15 |
|
16 |
diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py |
17 |
index d73aedb8f..52367c4a6 100644 |
18 |
--- a/lib/portage/_sets/dbapi.py |
19 |
+++ b/lib/portage/_sets/dbapi.py |
20 |
@@ -2,13 +2,13 @@ |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
import glob |
24 |
-import re |
25 |
import time |
26 |
|
27 |
from portage import os |
28 |
+from portage.exception import PortageKeyError |
29 |
from portage.versions import best, catsplit, vercmp |
30 |
from portage.dep import Atom, use_reduce |
31 |
-from portage.exception import InvalidAtom |
32 |
+from portage.dep._slot_operator import strip_slots |
33 |
from portage.localization import _ |
34 |
from portage._sets.base import PackageSet |
35 |
from portage._sets import SetConfigError, get_boolean |
36 |
@@ -484,52 +484,31 @@ class ChangedDepsSet(PackageSet): |
37 |
|
38 |
def load(self): |
39 |
depvars = ('RDEPEND', 'PDEPEND') |
40 |
- |
41 |
- # regexp used to match atoms using subslot operator := |
42 |
- subslot_repl_re = re.compile(r':[^[]*=') |
43 |
+ ebuild_vars = depvars + ('EAPI',) |
44 |
+ installed_vars = depvars + ('USE', 'EAPI') |
45 |
|
46 |
atoms = [] |
47 |
for cpv in self._vardb.cpv_all(): |
48 |
# no ebuild, no update :). |
49 |
- if not self._portdb.cpv_exists(cpv): |
50 |
+ try: |
51 |
+ ebuild_metadata = dict(zip(ebuild_vars, self._portdb.aux_get(cpv, ebuild_vars))) |
52 |
+ except PortageKeyError: |
53 |
continue |
54 |
|
55 |
# USE flags used to build the ebuild and EAPI |
56 |
# (needed for Atom & use_reduce()) |
57 |
- use, eapi = self._vardb.aux_get(cpv, ('USE', 'EAPI')) |
58 |
- usel = use.split() |
59 |
- |
60 |
- # function used to recursively process atoms in nested lists. |
61 |
- def clean_subslots(depatom, usel=None): |
62 |
- if isinstance(depatom, list): |
63 |
- # process the nested list. |
64 |
- return [clean_subslots(x, usel) for x in depatom] |
65 |
- |
66 |
- try: |
67 |
- # this can be either an atom or some special operator. |
68 |
- # in the latter case, we get InvalidAtom and pass it as-is. |
69 |
- a = Atom(depatom) |
70 |
- except InvalidAtom: |
71 |
- return depatom |
72 |
- # if we're processing portdb, we need to evaluate USE flag |
73 |
- # dependency conditionals to make them match vdb. this |
74 |
- # requires passing the list of USE flags, so we reuse it |
75 |
- # as conditional for the operation as well. |
76 |
- if usel is not None: |
77 |
- a = a.evaluate_conditionals(usel) |
78 |
- |
79 |
- # replace slot operator := dependencies with plain := |
80 |
- # since we can't properly compare expanded slots |
81 |
- # in vardb to abstract slots in portdb. |
82 |
- return subslot_repl_re.sub(':=', a) |
83 |
+ installed_metadata = dict(zip(installed_vars, self._vardb.aux_get(cpv, installed_vars))) |
84 |
+ usel = frozenset(installed_metadata['USE'].split()) |
85 |
|
86 |
# get all *DEPEND variables from vdb & portdb and compare them. |
87 |
# we need to do some cleaning up & expansion to make matching |
88 |
# meaningful since vdb dependencies are conditional-free. |
89 |
- vdbvars = [clean_subslots(use_reduce(x, uselist=usel, eapi=eapi)) |
90 |
- for x in self._vardb.aux_get(cpv, depvars)] |
91 |
- pdbvars = [clean_subslots(use_reduce(x, uselist=usel, eapi=eapi), usel) |
92 |
- for x in self._portdb.aux_get(cpv, depvars)] |
93 |
+ vdbvars = [strip_slots(use_reduce(installed_metadata[k], |
94 |
+ uselist=usel, eapi=installed_metadata['EAPI'], token_class=Atom)) |
95 |
+ for k in depvars] |
96 |
+ pdbvars = [strip_slots(use_reduce(ebuild_metadata[k], |
97 |
+ uselist=usel, eapi=ebuild_metadata['EAPI'], token_class=Atom)) |
98 |
+ for k in depvars] |
99 |
|
100 |
# if dependencies don't match, trigger the rebuild. |
101 |
if vdbvars != pdbvars: |