unmerge: skip getvirtuals() if cat is not virtual
authorZac Medico <zmedico@gentoo.org>
Mon, 9 May 2011 06:08:43 +0000 (23:08 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 May 2011 05:09:11 +0000 (22:09 -0700)
This allows us to avoid triggering the old-style virtual code which
scans /var/db/pkg/*/*/PROVIDE.

pym/_emerge/unmerge.py

index 7e66ff9fb7500d6dff1ca8631655921f37d35f8d..6c0ef8dbc98f50e62defe2ad51ddd3b5e840833b 100644 (file)
@@ -67,8 +67,14 @@ def unmerge(root_config, myopts, unmerge_action,
 
                syslist = []
                for x in realsyslist:
-                       mycp = portage.dep_getkey(x)
-                       if mycp in settings.getvirtuals():
+                       mycp = x.cp
+                       # Since Gentoo stopped using old-style virtuals in
+                       # 2011, typically it's possible to avoid getvirtuals()
+                       # calls entirely. It will not be triggered here by
+                       # new-style virtuals since those are expanded to
+                       # non-virtual atoms above by expand_new_virt().
+                       if mycp.startswith("virtual/") and \
+                               mycp in settings.getvirtuals():
                                providers = []
                                for provider in settings.getvirtuals()[mycp]:
                                        if vartree.dbapi.match(provider):