[yum-commits] Branch 'yum-3_2_X' - cli.py rpmUtils/transaction.py yum/__init__.py

Panu Matilainen pmatilai at osuosl.org
Mon Feb 21 12:41:52 UTC 2011


 cli.py                  |    2 +-
 rpmUtils/transaction.py |   15 ++-------------
 yum/__init__.py         |   13 ++++++++++++-
 3 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 77edf20ba2deb1b2dad3085c07791f3da3be6d27
Author: Panu Matilainen <pmatilai at laiskiainen.org>
Date:   Mon Feb 21 14:38:25 2011 +0200

    Move yum-specific ts.check() wrapper back to YumBase private function
    
    This essentially reverts commit c54c9082d702b6ba45620ecf3ca5834b9b104543
    which inapproppriately dragged yum imports into rpmUtils space, causing
    recursive imports and breakage for other users.

diff --git a/cli.py b/cli.py
index 42759a3..0441c02 100644
--- a/cli.py
+++ b/cli.py
@@ -513,7 +513,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         rcd_st = time.time()
         self.verbose_logger.log(yum.logginglevels.INFO_2, 
              _('Running Transaction Check'))
-        msgs = self.ts.check()
+        msgs = self._run_rpm_check()
         if msgs:
             rpmlib_only = True
             for msg in msgs:
diff --git a/rpmUtils/transaction.py b/rpmUtils/transaction.py
index c5167d3..121ad5b 100644
--- a/rpmUtils/transaction.py
+++ b/rpmUtils/transaction.py
@@ -13,7 +13,6 @@
 
 import rpm
 import miscutils
-from yum.i18n import to_str
 
 read_ts = None
 ts = None
@@ -23,7 +22,8 @@ ts = None
 class TransactionWrapper:
     def __init__(self, root='/'):
         self.ts = rpm.TransactionSet(root)
-        self._methods = ['order',
+        self._methods = ['check',
+                         'order',
                          'addErase',
                          'addInstall',
                          'run',
@@ -49,17 +49,6 @@ class TransactionWrapper:
             self.ts = None
             self.open = False
 
-    def check(self):
-        results = []
-        self.ts.check()
-        for prob in self.ts.problems():
-            #  Newer rpm (4.8.0+) has problem objects, older have just strings.
-            #  Should probably move to using the new objects, when we can. For
-            # now just be compatible.
-            results.append(to_str(prob))
-
-        return results
-
     def dbMatch(self, *args, **kwds):
         if 'patterns' in kwds:
             patterns = kwds.pop('patterns')
diff --git a/yum/__init__.py b/yum/__init__.py
index 4d185ff..16aef1a 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4821,7 +4821,7 @@ class YumBase(depsolve.Depsolve):
         # This can be overloaded by a subclass.    
         self.verbose_logger.log(logginglevels.INFO_2, 
                  _('Running Transaction Check'))
-        msgs = self.ts.check()
+        msgs = self._run_rpm_check()
         if msgs:
             rpmlib_only = True
             for msg in msgs:
@@ -4874,6 +4874,17 @@ class YumBase(depsolve.Depsolve):
             cb.display = display
         self.runTransaction( cb=cb )
 
+    def _run_rpm_check(self):
+        results = []
+        self.ts.check()
+        for prob in self.ts.problems():
+            #  Newer rpm (4.8.0+) has problem objects, older have just strings.
+            #  Should probably move to using the new objects, when we can. For
+            # now just be compatible.
+            results.append(to_str(prob))
+
+        return results
+
     def add_enable_repo(self, repoid, baseurls=[], mirrorlist=None, **kwargs):
         """add and enable a repo with just a baseurl/mirrorlist and repoid
            requires repoid and at least one of baseurl and mirrorlist


More information about the Yum-commits mailing list