1 |
Author: zmedico |
2 |
Date: 2008-12-25 01:12:48 +0000 (Thu, 25 Dec 2008) |
3 |
New Revision: 12310 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Simplify the code from bug #218854. Also, ensure that the set of visible packages |
9 |
thats used by depgraph._iter_atoms_for_pkg() is consistent with the packages that |
10 |
have been selected by depgraph._select_pkg_highest_available(). This should correct |
11 |
potential inconstencies introduced by the package selection changes from bug #252167. |
12 |
(trunk r12279) |
13 |
|
14 |
Modified: main/branches/2.1.6/pym/_emerge/__init__.py |
15 |
=================================================================== |
16 |
--- main/branches/2.1.6/pym/_emerge/__init__.py 2008-12-25 01:12:33 UTC (rev 12309) |
17 |
+++ main/branches/2.1.6/pym/_emerge/__init__.py 2008-12-25 01:12:48 UTC (rev 12310) |
18 |
@@ -4291,7 +4291,7 @@ |
19 |
# to the graph. |
20 |
self._graph_trees = {} |
21 |
# All Package instances |
22 |
- self._pkg_cache = self._package_cache(self) |
23 |
+ self._pkg_cache = {} |
24 |
for myroot in trees: |
25 |
self.trees[myroot] = {} |
26 |
# Create a RootConfig instance that references |
27 |
@@ -5690,6 +5690,12 @@ |
28 |
return ret |
29 |
ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps) |
30 |
self._highest_pkg_cache[cache_key] = ret |
31 |
+ pkg, existing = ret |
32 |
+ if pkg is not None: |
33 |
+ settings = pkg.root_config.settings |
34 |
+ if visible(settings, pkg) and not (pkg.installed and \ |
35 |
+ settings._getMissingKeywords(pkg.cpv, pkg.metadata)): |
36 |
+ pkg.root_config.visible_pkgs.cpv_inject(pkg) |
37 |
return ret |
38 |
|
39 |
def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False): |
40 |
@@ -5997,22 +6003,6 @@ |
41 |
if pkg.cp == cp] |
42 |
break |
43 |
|
44 |
- # If the installed version is in a different slot and it is higher than |
45 |
- # the highest available visible package, _iter_atoms_for_pkg() may fail |
46 |
- # to properly match the available package with a corresponding argument |
47 |
- # atom. Detect this case and correct it here. |
48 |
- if not selective and len(matched_packages) > 1 and \ |
49 |
- matched_packages[-1].installed and \ |
50 |
- matched_packages[-1].slot_atom != \ |
51 |
- matched_packages[-2].slot_atom and \ |
52 |
- matched_packages[-1] > matched_packages[-2]: |
53 |
- pkg = matched_packages[-2] |
54 |
- if pkg.root == self.target_root and \ |
55 |
- self._set_atoms.findAtomForPackage(pkg): |
56 |
- # Select the available package instead |
57 |
- # of the installed package. |
58 |
- matched_packages.pop() |
59 |
- |
60 |
if len(matched_packages) > 1: |
61 |
bestmatch = portage.best( |
62 |
[pkg.cpv for pkg in matched_packages]) |
63 |
@@ -8456,22 +8446,6 @@ |
64 |
metadata = self._cpv_pkg_map[cpv].metadata |
65 |
return [metadata.get(x, "") for x in wants] |
66 |
|
67 |
- class _package_cache(dict): |
68 |
- def __init__(self, depgraph): |
69 |
- dict.__init__(self) |
70 |
- self._depgraph = depgraph |
71 |
- |
72 |
- def __setitem__(self, k, v): |
73 |
- dict.__setitem__(self, k, v) |
74 |
- root_config = self._depgraph.roots[v.root] |
75 |
- try: |
76 |
- if visible(root_config.settings, v) and \ |
77 |
- not (v.installed and \ |
78 |
- v.root_config.settings._getMissingKeywords(v.cpv, v.metadata)): |
79 |
- root_config.visible_pkgs.cpv_inject(v) |
80 |
- except portage.exception.InvalidDependString: |
81 |
- pass |
82 |
- |
83 |
class RepoDisplay(object): |
84 |
def __init__(self, roots): |
85 |
self._shown_repos = {} |