[yum-commits] Branch 'yum-3_2_X' - yummain.py

James Antill james at osuosl.org
Wed Mar 9 22:06:06 UTC 2011


 yummain.py |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit c358f26b8c54a28cc8cc99bac3aa6c90ec3a14d4
Author: James Antill <james at and.org>
Date:   Wed Mar 9 10:21:14 2011 -0500

    Catch PackageSackError from warn checks, BZ 634595.

diff --git a/yummain.py b/yummain.py
index 32c65aa..b4d90e4 100755
--- a/yummain.py
+++ b/yummain.py
@@ -76,6 +76,15 @@ def main(args):
             return 200
         return 0
 
+    def rpmdb_warn_checks():
+        try:
+            probs = base._rpmdb_warn_checks(out=verbose_logger.info, warn=False)
+        except YumBaseError, e:
+            # This is mainly for PackageSackError from rpmdb.
+            verbose_logger.info(_(" Yum checks failed: %s"), exception2msg(e))
+            probs = []
+        if not probs:
+            verbose_logger.info(_(" You could try running: rpm -Va --nofiles --nodigest"))
 
     logger = logging.getLogger("yum.main")
     verbose_logger = logging.getLogger("yum.verbose.main")
@@ -182,8 +191,7 @@ def main(args):
             logger.critical(prefix, msg.replace('\n', '\n' + prefix2nd))
         if not base.conf.skip_broken:
             verbose_logger.info(_(" You could try using --skip-broken to work around the problem"))
-        if not base._rpmdb_warn_checks(out=verbose_logger.info, warn=False):
-            verbose_logger.info(_(" You could try running: rpm -Va --nofiles --nodigest"))
+        warn_checks()
         if unlock(): return 200
         return 1
     elif result == 2:
@@ -215,8 +223,7 @@ def main(args):
         (result, resultmsgs) = return_code
         for msg in resultmsgs:
             logger.critical("%s", msg)
-        if not base._rpmdb_warn_checks(out=verbose_logger.info, warn=False):
-            verbose_logger.info(_(" You could try running: rpm -Va --nofiles --nodigest"))
+        warn_checks()
         return_code = result
         if base._ts_save_file:
             verbose_logger.info(_("Your transaction was saved, rerun it with: yum load-transaction %s") % base._ts_save_file)


More information about the Yum-commits mailing list