1 |
commit: 5842e87872fd738cdfc7d0698463f1d11ffe5dee |
2 |
Author: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de> |
3 |
AuthorDate: Mon Nov 25 22:11:41 2013 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Nov 26 09:14:54 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5842e878 |
7 |
|
8 |
Fix slot operator handling bug |
9 |
|
10 |
emerge would backtrack once for each package that needed a rebuild. |
11 |
This caused it to hit the backtrack limit and to not rebuild all |
12 |
packages. |
13 |
It also sometimes failed to install the packages that caused the rebuild |
14 |
in the first place, making the rebuilds pointless. |
15 |
This fixes bug 486580. |
16 |
|
17 |
--- |
18 |
pym/_emerge/depgraph.py | 56 ++++++++++++++++++++++++++++++++++++------------- |
19 |
1 file changed, 41 insertions(+), 15 deletions(-) |
20 |
|
21 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
22 |
index a6efa63..033057b 100644 |
23 |
--- a/pym/_emerge/depgraph.py |
24 |
+++ b/pym/_emerge/depgraph.py |
25 |
@@ -650,11 +650,18 @@ class depgraph(object): |
26 |
# has a parent that is matched by one of the atoms from above. |
27 |
forced_rebuilds = {} |
28 |
for (root, slot_atom), deps in self._dynamic_config._slot_operator_deps.items(): |
29 |
- if slot_atom not in atoms.get(root, []): |
30 |
- continue |
31 |
+ rebuild_atoms = atoms.get(root, set()) |
32 |
|
33 |
for dep in deps: |
34 |
- if dep.parent.installed: |
35 |
+ if dep.parent.installed or dep.child.installed or \ |
36 |
+ dep.parent.slot_atom not in rebuild_atoms: |
37 |
+ continue |
38 |
+ |
39 |
+ # Make sure the child's slot/subslot has changed. If it hasn't, |
40 |
+ # then another child has forced this rebuild. |
41 |
+ installed_pkg, _ = self._select_pkg_from_installed(root, dep.child.slot_atom) |
42 |
+ if installed_pkg and installed_pkg.slot == dep.child.slot and \ |
43 |
+ installed_pkg.sub_slot == dep.child.sub_slot: |
44 |
continue |
45 |
|
46 |
# The child has forced a rebuild of the parent |
47 |
@@ -1627,12 +1634,10 @@ class depgraph(object): |
48 |
if new_dep is not None: |
49 |
self._slot_operator_update_backtrack(dep, |
50 |
new_child_slot=new_dep.child) |
51 |
- break |
52 |
|
53 |
if dep.want_update: |
54 |
if self._slot_operator_update_probe(dep): |
55 |
self._slot_operator_update_backtrack(dep) |
56 |
- break |
57 |
|
58 |
def _reinstall_for_flags(self, pkg, forced_flags, |
59 |
orig_use, orig_iuse, cur_use, cur_iuse): |
60 |
@@ -2518,7 +2523,7 @@ class depgraph(object): |
61 |
yield (atom, None) |
62 |
continue |
63 |
dep_pkg, existing_node = self._select_package( |
64 |
- root_config.root, atom) |
65 |
+ root_config.root, atom, parent=parent) |
66 |
if dep_pkg is None: |
67 |
yield (atom, None) |
68 |
continue |
69 |
@@ -4345,12 +4350,12 @@ class depgraph(object): |
70 |
yield inst_pkg |
71 |
return |
72 |
|
73 |
- def _select_pkg_highest_available(self, root, atom, onlydeps=False): |
74 |
+ def _select_pkg_highest_available(self, root, atom, onlydeps=False, parent=None): |
75 |
cache_key = (root, atom, atom.unevaluated_atom, onlydeps, self._dynamic_config._autounmask) |
76 |
ret = self._dynamic_config._highest_pkg_cache.get(cache_key) |
77 |
if ret is not None: |
78 |
return ret |
79 |
- ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps) |
80 |
+ ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps, parent=parent) |
81 |
self._dynamic_config._highest_pkg_cache[cache_key] = ret |
82 |
pkg, existing = ret |
83 |
if pkg is not None: |
84 |
@@ -4511,8 +4516,9 @@ class depgraph(object): |
85 |
yield autounmask_level |
86 |
|
87 |
|
88 |
- def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False): |
89 |
- pkg, existing = self._wrapped_select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps) |
90 |
+ def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False, parent=None): |
91 |
+ pkg, existing = self._wrapped_select_pkg_highest_available_imp( |
92 |
+ root, atom, onlydeps=onlydeps, parent=parent) |
93 |
|
94 |
default_selection = (pkg, existing) |
95 |
|
96 |
@@ -4534,7 +4540,7 @@ class depgraph(object): |
97 |
pkg, existing = \ |
98 |
self._wrapped_select_pkg_highest_available_imp( |
99 |
root, atom, onlydeps=onlydeps, |
100 |
- autounmask_level=autounmask_level) |
101 |
+ autounmask_level=autounmask_level, parent=parent) |
102 |
|
103 |
if pkg is not None and \ |
104 |
pkg.installed and \ |
105 |
@@ -4740,7 +4746,7 @@ class depgraph(object): |
106 |
self._dynamic_config._need_restart = True |
107 |
return new_use |
108 |
|
109 |
- def _wrapped_select_pkg_highest_available_imp(self, root, atom, onlydeps=False, autounmask_level=None): |
110 |
+ def _wrapped_select_pkg_highest_available_imp(self, root, atom, onlydeps=False, autounmask_level=None, parent=None): |
111 |
root_config = self._frozen_config.roots[root] |
112 |
pkgsettings = self._frozen_config.pkgsettings[root] |
113 |
dbs = self._dynamic_config._filtered_trees[root]["dbs"] |
114 |
@@ -5107,6 +5113,26 @@ class depgraph(object): |
115 |
return existing_node, existing_node |
116 |
|
117 |
if len(matched_packages) > 1: |
118 |
+ if parent is not None and \ |
119 |
+ (parent.root, parent.slot_atom) in self._dynamic_config._slot_operator_replace_installed: |
120 |
+ # We're forcing a rebuild of the parent because we missed some |
121 |
+ # update because of a slot operator dep. |
122 |
+ if atom.slot_operator == "=" and atom.sub_slot is None: |
123 |
+ # This one is a slot operator dep. Exclude the installed packages if a newer non-installed |
124 |
+ # pkg exists. |
125 |
+ highest_installed = None |
126 |
+ for pkg in matched_packages: |
127 |
+ if pkg.installed: |
128 |
+ if highest_installed is None or pkg.version > highest_installed.version: |
129 |
+ highest_installed = pkg |
130 |
+ |
131 |
+ if highest_installed: |
132 |
+ non_installed = [pkg for pkg in matched_packages \ |
133 |
+ if not pkg.installed and pkg.version > highest_installed.version] |
134 |
+ |
135 |
+ if non_installed: |
136 |
+ matched_packages = non_installed |
137 |
+ |
138 |
if rebuilt_binaries: |
139 |
inst_pkg = None |
140 |
built_pkg = None |
141 |
@@ -5172,7 +5198,7 @@ class depgraph(object): |
142 |
# ordered by type preference ("ebuild" type is the last resort) |
143 |
return matched_packages[-1], existing_node |
144 |
|
145 |
- def _select_pkg_from_graph(self, root, atom, onlydeps=False): |
146 |
+ def _select_pkg_from_graph(self, root, atom, onlydeps=False, parent=None): |
147 |
""" |
148 |
Select packages that have already been added to the graph or |
149 |
those that are installed and have not been scheduled for |
150 |
@@ -5191,9 +5217,9 @@ class depgraph(object): |
151 |
return pkg, pkg |
152 |
|
153 |
# Fall back to installed packages |
154 |
- return self._select_pkg_from_installed(root, atom, onlydeps=onlydeps) |
155 |
+ return self._select_pkg_from_installed(root, atom, onlydeps=onlydeps, parent=parent) |
156 |
|
157 |
- def _select_pkg_from_installed(self, root, atom, onlydeps=False): |
158 |
+ def _select_pkg_from_installed(self, root, atom, onlydeps=False, parent=None): |
159 |
""" |
160 |
Select packages that are installed. |
161 |
""" |