In dblink.unmerge(), update the CONTENTS entries when preserved libs are
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Oct 2008 03:37:55 +0000 (03:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Oct 2008 03:37:55 +0000 (03:37 -0000)
removed.

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

pym/portage/dbapi/vartree.py

index 5fc786dc5d9ac77178b1efea9b5474abb409e5f0..3bd214455819536b778baf3dfc6167636ba8f839 100644 (file)
@@ -1959,6 +1959,7 @@ class dblink(object):
                        lib_graph = digraph()
                        preserved_nodes = set()
                        preserved_paths = set()
+                       path_cpv_map = {}
                        path_node_map = {}
                        root = self.myroot
 
@@ -1974,8 +1975,9 @@ class dblink(object):
                                return node
 
                        linkmap = self.vartree.dbapi.linkmap
-                       for plibs in plib_dict.itervalues():
+                       for cpv, plibs in plib_dict.iteritems():
                                for f in plibs:
+                                       path_cpv_map[f] = cpv
                                        preserved_node = path_to_node(f)
                                        if not preserved_node.file_exists():
                                                continue
@@ -2019,6 +2021,7 @@ class dblink(object):
                                                lib_graph.remove_edge(preserved_node, consumer_node)
                                                break
 
+                       removed_for_cpv = {}
                        while not lib_graph.empty():
                                root_nodes = preserved_nodes.intersection(lib_graph.root_nodes())
                                if not root_nodes:
@@ -2029,6 +2032,12 @@ class dblink(object):
                                        unlink_list.update(node.alt_paths)
                                unlink_list = sorted(unlink_list)
                                for obj in unlink_list:
+                                       cpv = path_cpv_map[obj]
+                                       removed = removed_for_cpv.get(cpv)
+                                       if removed is None:
+                                               removed = set()
+                                               removed_for_cpv[cpv] = removed
+                                       removed.add(obj)
                                        obj = os.path.join(root, obj.lstrip(os.sep))
                                        if os.path.islink(obj):
                                                obj_type = "sym"
@@ -2043,6 +2052,17 @@ class dblink(object):
                                        else:
                                                showMessage("<<< !needed   %s %s\n" % (obj_type, obj))
 
+                       for cpv, removed in removed_for_cpv.iteritems():
+                               if not self.vartree.dbapi.cpv_exists(cpv):
+                                       for dblnk in others_in_slot:
+                                               if dblnk.mycpv == cpv:
+                                                       # This one just got merged so it doesn't
+                                                       # register with cpv_exists() yet.
+                                                       self.vartree.dbapi.removeFromContents(dblnk, removed)
+                                                       break
+                                       continue
+                               self.vartree.dbapi.removeFromContents(cpv, removed)
+
                        plib_registry.pruneNonExisting()
                                                
                finally: