In depgraph._serialize_tasks(), when appropriate, execute uninstall tasks
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Feb 2009 21:33:58 +0000 (21:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Feb 2009 21:33:58 +0000 (21:33 -0000)
sooner. This solves some cases of bug #256870 since there is a smaller window
of time for some other failure to cause the uninstall to get discarded.

svn path=/main/trunk/; revision=12611

pym/_emerge/__init__.py

index 0ad8c1b02b57c25e317cd6e0b1b66aeb455b7882..e9280abac1153ff99e17e23493ed775ea67866c7 100644 (file)
@@ -6941,10 +6941,21 @@ class depgraph(object):
                                                # and we want to avoid executing a separate uninstall
                                                # task in that case.
                                                if len(nodes) > 1:
-                                                       non_uninstalls = [node for node in nodes \
-                                                               if node.operation != "uninstall"]
-                                                       if non_uninstalls:
-                                                               nodes = non_uninstalls
+                                                       good_uninstalls = []
+                                                       with_some_uninstalls_excluded = []
+                                                       for node in nodes:
+                                                               if node.operation == "uninstall":
+                                                                       slot_node = self.mydbapi[node.root
+                                                                               ].match_pkgs(node.slot_atom)
+                                                                       if slot_node and \
+                                                                               slot_node[0].operation == "merge":
+                                                                               continue
+                                                                       good_uninstalls.append(node)
+                                                               with_some_uninstalls_excluded.append(node)
+                                                       if good_uninstalls:
+                                                               nodes = good_uninstalls
+                                                       elif with_some_uninstalls_excluded:
+                                                               nodes = with_some_uninstalls_excluded
                                                        else:
                                                                nodes = nodes