[yum-commits] Branch 'yum-3_2_X' - 6 commits - cli.py yum/__init__.py yum/misc.py

James Antill james at osuosl.org
Wed May 6 15:31:31 UTC 2009


 cli.py          |   20 --------------------
 yum/__init__.py |   19 +++++++++++++++++--
 yum/misc.py     |    7 +++++++
 3 files changed, 24 insertions(+), 22 deletions(-)

New commits:
commit e5dac27716e519fc1ee8766a341896ab466d0954
Author: James Antill <james at and.org>
Date:   Wed May 6 10:48:37 2009 -0400

    Don't alter the class GenericHolder, create an instance

diff --git a/yum/__init__.py b/yum/__init__.py
index a0c1217..e988236 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -965,7 +965,7 @@ class YumBase(depsolve.Depsolve):
         # list that there were errors preventing the ts from starting...
         
         # make resultobject - just a plain yumgenericholder object
-        resultobject = misc.GenericHolder
+        resultobject = misc.GenericHolder()
         resultobject.return_code = 0
         if errors is None:
             pass
commit 34a6c7bac98d7955fee839ba6843f5f1d245aaee
Author: James Antill <james at and.org>
Date:   Wed May 6 10:47:58 2009 -0400

    Can really get rid of _shrinklist() now

diff --git a/cli.py b/cli.py
index 42dad94..772fae5 100644
--- a/cli.py
+++ b/cli.py
@@ -731,26 +731,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         if self.conf.showdupesfromrepos:
             ypl.available += ypl.reinstall_available
 
-        # This is mostly leftover from when patterns didn't exist
-        # FIXME: However when returnPackages() has already been run, we
-        # don't process teh patterns args. ... we should fix that in
-        # returnPackages() etc.
-        def _shrinklist(lst, args):
-            if len(lst) > 0 and len(args) > 0:
-                self.verbose_logger.log(yum.logginglevels.DEBUG_1,
-                    _('Matching packages for package list to user args'))
-                exactmatch, matched, unmatched = parsePackages(lst, args)
-                return yum.misc.unique(matched + exactmatch)
-            else:
-                return lst
-        
-        ypl.updates = _shrinklist(ypl.updates, extcmds)
-        ypl.installed = _shrinklist(ypl.installed, extcmds)
-        ypl.available = _shrinklist(ypl.available, extcmds)
-        ypl.recent = _shrinklist(ypl.recent, extcmds)
-        ypl.extras = _shrinklist(ypl.extras, extcmds)
-        ypl.obsoletes = _shrinklist(ypl.obsoletes, extcmds)
-        
         if installed_available:
             ypl.hidden_available = ypl.available
             ypl.hidden_installed = ypl.installed
commit 8bad44a27301f5791af4b76eb38c8d8d91844eef
Author: James Antill <james at and.org>
Date:   Wed May 6 10:46:40 2009 -0400

    Do patterns processing on doPkgLists().obsoletes (and the tuples)

diff --git a/yum/__init__.py b/yum/__init__.py
index 0da8ce3..a0c1217 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1747,6 +1747,17 @@ class YumBase(depsolve.Depsolve):
                 for po in pkgs:
                     obsoletes.append(po)
                     obsoletesTuples.append((po, instpo))
+            if patterns:
+                exactmatch, matched, unmatched = \
+                   parsePackages(obsoletes, patterns, casematch=not ignore_case)
+                obsoletes = exactmatch + matched
+                matched_obsoletes = set(obsoletes)
+                nobsoletesTuples = []
+                for po, instpo in obsoletesTuples:
+                    if po not in matched_obsoletes:
+                        continue
+                    nobsoletesTuples.append((po, instpo))
+                obsoletesTuples = nobsoletesTuples
         
         # packages recently added to the repositories
         elif pkgnarrow == 'recent':
commit bdc434e2bef63693b9e6af848baeed7b7d3491e1
Author: James Antill <james at and.org>
Date:   Wed May 6 10:39:07 2009 -0400

    Do patterns processing on doPkgLists().updates

diff --git a/yum/__init__.py b/yum/__init__.py
index b2d9fe1..0da8ce3 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1684,6 +1684,10 @@ class YumBase(depsolve.Depsolve):
                 else:
                     self.verbose_logger.log(logginglevels.DEBUG_1,
                         _('Nothing matches %s.%s %s:%s-%s from update'), n,a,e,v,r)
+            if patterns:
+                exactmatch, matched, unmatched = \
+                   parsePackages(updates, patterns, casematch=not ignore_case)
+                updates = exactmatch + matched
 
         # installed only
         elif pkgnarrow == 'installed':
commit 61af2148bd59517c04d8a8394c043e906434ba6a
Author: James Antill <james at and.org>
Date:   Wed May 6 10:28:45 2009 -0400

    Allow callers to drop the .updates etc.

diff --git a/yum/__init__.py b/yum/__init__.py
index 4ab674d..b2d9fe1 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1617,7 +1617,7 @@ class YumBase(depsolve.Depsolve):
 
         if showdups is None:
             showdups = self.conf.showdupesfromrepos
-        ygh = misc.GenericHolder()
+        ygh = misc.GenericHolder(iter=pkgnarrow)
         
         installed = []
         available = []
commit de19117571c1ade2f8433e861d377e6b07c03aa6
Author: James Antill <james at and.org>
Date:   Wed May 6 10:06:17 2009 -0400

    Deal with iteration in GenericHolder, less weird error or make it useful

diff --git a/yum/misc.py b/yum/misc.py
index 6daf4f1..5ee6dcb 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -321,7 +321,14 @@ class GenericHolder:
        It exists purely to be able to do object.somestuff, object.someotherstuff
        or object[key] and pass object to another function that will 
        understand it"""
+
+    def __init__(self, iter=None):
+        self.__iter = iter
        
+    def __iter__(self):
+        if self.__iter is not None:
+            return iter(self[self.__iter])
+
     def __getitem__(self, item):
         if hasattr(self, item):
             return getattr(self, item)


More information about the Yum-commits mailing list