[yum-commits] 2 commits - yum/rpmsack.py yum/updateinfo.py

James Antill james at osuosl.org
Wed May 8 18:01:45 UTC 2013


 yum/rpmsack.py    |   18 +++++++++++++++++-
 yum/updateinfo.py |   10 +++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit c18a317cb9b9e88d63f34fdf5bef109c9a982478
Author: James Antill <james at and.org>
Date:   Wed May 8 14:00:48 2013 -0400

    Don't load updateinfo when we don't have to.

diff --git a/yum/updateinfo.py b/yum/updateinfo.py
index 7d37a76..8c6e295 100644
--- a/yum/updateinfo.py
+++ b/yum/updateinfo.py
@@ -287,7 +287,6 @@ def remove_txmbrs(base, filters=None):
     '''
     Remove packages from the transaction, using the updateinfo data.
     '''
-    md_info = base.upinfo
 
     def ysp_del_pkg(tspkg):
         """ Deletes a package within a transaction. """
@@ -303,6 +302,7 @@ def remove_txmbrs(base, filters=None):
     if _no_options(opts):
         return 0, 0, 0
 
+    md_info = base.upinfo
     tot = 0
     cnt = 0
     used_map = _ysp_gen_used_map(opts)
@@ -372,8 +372,6 @@ def exclude_updates(base, filters=None):
     Exclude all packages to do with updates, using the updateinfo data.
     '''
     
-    md_info = base.upinfo
-
     def ysp_del_pkg(pkg, reason="updateinfo"):
         """ Deletes a package from all trees that yum knows about """
         base.verbose_logger.log(INFO_1,
@@ -388,6 +386,8 @@ def exclude_updates(base, filters=None):
     if _no_options(opts):
         return 0, 0
 
+    md_info = base.upinfo
+
     used_map = _ysp_gen_used_map(opts)
 
     # In theory the official API is:
@@ -429,8 +429,6 @@ def exclude_all(base, filters=None):
     Exclude all packages, using the updateinfo data.
     '''
     
-    md_info = base.upinfo
-
     def ysp_del_pkg(pkg, reason="updateinfo"):
         """ Deletes a package from all trees that yum knows about """
         base.verbose_logger.log(INFO_1,
@@ -445,6 +443,8 @@ def exclude_all(base, filters=None):
     if _no_options(opts):
         return 0, 0
 
+    md_info = base.upinfo
+
     used_map = _ysp_gen_used_map(opts)
 
     pkgs = base.pkgSack.returnPackages()
commit 7b684fc8482a89db708b252d02d1481bb66cf3d3
Author: James Antill <james at and.org>
Date:   Wed May 8 14:00:17 2013 -0400

    Don't slow path simple non-installed package names. (Eg. yum list zzuf).

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index c1f85e2..ff0666c 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -602,7 +602,23 @@ class RPMDBPackageSack(PackageSackBase):
                 # will pick up any loads :)
                 pkgs = self.searchNames([pat])
                 if not pkgs:
-                    break
+                    # We need to do a big search for 'pkg*'
+                    if misc.re_glob(pat):
+                        break
+                    # We need to do a big search for 'pkg-1.2'
+                    if '-' in pat:
+                        break
+                    # We need to do a big search for 'pkg.noarch'
+                    if '.' in pat:
+                        break
+                    #  We don't need to do a big search for '0:pkg', because
+                    # <en> isn't possible ... and envra matches the above.
+                    # if ':' in pat:
+                    #    break
+
+                    #  At this point we have just found something that doesn't
+                    # match, like "yum list zzuf" ... we don't want this to take
+                    # the much slower path.
                 ret.extend(pkgs)
             else:
                 return ret


More information about the Yum-commits mailing list