[Yum-devel] [PATCH] Add a pkgdict argument to packages.parsePackages()

Zdeněk Pavlas zpavlas at redhat.com
Mon Jun 11 14:20:25 UTC 2012


From: Dan Mach <dmach at redhat.com>

Allow explicit dict instead of calling (slow) buildPkgRefDict().
To be used by pungi.
---
 yum/packages.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/yum/packages.py b/yum/packages.py
index da31971..f67169f 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -106,14 +106,16 @@ def buildPkgRefDict(pkgs, casematch=True):
     return pkgdict
        
 def parsePackages(pkgs, usercommands, casematch=0,
-                  unique='repo-epoch-name-version-release-arch'):
+                  unique='repo-epoch-name-version-release-arch',
+                  pkgdict=None):
     """matches up the user request versus a pkg list:
        for installs/updates available pkgs should be the 'others list' 
        for removes it should be the installed list of pkgs
        takes an optional casematch option to determine if case should be matched
        exactly. Defaults to not matching."""
 
-    pkgdict = buildPkgRefDict(pkgs, bool(casematch))
+    if pkgdict is None:
+        pkgdict = buildPkgRefDict(pkgs, bool(casematch))
     exactmatch = []
     matched = []
     unmatched = []
-- 
1.7.4.4



More information about the Yum-devel mailing list