ignore consumers from the current package instance when checking if a preserved libra...
authorMarius Mauch <genone@gentoo.org>
Tue, 13 May 2008 20:05:27 +0000 (20:05 -0000)
committerMarius Mauch <genone@gentoo.org>
Tue, 13 May 2008 20:05:27 +0000 (20:05 -0000)
svn path=/main/trunk/; revision=10324

pym/portage/dbapi/vartree.py

index a150f4a007757f42494369cca3169cd34449db67..edd588e6a64a75f81497d39f41ddf16115b02013 100644 (file)
@@ -1261,7 +1261,7 @@ class dblink(object):
 
                        # regenerate reverse NEEDED map
                        self.vartree.dbapi.linkmap.rebuild()
-                       
+
                        # remove preserved libraries that don't have any consumers left
                        # FIXME: this code is quite ugly and can likely be optimized in several ways
                        plib_dict = plib_registry.getPreservedLibs()
@@ -1288,8 +1288,17 @@ class dblink(object):
                                        if not os.path.exists(f):
                                                continue
                                        unlink_list = []
-                                       if not self.vartree.dbapi.linkmap.findConsumers(f):
+                                       consumers = self.vartree.dbapi.linkmap.findConsumers(f)
+                                       if not consumers:
                                                unlink_list.append(f)
+                                       else:
+                                               keep=False
+                                               for c in consumers:
+                                                       if c not in self.getcontents():
+                                                               keep=True
+                                                               break
+                                               if not keep:
+                                                       unlink_list.append(f)
                                        for obj in unlink_list:
                                                try:
                                                        if os.path.islink(obj):