diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-10-02 03:58:49 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-10-02 03:58:49 +0000 |
commit | 0766aed141800ca2bdb4f764aace49d8e63e8f0d (patch) | |
tree | 138688ad901fb62d2a47750c0ce9cd3ad3a32104 | |
parent | b7ea99c8efbfaa72b46ee929b24b1e418bddde27 (diff) | |
download | portage-0766aed141800ca2bdb4f764aace49d8e63e8f0d.tar.gz portage-0766aed141800ca2bdb4f764aace49d8e63e8f0d.tar.bz2 portage-0766aed141800ca2bdb4f764aace49d8e63e8f0d.zip |
Optimize display_preserved_libs() by using a single getFileOwnerMap() to look
up all the files.
svn path=/main/trunk/; revision=11608
-rw-r--r-- | pym/_emerge/__init__.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 366568c51..0e7f241fd 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -10907,13 +10907,27 @@ def display_preserved_libs(vardbapi): print colorize("WARN", "!!!") + " existing preserved libs:" plibdata = vardbapi.plib_registry.getPreservedLibs() linkmap = vardbapi.linkmap + + consumer_map = {} + search_for_owners = set() for cpv in plibdata: - print colorize("WARN", ">>>") + " package: %s" % cpv for f in plibdata[cpv]: - print colorize("WARN", " * ") + " - %s" % f + if f in consumer_map: + continue consumers = list(linkmap.findConsumers(f)) consumers.sort() - owners = vardbapi._owners.getFileOwnerMap(consumers[:MAX_DISPLAY+2]) + consumer_map[f] = consumers + search_for_owners.update(consumers[:MAX_DISPLAY+1]) + + all_owners = vardbapi._owners.getFileOwnerMap(search_for_owners) + + for cpv in plibdata: + print colorize("WARN", ">>>") + " package: %s" % cpv + for f in plibdata[cpv]: + print colorize("WARN", " * ") + " - %s" % f + consumers = consumer_map[f] + owners = dict((c, all_owners[c]) + for c in consumers[:MAX_DISPLAY+1]) for c in consumers[:MAX_DISPLAY]: print colorize("WARN", " * ") + " used by %s (%s)" % (c, ", ".join([x.mycpv for x in owners[c]])) if len(consumers) == MAX_DISPLAY + 1: |