From 2fb3f559cb9782cb37cbfd3aab153532ce9ab011 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 8 Aug 2010 10:51:50 +0200 Subject: [PATCH] [entropy.client.interfaces.cache] when checksum() fails in _all_repositories_checksum() report to user --- libraries/entropy/client/interfaces/cache.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/entropy/client/interfaces/cache.py b/libraries/entropy/client/interfaces/cache.py index 2e79da0bd..aa11d5e3e 100644 --- a/libraries/entropy/client/interfaces/cache.py +++ b/libraries/entropy/client/interfaces/cache.py @@ -11,10 +11,13 @@ """ import os import shutil -from entropy.const import etpConst, const_setup_perms + +from entropy.i18n import _ +from entropy.output import purple +from entropy.const import etpConst, const_setup_perms, const_convert_to_unicode from entropy.exceptions import RepositoryError from entropy.cache import EntropyCacher -from entropy.db.exceptions import OperationalError +from entropy.db.exceptions import OperationalError, DatabaseError class CacheMixin: @@ -108,8 +111,15 @@ class CacheMixin: continue # repo not available try: sum_hashes += dbconn.checksum() - except OperationalError: - pass + except (OperationalError, DatabaseError): + txt = _("Repository") + " " + const_convert_to_unicode(repo) \ + + " " + _("is corrupted") + ". " + \ + _("Cannot calculate the checksum") + self.output( + purple(txt), + importance = 1, + level = "warning" + ) return sum_hashes def _get_available_packages_cache(self, myhash = None):