1 |
Author: zmedico |
2 |
Date: 2008-05-02 19:58:13 +0000 (Fri, 02 May 2008) |
3 |
New Revision: 10100 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Use Package instance attributes to clean up and simplify |
9 |
depgraph.validate_blockers(). |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/_emerge/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/_emerge/__init__.py 2008-05-02 19:22:09 UTC (rev 10099) |
15 |
+++ main/trunk/pym/_emerge/__init__.py 2008-05-02 19:58:13 UTC (rev 10100) |
16 |
@@ -3120,15 +3120,6 @@ |
17 |
"--nodeps" in self.myopts: |
18 |
return True |
19 |
|
20 |
- modified_slots = {} |
21 |
- for myroot in self.trees: |
22 |
- myslots = {} |
23 |
- modified_slots[myroot] = myslots |
24 |
- final_db = self.mydbapi[myroot] |
25 |
- for pkg in self._slot_pkg_map[myroot].itervalues(): |
26 |
- if not (pkg.installed or pkg.onlydeps): |
27 |
- myslots[pkg.slot_atom] = pkg.cpv |
28 |
- |
29 |
#if "deep" in self.myparams: |
30 |
if True: |
31 |
# Pull in blockers from all installed packages that haven't already |
32 |
@@ -3211,7 +3202,9 @@ |
33 |
finally: |
34 |
portage.dep._dep_check_strict = True |
35 |
if not success: |
36 |
- if pkg.slot_atom in modified_slots[myroot]: |
37 |
+ replacement_pkg = final_db.match_pkgs(pkg.slot_atom) |
38 |
+ if replacement_pkg and \ |
39 |
+ replacement_pkg[0].operation == "merge": |
40 |
# This package is being replaced anyway, so |
41 |
# ignore invalid dependencies so as not to |
42 |
# annoy the user too much (otherwise they'd be |
43 |
@@ -3257,11 +3250,11 @@ |
44 |
|
45 |
blocked_initial = [] |
46 |
for atom in atoms: |
47 |
- blocked_initial.extend(initial_db.match(atom)) |
48 |
+ blocked_initial.extend(initial_db.match_pkgs(atom)) |
49 |
|
50 |
blocked_final = [] |
51 |
for atom in atoms: |
52 |
- blocked_final.extend(final_db.match(atom)) |
53 |
+ blocked_final.extend(final_db.match_pkgs(atom)) |
54 |
|
55 |
if not blocked_initial and not blocked_final: |
56 |
parent_pkgs = self._blocker_parents.parent_nodes(blocker) |
57 |
@@ -3271,27 +3264,11 @@ |
58 |
if not self._blocker_parents.child_nodes(pkg): |
59 |
self._blocker_parents.remove(pkg) |
60 |
continue |
61 |
- blocked_slots_initial = {} |
62 |
- blocked_slots_final = {} |
63 |
- for cpv in blocked_initial: |
64 |
- blocked_slots_initial[cpv] = \ |
65 |
- "%s:%s" % (portage.dep_getkey(cpv), |
66 |
- initial_db.aux_get(cpv, ["SLOT"])[0]) |
67 |
- for cpv in blocked_final: |
68 |
- blocked_slots_final[cpv] = \ |
69 |
- "%s:%s" % (portage.dep_getkey(cpv), |
70 |
- final_db.aux_get(cpv, ["SLOT"])[0]) |
71 |
for parent in self._blocker_parents.parent_nodes(blocker): |
72 |
- ptype, proot, pcpv, pstatus = parent |
73 |
- pdbapi = self.trees[proot][self.pkg_tree_map[ptype]].dbapi |
74 |
- pslot = pdbapi.aux_get(pcpv, ["SLOT"])[0] |
75 |
- pslot_atom = "%s:%s" % (portage.dep_getkey(pcpv), pslot) |
76 |
- parent_static = pslot_atom not in modified_slots[proot] |
77 |
unresolved_blocks = False |
78 |
depends_on_order = set() |
79 |
- for cpv in blocked_initial: |
80 |
- slot_atom = blocked_slots_initial[cpv] |
81 |
- if slot_atom == pslot_atom: |
82 |
+ for pkg in blocked_initial: |
83 |
+ if pkg.slot_atom == parent.slot_atom: |
84 |
# TODO: Support blocks within slots in cases where it |
85 |
# might make sense. For example, a new version might |
86 |
# require that the old version be uninstalled at build |
87 |
@@ -3303,39 +3280,31 @@ |
88 |
# is already done and this would be likely to |
89 |
# confuse users if displayed like a normal blocker. |
90 |
continue |
91 |
- if pstatus == "merge": |
92 |
+ if parent.operation == "merge": |
93 |
# Maybe the blocked package can be replaced or simply |
94 |
# unmerged to resolve this block. |
95 |
- inst_pkg = self._pkg_cache[ |
96 |
- ("installed", myroot, cpv, "nomerge")] |
97 |
- depends_on_order.add((inst_pkg, parent)) |
98 |
+ depends_on_order.add((pkg, parent)) |
99 |
continue |
100 |
# None of the above blocker resolutions techniques apply, |
101 |
# so apparently this one is unresolvable. |
102 |
unresolved_blocks = True |
103 |
- for cpv in blocked_final: |
104 |
- slot_atom = blocked_slots_final[cpv] |
105 |
- if slot_atom == pslot_atom: |
106 |
+ for pkg in blocked_final: |
107 |
+ if pkg.slot_atom == parent.slot_atom: |
108 |
# TODO: Support blocks within slots. |
109 |
continue |
110 |
- if parent_static and \ |
111 |
- slot_atom not in modified_slots[myroot]: |
112 |
+ if parent.operation == "nomerge" and \ |
113 |
+ pkg.operation == "nomerge": |
114 |
# This blocker will be handled the next time that a |
115 |
# merge of either package is triggered. |
116 |
continue |
117 |
|
118 |
# Maybe the blocking package can be |
119 |
# unmerged to resolve this block. |
120 |
- try: |
121 |
- blocked_pkg = self._slot_pkg_map[myroot][slot_atom] |
122 |
- except KeyError: |
123 |
- blocked_pkg = self._pkg_cache[ |
124 |
- ("installed", myroot, cpv, "nomerge")] |
125 |
- if pstatus == "merge" and blocked_pkg.installed: |
126 |
- depends_on_order.add((blocked_pkg, parent)) |
127 |
+ if parent.operation == "merge" and pkg.installed: |
128 |
+ depends_on_order.add((pkg, parent)) |
129 |
continue |
130 |
- elif pstatus == "nomerge": |
131 |
- depends_on_order.add((parent, blocked_pkg)) |
132 |
+ elif parent.operation == "nomerge": |
133 |
+ depends_on_order.add((parent, pkg)) |
134 |
continue |
135 |
# None of the above blocker resolutions techniques apply, |
136 |
# so apparently this one is unresolvable. |
137 |
|
138 |
-- |
139 |
gentoo-commits@l.g.o mailing list |