get_counter_tick_core: use cpv_all
authorZac Medico <zmedico@gentoo.org>
Tue, 10 May 2011 05:05:40 +0000 (22:05 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 May 2011 05:19:53 +0000 (22:19 -0700)
It's more efficient to use cpv_all since cp_all calls cpv_all anyway,
and calls to cp_list induce additional stat calls.

pym/portage/dbapi/vartree.py

index a1299738963f34b6ba44c5e6a2a2c43270eaf569..a54adc07839d0dcddbfc150d3dce85fb6e874d90 100644 (file)
@@ -755,16 +755,14 @@ class vardbapi(dbapi):
                        # to newly installed packages having lower
                        # COUNTERs than the previous version in the
                        # same slot.
-                       cp_list = self.cp_list
                        max_counter = counter
-                       for cp in self.cp_all():
-                               for cpv in cp_list(cp):
-                                       try:
-                                               pkg_counter = int(self.aux_get(cpv, ["COUNTER"])[0])
-                                       except (KeyError, OverflowError, ValueError):
-                                               continue
-                                       if pkg_counter > max_counter:
-                                               max_counter = pkg_counter
+                       for cpv in self.cpv_all():
+                               try:
+                                       pkg_counter = int(self.aux_get(cpv, ["COUNTER"])[0])
+                               except (KeyError, OverflowError, ValueError):
+                                       continue
+                               if pkg_counter > max_counter:
+                                       max_counter = pkg_counter
 
                if counter < 0 and not new_vdb:
                        writemsg(_("!!! Initializing COUNTER to " \