[Yum-devel] [PATCH] Add a header to the automatic yum check output to make it more obvious.

James Antill james at and.org
Wed Apr 14 04:42:03 UTC 2010


---
 yum/__init__.py |    8 +++++++-
 yumcommands.py  |    3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index e45d70a..35da86e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1139,9 +1139,14 @@ class YumBase(depsolve.Depsolve):
             toRemove.add(dep)
             self._getDepsToRemove(dep, deptree, toRemove)
 
-    def _rpmdb_warn_checks(self, out=None, warn=True, chkcmd='all'):
+    def _rpmdb_warn_checks(self, out=None, warn=True, chkcmd='all',header=None):
         if out is None:
             out = self.logger.warning
+        if header is None:
+            # FIXME: _N()
+            msg = _("** Found %d pre-existing rpmdb problem(s),"
+                    " 'yum check' output follows:")
+            header = lambda problems: not problems or out(msg % problems)
         if warn:
             out(_('Warning: RPMDB altered outside of yum.'))
 
@@ -1156,6 +1161,7 @@ class YumBase(depsolve.Depsolve):
             iopkgs = set(self.conf.installonlypkgs)
             probs.extend(self.rpmdb.check_duplicates(iopkgs))
 
+        header(len(probs))
         for prob in sorted(probs):
             out(prob)
 
diff --git a/yumcommands.py b/yumcommands.py
index 9bc06ad..89c562c 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1381,7 +1381,8 @@ class CheckRpmdbCommand(YumCommand):
             print x
 
         rc = 0
-        if base._rpmdb_warn_checks(_out, False, chkcmd):
+        if base._rpmdb_warn_checks(out=_out, warn=False, chkcmd=chkcmd,
+                                   header=lambda x: None):
             rc = 1
         return rc, ['%s %s' % (basecmd, chkcmd)]
 
-- 
1.6.6.1



More information about the Yum-devel mailing list