* Make dblink._linkmap_rebuild() return early if preserve-libs is disabled
authorZac Medico <zmedico@gentoo.org>
Fri, 20 Aug 2010 16:41:21 +0000 (09:41 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 20 Aug 2010 16:41:21 +0000 (09:41 -0700)
  and the preserve-libs registry is empty.
* Make dblink._find_unused_preserved_libs() return early if the
  preserve-libs registry is empty.

pym/portage/dbapi/vartree.py

index 688f4c52a42bd31bcceb70867fa1434fa6f050f1..b72cba024f9fdc6f19d60682d6349afdf2e001d6 100644 (file)
@@ -2870,7 +2870,14 @@ class dblink(object):
                return False
 
        def _linkmap_rebuild(self, **kwargs):
-               if self._linkmap_broken:
+               """
+               Rebuild the self.linkmap if it's not broken due to missing
+               scanelf binary. Also, return early if preserve-libs is disabled
+               and the preserve-libs registry is empty.
+               """
+               if self._linkmap_broken or \
+                       ("preserve-libs" not in self.settings.features and \
+                       not self.vartree.dbapi.plib_registry.hasEntries()):
                        return
                try:
                        self.vartree.dbapi.linkmap.rebuild(**kwargs)
@@ -3048,7 +3055,8 @@ class dblink(object):
                Find preserved libraries that don't have any consumers left.
                """
 
-               if self._linkmap_broken:
+               if self._linkmap_broken or \
+                       not self.vartree.dbapi.plib_registry.hasEntries():
                        return {}
 
                # Since preserved libraries can be consumers of other preserved