1 |
commit: b33d96f3f60a494ff528a3bd0671a3d0fa6682e8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 2 01:42:32 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 2 01:42:32 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b33d96f3 |
7 |
|
8 |
depgraph: account for new-style virtual/libc |
9 |
|
10 |
This will fix bug #364681. |
11 |
|
12 |
--- |
13 |
pym/_emerge/depgraph.py | 164 ++++++++++++++++++++++++++-------------------- |
14 |
1 files changed, 93 insertions(+), 71 deletions(-) |
15 |
|
16 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
17 |
index 5c39497..2401541 100644 |
18 |
--- a/pym/_emerge/depgraph.py |
19 |
+++ b/pym/_emerge/depgraph.py |
20 |
@@ -2465,6 +2465,39 @@ class depgraph(object): |
21 |
|
22 |
return selected_atoms |
23 |
|
24 |
+ def _expand_virt_from_graph(self, root, atom): |
25 |
+ if not isinstance(atom, Atom): |
26 |
+ atom = Atom(atom) |
27 |
+ graphdb = self._dynamic_config.mydbapi[root] |
28 |
+ match = graphdb.match_pkgs(atom) |
29 |
+ if not match: |
30 |
+ yield atom |
31 |
+ return |
32 |
+ pkg = match[-1] |
33 |
+ if not pkg.cpv.startswith("virtual/"): |
34 |
+ yield atom |
35 |
+ return |
36 |
+ try: |
37 |
+ rdepend = self._select_atoms_from_graph( |
38 |
+ pkg.root, pkg.metadata.get("RDEPEND", ""), |
39 |
+ myuse=self._pkg_use_enabled(pkg), |
40 |
+ parent=pkg, strict=False) |
41 |
+ except InvalidDependString as e: |
42 |
+ writemsg_level("!!! Invalid RDEPEND in " + \ |
43 |
+ "'%svar/db/pkg/%s/RDEPEND': %s\n" % \ |
44 |
+ (pkg.root, pkg.cpv, e), |
45 |
+ noiselevel=-1, level=logging.ERROR) |
46 |
+ yield atom |
47 |
+ return |
48 |
+ |
49 |
+ for atoms in rdepend.values(): |
50 |
+ for atom in atoms: |
51 |
+ if hasattr(atom, "_orig_atom"): |
52 |
+ # Ignore virtual atoms since we're only |
53 |
+ # interested in expanding the real atoms. |
54 |
+ continue |
55 |
+ yield atom |
56 |
+ |
57 |
def _get_dep_chain(self, start_node, target_atom=None, |
58 |
unsatisfied_dependency=False): |
59 |
""" |
60 |
@@ -4394,65 +4427,44 @@ class depgraph(object): |
61 |
def _implicit_libc_deps(self, mergelist, graph): |
62 |
""" |
63 |
Create implicit dependencies on libc, in order to ensure that libc |
64 |
- is installed as early as possible (see bug #303567). If the merge |
65 |
- list contains both a new-style virtual and an old-style PROVIDE |
66 |
- virtual, the new-style virtual is used. |
67 |
+ is installed as early as possible (see bug #303567). |
68 |
""" |
69 |
- implicit_libc_roots = set([self._frozen_config._running_root.root]) |
70 |
- libc_set = InternalPackageSet([portage.const.LIBC_PACKAGE_ATOM]) |
71 |
- norm_libc_pkgs = {} |
72 |
- virt_libc_pkgs = {} |
73 |
- for pkg in mergelist: |
74 |
- if not isinstance(pkg, Package): |
75 |
- # a satisfied blocker |
76 |
- continue |
77 |
- if pkg.installed: |
78 |
- continue |
79 |
- if pkg.root in implicit_libc_roots and \ |
80 |
- pkg.operation == 'merge': |
81 |
- if libc_set.findAtomForPackage(pkg): |
82 |
- if pkg.category == 'virtual': |
83 |
- d = virt_libc_pkgs |
84 |
- else: |
85 |
- d = norm_libc_pkgs |
86 |
- if pkg.root in d: |
87 |
- raise AssertionError( |
88 |
- "found 2 libc matches: %s and %s" % \ |
89 |
- (d[pkg.root], pkg)) |
90 |
- d[pkg.root] = pkg |
91 |
- |
92 |
- # Prefer new-style virtuals over old-style PROVIDE virtuals. |
93 |
- libc_pkg_map = norm_libc_pkgs.copy() |
94 |
- libc_pkg_map.update(virt_libc_pkgs) |
95 |
- |
96 |
- # Only add a dep when the version changes. |
97 |
- for libc_pkg in list(libc_pkg_map.values()): |
98 |
- if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( |
99 |
- libc_pkg.cpv): |
100 |
- del libc_pkg_map[pkg.root] |
101 |
- |
102 |
- if not libc_pkg_map: |
103 |
+ libc_pkgs = {} |
104 |
+ implicit_libc_roots = (self._frozen_config._running_root.root,) |
105 |
+ for root in implicit_libc_roots: |
106 |
+ graphdb = self._dynamic_config.mydbapi[root] |
107 |
+ vardb = self._frozen_config.trees[root]["vartree"].dbapi |
108 |
+ for atom in self._expand_virt_from_graph(root, |
109 |
+ portage.const.LIBC_PACKAGE_ATOM): |
110 |
+ if atom.blocker: |
111 |
+ continue |
112 |
+ match = graphdb.match_pkgs(atom) |
113 |
+ if not match: |
114 |
+ continue |
115 |
+ pkg = match[-1] |
116 |
+ if pkg.operation == "merge" and \ |
117 |
+ not vardb.cpv_exists(pkg.cpv): |
118 |
+ libc_pkgs.setdefault(pkg.root, set()).add(pkg) |
119 |
+ |
120 |
+ if not libc_pkgs: |
121 |
return |
122 |
|
123 |
- libc_pkgs = set(libc_pkg_map.values()) |
124 |
earlier_libc_pkgs = set() |
125 |
|
126 |
for pkg in mergelist: |
127 |
if not isinstance(pkg, Package): |
128 |
# a satisfied blocker |
129 |
continue |
130 |
- if pkg.installed: |
131 |
- continue |
132 |
- if pkg.root in implicit_libc_roots and \ |
133 |
- pkg.operation == 'merge': |
134 |
- if pkg in libc_pkgs: |
135 |
+ root_libc_pkgs = libc_pkgs.get(pkg.root) |
136 |
+ if root_libc_pkgs is not None and \ |
137 |
+ pkg.operation == "merge": |
138 |
+ if pkg in root_libc_pkgs: |
139 |
earlier_libc_pkgs.add(pkg) |
140 |
else: |
141 |
- my_libc = libc_pkg_map.get(pkg.root) |
142 |
- if my_libc is not None and \ |
143 |
- my_libc in earlier_libc_pkgs: |
144 |
- graph.add(my_libc, pkg, |
145 |
- priority=DepPriority(buildtime=True)) |
146 |
+ for libc_pkg in root_libc_pkgs: |
147 |
+ if libc_pkg in earlier_libc_pkgs: |
148 |
+ graph.add(libc_pkg, pkg, |
149 |
+ priority=DepPriority(buildtime=True)) |
150 |
|
151 |
def schedulerGraph(self): |
152 |
""" |
153 |
@@ -4669,29 +4681,39 @@ class depgraph(object): |
154 |
|
155 |
# Merge libc asap, in order to account for implicit |
156 |
# dependencies. See bug #303567. |
157 |
- for root in (running_root,): |
158 |
- libc_pkg = self._dynamic_config.mydbapi[root].match_pkgs( |
159 |
- portage.const.LIBC_PACKAGE_ATOM) |
160 |
- if libc_pkg: |
161 |
- libc_pkg = libc_pkg[0] |
162 |
- if libc_pkg.operation == 'merge': |
163 |
- # Only add a dep when the version changes. |
164 |
- if not libc_pkg.root_config.trees[ |
165 |
- 'vartree'].dbapi.cpv_exists(libc_pkg.cpv): |
166 |
- |
167 |
- # If there's also an os-headers upgrade, we need to |
168 |
- # pull that in first. See bug #328317. |
169 |
- os_headers_pkg = self._dynamic_config.mydbapi[root].match_pkgs( |
170 |
- portage.const.OS_HEADERS_PACKAGE_ATOM) |
171 |
- if os_headers_pkg: |
172 |
- os_headers_pkg = os_headers_pkg[0] |
173 |
- if os_headers_pkg.operation == 'merge': |
174 |
- # Only add a dep when the version changes. |
175 |
- if not os_headers_pkg.root_config.trees[ |
176 |
- 'vartree'].dbapi.cpv_exists(os_headers_pkg.cpv): |
177 |
- asap_nodes.append(os_headers_pkg) |
178 |
- |
179 |
- asap_nodes.append(libc_pkg) |
180 |
+ implicit_libc_roots = (running_root,) |
181 |
+ for root in implicit_libc_roots: |
182 |
+ libc_pkgs = set() |
183 |
+ vardb = self._frozen_config.trees[root]["vartree"].dbapi |
184 |
+ graphdb = self._dynamic_config.mydbapi[root] |
185 |
+ for atom in self._expand_virt_from_graph(root, |
186 |
+ portage.const.LIBC_PACKAGE_ATOM): |
187 |
+ if atom.blocker: |
188 |
+ continue |
189 |
+ match = graphdb.match_pkgs(atom) |
190 |
+ if not match: |
191 |
+ continue |
192 |
+ pkg = match[-1] |
193 |
+ if pkg.operation == "merge" and \ |
194 |
+ not vardb.cpv_exists(pkg.cpv): |
195 |
+ libc_pkgs.add(pkg) |
196 |
+ |
197 |
+ if libc_pkgs: |
198 |
+ # If there's also an os-headers upgrade, we need to |
199 |
+ # pull that in first. See bug #328317. |
200 |
+ for atom in self._expand_virt_from_graph(root, |
201 |
+ portage.const.OS_HEADERS_PACKAGE_ATOM): |
202 |
+ if atom.blocker: |
203 |
+ continue |
204 |
+ match = graphdb.match_pkgs(atom) |
205 |
+ if not match: |
206 |
+ continue |
207 |
+ pkg = match[-1] |
208 |
+ if pkg.operation == "merge" and \ |
209 |
+ not vardb.cpv_exists(pkg.cpv): |
210 |
+ asap_nodes.append(pkg) |
211 |
+ |
212 |
+ asap_nodes.extend(libc_pkgs) |
213 |
|
214 |
def gather_deps(ignore_priority, mergeable_nodes, |
215 |
selected_nodes, node): |