Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/_emerge/
Date: Thu, 28 Aug 2014 16:07:36
Message-Id: 1409241762.617a64f77055ddda1dd86a506cf98f5adc545fae.zmedico@gentoo
1 commit: 617a64f77055ddda1dd86a506cf98f5adc545fae
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 28 00:07:10 2014 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 28 16:02:42 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=617a64f7
7
8 dep_check: fix bug #515230
9
10 This fixes dep_check so that graph packages do not mask non-graph
11 packages (in the same slot) unless the graph packages also match the
12 dependency atom being satisfied. This requires logic changes in both
13 _dep_check_composite_db._visible and dep_zapdeps.
14
15 Also, fix _dep_check_composite_db match / _cpv_pkg_map
16 interactions to ensure correct match results.
17
18 X-Gentoo-Bug: 515230
19 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515230
20
21 ---
22 pym/_emerge/depgraph.py | 30 +++++++++++++++++++-----------
23 pym/portage/dep/dep_check.py | 10 +++++-----
24 2 files changed, 24 insertions(+), 16 deletions(-)
25
26 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
27 index a10297a..845a43a 100644
28 --- a/pym/_emerge/depgraph.py
29 +++ b/pym/_emerge/depgraph.py
30 @@ -8259,18 +8259,20 @@ class _dep_check_composite_db(dbapi):
31
32 return ret
33
34 - def match(self, atom):
35 + def match_pkgs(self, atom):
36 cache_key = (atom, atom.unevaluated_atom)
37 ret = self._match_cache.get(cache_key)
38 if ret is not None:
39 + for pkg in ret:
40 + self._cpv_pkg_map[pkg.cpv] = pkg
41 return ret[:]
42
43 + atom_set = InternalPackageSet(initial_atoms=(atom,))
44 ret = []
45 pkg, existing = self._depgraph._select_package(self._root, atom)
46
47 - if pkg is not None and self._visible(pkg):
48 - self._cpv_pkg_map[pkg.cpv] = pkg
49 - ret.append(pkg.cpv)
50 + if pkg is not None and self._visible(pkg, atom_set):
51 + ret.append(pkg)
52
53 if pkg is not None and \
54 atom.slot is None and \
55 @@ -8301,18 +8303,19 @@ class _dep_check_composite_db(dbapi):
56 self._root, slot_atom)
57 if not pkg:
58 continue
59 - if not self._visible(pkg):
60 + if not self._visible(pkg, atom_set):
61 continue
62 - self._cpv_pkg_map[pkg.cpv] = pkg
63 - ret.append(pkg.cpv)
64 + ret.append(pkg)
65
66 if len(ret) > 1:
67 - self._cpv_sort_ascending(ret)
68 + ret.sort()
69
70 self._match_cache[cache_key] = ret
71 + for pkg in ret:
72 + self._cpv_pkg_map[pkg.cpv] = pkg
73 return ret[:]
74
75 - def _visible(self, pkg):
76 + def _visible(self, pkg, atom_set):
77 if pkg.installed and not self._depgraph._want_installed_pkg(pkg):
78 return False
79 if pkg.installed and \
80 @@ -8350,6 +8353,11 @@ class _dep_check_composite_db(dbapi):
81 elif in_graph != pkg:
82 # Mask choices for packages that would trigger a slot
83 # conflict with a previously selected package.
84 + if not atom_set.findAtomForPackage(in_graph,
85 + modified_use=self._depgraph._pkg_use_enabled(in_graph)):
86 + # Only mask if the graph package matches the given
87 + # atom (fixes bug #515230).
88 + return True
89 return False
90 return True
91
92 @@ -8357,8 +8365,8 @@ class _dep_check_composite_db(dbapi):
93 metadata = self._cpv_pkg_map[cpv]._metadata
94 return [metadata.get(x, "") for x in wants]
95
96 - def match_pkgs(self, atom):
97 - return [self._cpv_pkg_map[cpv] for cpv in self.match(atom)]
98 + def match(self, atom):
99 + return [pkg.cpv for pkg in self.match_pkgs(atom)]
100
101 def ambiguous_package_name(arg, atoms, root_config, spinner, myopts):
102
103
104 diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
105 index b79c5bc..22eed96 100644
106 --- a/pym/portage/dep/dep_check.py
107 +++ b/pym/portage/dep/dep_check.py
108 @@ -1,4 +1,4 @@
109 -# Copyright 2010-2013 Gentoo Foundation
110 +# Copyright 2010-2014 Gentoo Foundation
111 # Distributed under the terms of the GNU General Public License v2
112
113 from __future__ import unicode_literals
114 @@ -414,16 +414,16 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
115 unsat_use_non_installed.append(this_choice)
116 else:
117 all_in_graph = True
118 - for slot_atom in slot_map:
119 + for atom in atoms:
120 # New-style virtuals have zero cost to install.
121 - if slot_atom.startswith("virtual/"):
122 + if atom.blocker or atom.cp.startswith("virtual/"):
123 continue
124 # We check if the matched package has actually been
125 # added to the digraph, in order to distinguish between
126 # those packages and installed packages that may need
127 # to be uninstalled in order to resolve blockers.
128 - graph_matches = graph_db.match_pkgs(slot_atom)
129 - if not graph_matches or graph_matches[-1] not in graph:
130 + if not any(pkg in graph for pkg in
131 + graph_db.match_pkgs(atom)):
132 all_in_graph = False
133 break
134 circular_atom = None