1 |
Author: zmedico |
2 |
Date: 2008-04-14 01:32:24 +0000 (Mon, 14 Apr 2008) |
3 |
New Revision: 9888 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
Log: |
8 |
Split out a depgraph._add_dep() method. (trunk r9884) |
9 |
|
10 |
|
11 |
Modified: main/branches/2.1.2/bin/emerge |
12 |
=================================================================== |
13 |
--- main/branches/2.1.2/bin/emerge 2008-04-14 01:27:41 UTC (rev 9887) |
14 |
+++ main/branches/2.1.2/bin/emerge 2008-04-14 01:32:24 UTC (rev 9888) |
15 |
@@ -1915,12 +1915,6 @@ |
16 |
return None |
17 |
|
18 |
def _create_graph(self, allow_unsatisfied=False): |
19 |
- debug = "--debug" in self.myopts |
20 |
- buildpkgonly = "--buildpkgonly" in self.myopts |
21 |
- nodeps = "--nodeps" in self.myopts |
22 |
- empty = "empty" in self.myparams |
23 |
- deep = "deep" in self.myparams |
24 |
- consistent = "consistent" in self.myparams |
25 |
dep_stack = self._dep_stack |
26 |
while dep_stack: |
27 |
dep = dep_stack.pop() |
28 |
@@ -1928,56 +1922,67 @@ |
29 |
if not self._add_pkg_deps(dep): |
30 |
return 0 |
31 |
continue |
32 |
- update = "--update" in self.myopts and dep.depth <= 1 |
33 |
- if dep.blocker: |
34 |
- if not buildpkgonly and \ |
35 |
- not nodeps and \ |
36 |
- dep.parent not in self._slot_collision_nodes: |
37 |
- if dep.parent.onlydeps: |
38 |
- # It's safe to ignore blockers if the |
39 |
- # parent is an --onlydeps node. |
40 |
- continue |
41 |
- # The blocker applies to the root where |
42 |
- # the parent is or will be installed. |
43 |
- self.blocker_parents.setdefault( |
44 |
- ("blocks", dep.parent.root, dep.atom), set()).add( |
45 |
- dep.parent) |
46 |
- continue |
47 |
- dep_pkg, existing_node = self._select_package(dep.root, dep.atom, |
48 |
- onlydeps=dep.onlydeps) |
49 |
- if not dep_pkg: |
50 |
- if allow_unsatisfied: |
51 |
- self._unsatisfied_deps.append(dep) |
52 |
- continue |
53 |
- self._unsatisfied_deps_for_display.append( |
54 |
- ((dep.root, dep.atom), {"myparent":dep.parent})) |
55 |
+ if not self._add_dep(dep, allow_unsatisfied=allow_unsatisfied): |
56 |
return 0 |
57 |
- # In some cases, dep_check will return deps that shouldn't |
58 |
- # be proccessed any further, so they are identified and |
59 |
- # discarded here. Try to discard as few as possible since |
60 |
- # discarded dependencies reduce the amount of information |
61 |
- # available for optimization of merge order. |
62 |
- if dep.priority.satisfied and \ |
63 |
- not (existing_node or empty or deep or update): |
64 |
- myarg = None |
65 |
- if dep.root == self.target_root: |
66 |
- try: |
67 |
- myarg = self._iter_atoms_for_pkg(dep_pkg).next() |
68 |
- except StopIteration: |
69 |
- pass |
70 |
- except portage_exception.InvalidDependString: |
71 |
- if not dep_pkg.installed: |
72 |
- # This shouldn't happen since the package |
73 |
- # should have been masked. |
74 |
- raise |
75 |
- if not myarg: |
76 |
- if consistent: |
77 |
- self._ignored_deps.append(dep) |
78 |
- continue |
79 |
+ return 1 |
80 |
|
81 |
- if not self._add_pkg(dep_pkg, dep.parent, |
82 |
- priority=dep.priority, depth=dep.depth): |
83 |
- return 0 |
84 |
+ def _add_dep(self, dep, allow_unsatisfied=False): |
85 |
+ debug = "--debug" in self.myopts |
86 |
+ buildpkgonly = "--buildpkgonly" in self.myopts |
87 |
+ nodeps = "--nodeps" in self.myopts |
88 |
+ empty = "empty" in self.myparams |
89 |
+ deep = "deep" in self.myparams |
90 |
+ consistent = "consistent" in self.myparams |
91 |
+ update = "--update" in self.myopts and dep.depth <= 1 |
92 |
+ if dep.blocker: |
93 |
+ if not buildpkgonly and \ |
94 |
+ not nodeps and \ |
95 |
+ dep.parent not in self._slot_collision_nodes: |
96 |
+ if dep.parent.onlydeps: |
97 |
+ # It's safe to ignore blockers if the |
98 |
+ # parent is an --onlydeps node. |
99 |
+ return 1 |
100 |
+ # The blocker applies to the root where |
101 |
+ # the parent is or will be installed. |
102 |
+ self.blocker_parents.setdefault( |
103 |
+ ("blocks", dep.parent.root, dep.atom), set()).add( |
104 |
+ dep.parent) |
105 |
+ return 1 |
106 |
+ dep_pkg, existing_node = self._select_package(dep.root, dep.atom, |
107 |
+ onlydeps=dep.onlydeps) |
108 |
+ if not dep_pkg: |
109 |
+ if allow_unsatisfied: |
110 |
+ self._unsatisfied_deps.append(dep) |
111 |
+ return 1 |
112 |
+ self._unsatisfied_deps_for_display.append( |
113 |
+ ((dep.root, dep.atom), {"myparent":dep.parent})) |
114 |
+ return 0 |
115 |
+ # In some cases, dep_check will return deps that shouldn't |
116 |
+ # be proccessed any further, so they are identified and |
117 |
+ # discarded here. Try to discard as few as possible since |
118 |
+ # discarded dependencies reduce the amount of information |
119 |
+ # available for optimization of merge order. |
120 |
+ if dep.priority.satisfied and \ |
121 |
+ not (existing_node or empty or deep or update): |
122 |
+ myarg = None |
123 |
+ if dep.root == self.target_root: |
124 |
+ try: |
125 |
+ myarg = self._iter_atoms_for_pkg(dep_pkg).next() |
126 |
+ except StopIteration: |
127 |
+ pass |
128 |
+ except portage_exception.InvalidDependString: |
129 |
+ if not dep_pkg.installed: |
130 |
+ # This shouldn't happen since the package |
131 |
+ # should have been masked. |
132 |
+ raise |
133 |
+ if not myarg: |
134 |
+ if consistent: |
135 |
+ self._ignored_deps.append(dep) |
136 |
+ return 1 |
137 |
+ |
138 |
+ if not self._add_pkg(dep_pkg, dep.parent, |
139 |
+ priority=dep.priority, depth=dep.depth): |
140 |
+ return 0 |
141 |
return 1 |
142 |
|
143 |
def _add_pkg(self, pkg, myparent, priority=None, depth=0): |
144 |
|
145 |
-- |
146 |
gentoo-commits@l.g.o mailing list |