1 |
commit: d6080afba243844083838b5779afbe0ebbb81626 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 30 20:38:00 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 30 20:38:00 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d6080afb |
7 |
|
8 |
depgraph: migrate implicit libc deps from Sched |
9 |
|
10 |
Now all the virtual/libc handling is done by the depgraph, which |
11 |
will be helpful when fixing bug #364681. |
12 |
|
13 |
--- |
14 |
pym/_emerge/Scheduler.py | 65 ---------------------------------------------- |
15 |
pym/_emerge/depgraph.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++ |
16 |
2 files changed, 65 insertions(+), 65 deletions(-) |
17 |
|
18 |
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py |
19 |
index dfccbc4..df13b6b 100644 |
20 |
--- a/pym/_emerge/Scheduler.py |
21 |
+++ b/pym/_emerge/Scheduler.py |
22 |
@@ -22,7 +22,6 @@ from portage import os |
23 |
from portage import _encodings |
24 |
from portage import _unicode_decode, _unicode_encode |
25 |
from portage.cache.mappings import slot_dict_class |
26 |
-from portage.const import LIBC_PACKAGE_ATOM |
27 |
from portage.elog.messages import eerror |
28 |
from portage.localization import _ |
29 |
from portage.output import colorize, create_color_func, red |
30 |
@@ -476,7 +475,6 @@ class Scheduler(PollScheduler): |
31 |
self._find_system_deps() |
32 |
self._prune_digraph() |
33 |
self._prevent_builddir_collisions() |
34 |
- self._implicit_libc_deps() |
35 |
if '--debug' in self.myopts: |
36 |
writemsg("\nscheduler digraph:\n\n", noiselevel=-1) |
37 |
self._digraph.debug_print() |
38 |
@@ -542,69 +540,6 @@ class Scheduler(PollScheduler): |
39 |
priority=DepPriority(buildtime=True)) |
40 |
cpv_map[pkg.cpv].append(pkg) |
41 |
|
42 |
- def _implicit_libc_deps(self): |
43 |
- """ |
44 |
- Create implicit dependencies on libc, in order to ensure that libc |
45 |
- is installed as early as possible (see bug #303567). If the merge |
46 |
- list contains both a new-style virtual and an old-style PROVIDE |
47 |
- virtual, the new-style virtual is used. |
48 |
- """ |
49 |
- implicit_libc_roots = set([self._running_root.root]) |
50 |
- libc_set = InternalPackageSet([LIBC_PACKAGE_ATOM]) |
51 |
- norm_libc_pkgs = {} |
52 |
- virt_libc_pkgs = {} |
53 |
- for pkg in self._mergelist: |
54 |
- if not isinstance(pkg, Package): |
55 |
- # a satisfied blocker |
56 |
- continue |
57 |
- if pkg.installed: |
58 |
- continue |
59 |
- if pkg.root in implicit_libc_roots and \ |
60 |
- pkg.operation == 'merge': |
61 |
- if libc_set.findAtomForPackage(pkg): |
62 |
- if pkg.category == 'virtual': |
63 |
- d = virt_libc_pkgs |
64 |
- else: |
65 |
- d = norm_libc_pkgs |
66 |
- if pkg.root in d: |
67 |
- raise AssertionError( |
68 |
- "found 2 libc matches: %s and %s" % \ |
69 |
- (d[pkg.root], pkg)) |
70 |
- d[pkg.root] = pkg |
71 |
- |
72 |
- # Prefer new-style virtuals over old-style PROVIDE virtuals. |
73 |
- libc_pkg_map = norm_libc_pkgs.copy() |
74 |
- libc_pkg_map.update(virt_libc_pkgs) |
75 |
- |
76 |
- # Only add a dep when the version changes. |
77 |
- for libc_pkg in list(libc_pkg_map.values()): |
78 |
- if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( |
79 |
- libc_pkg.cpv): |
80 |
- del libc_pkg_map[pkg.root] |
81 |
- |
82 |
- if not libc_pkg_map: |
83 |
- return |
84 |
- |
85 |
- libc_pkgs = set(libc_pkg_map.values()) |
86 |
- earlier_libc_pkgs = set() |
87 |
- |
88 |
- for pkg in self._mergelist: |
89 |
- if not isinstance(pkg, Package): |
90 |
- # a satisfied blocker |
91 |
- continue |
92 |
- if pkg.installed: |
93 |
- continue |
94 |
- if pkg.root in implicit_libc_roots and \ |
95 |
- pkg.operation == 'merge': |
96 |
- if pkg in libc_pkgs: |
97 |
- earlier_libc_pkgs.add(pkg) |
98 |
- else: |
99 |
- my_libc = libc_pkg_map.get(pkg.root) |
100 |
- if my_libc is not None and \ |
101 |
- my_libc in earlier_libc_pkgs: |
102 |
- self._digraph.add(my_libc, pkg, |
103 |
- priority=DepPriority(buildtime=True)) |
104 |
- |
105 |
class _pkg_failure(portage.exception.PortageException): |
106 |
""" |
107 |
An instance of this class is raised by unmerge() when |
108 |
|
109 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
110 |
index 7db5ae3..73b81e1 100644 |
111 |
--- a/pym/_emerge/depgraph.py |
112 |
+++ b/pym/_emerge/depgraph.py |
113 |
@@ -4203,6 +4203,69 @@ class depgraph(object): |
114 |
retlist.reverse() |
115 |
return retlist |
116 |
|
117 |
+ def _implicit_libc_deps(self, mergelist, graph): |
118 |
+ """ |
119 |
+ Create implicit dependencies on libc, in order to ensure that libc |
120 |
+ is installed as early as possible (see bug #303567). If the merge |
121 |
+ list contains both a new-style virtual and an old-style PROVIDE |
122 |
+ virtual, the new-style virtual is used. |
123 |
+ """ |
124 |
+ implicit_libc_roots = set([self._frozen_config._running_root.root]) |
125 |
+ libc_set = InternalPackageSet([portage.const.LIBC_PACKAGE_ATOM]) |
126 |
+ norm_libc_pkgs = {} |
127 |
+ virt_libc_pkgs = {} |
128 |
+ for pkg in mergelist: |
129 |
+ if not isinstance(pkg, Package): |
130 |
+ # a satisfied blocker |
131 |
+ continue |
132 |
+ if pkg.installed: |
133 |
+ continue |
134 |
+ if pkg.root in implicit_libc_roots and \ |
135 |
+ pkg.operation == 'merge': |
136 |
+ if libc_set.findAtomForPackage(pkg): |
137 |
+ if pkg.category == 'virtual': |
138 |
+ d = virt_libc_pkgs |
139 |
+ else: |
140 |
+ d = norm_libc_pkgs |
141 |
+ if pkg.root in d: |
142 |
+ raise AssertionError( |
143 |
+ "found 2 libc matches: %s and %s" % \ |
144 |
+ (d[pkg.root], pkg)) |
145 |
+ d[pkg.root] = pkg |
146 |
+ |
147 |
+ # Prefer new-style virtuals over old-style PROVIDE virtuals. |
148 |
+ libc_pkg_map = norm_libc_pkgs.copy() |
149 |
+ libc_pkg_map.update(virt_libc_pkgs) |
150 |
+ |
151 |
+ # Only add a dep when the version changes. |
152 |
+ for libc_pkg in list(libc_pkg_map.values()): |
153 |
+ if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( |
154 |
+ libc_pkg.cpv): |
155 |
+ del libc_pkg_map[pkg.root] |
156 |
+ |
157 |
+ if not libc_pkg_map: |
158 |
+ return |
159 |
+ |
160 |
+ libc_pkgs = set(libc_pkg_map.values()) |
161 |
+ earlier_libc_pkgs = set() |
162 |
+ |
163 |
+ for pkg in mergelist: |
164 |
+ if not isinstance(pkg, Package): |
165 |
+ # a satisfied blocker |
166 |
+ continue |
167 |
+ if pkg.installed: |
168 |
+ continue |
169 |
+ if pkg.root in implicit_libc_roots and \ |
170 |
+ pkg.operation == 'merge': |
171 |
+ if pkg in libc_pkgs: |
172 |
+ earlier_libc_pkgs.add(pkg) |
173 |
+ else: |
174 |
+ my_libc = libc_pkg_map.get(pkg.root) |
175 |
+ if my_libc is not None and \ |
176 |
+ my_libc in earlier_libc_pkgs: |
177 |
+ graph.add(my_libc, pkg, |
178 |
+ priority=DepPriority(buildtime=True)) |
179 |
+ |
180 |
def schedulerGraph(self): |
181 |
""" |
182 |
The scheduler graph is identical to the normal one except that |
183 |
@@ -4220,6 +4283,8 @@ class depgraph(object): |
184 |
|
185 |
# NOTE: altlist initializes self._dynamic_config._scheduler_graph |
186 |
mergelist = self.altlist() |
187 |
+ self._implicit_libc_deps(mergelist, |
188 |
+ self._dynamic_config._scheduler_graph) |
189 |
self.break_refs(mergelist) |
190 |
self.break_refs(self._dynamic_config._scheduler_graph.order) |