diff --git a/client/equo.py b/client/equo.py index 9db1c2a8d..9695d51b5 100644 --- a/client/equo.py +++ b/client/equo.py @@ -34,6 +34,21 @@ try: except ImportError: def _(x): return x +dbapi2Exceptions = {} +dbapi2Exceptions['OperationalError'] = None +dbapi2_done = False +try: # try with sqlite3 from python 2.5 - default one + from sqlite3 import dbapi2 + dbapi2_done = True +except: # fallback to embedded pysqlite + try: + from pysqlite2 import dbapi2 + dbapi2_done = True + except: + pass +if dbapi2_done: + dbapi2Exceptions['OperationalError'] = dbapi2.OperationalError + myopts = [ None, (0," ~ "+etpConst['systemname']+" ~ ",1,'Entropy Package Manager - (C) %s' % (entropyTools.getYear(),) ), @@ -556,6 +571,11 @@ except exceptionTools.RepositoryError, e: except exceptionTools.PermissionDenied, e: print_error(darkred(" * ")+red(str(e)+". %s." % (_("Cannot continue"),) )) sys.exit(1) +except dbapi2Exceptions['OperationalError'], e: + if str(e).find("disk I/O error") == -1: + raise + print_error(darkred(" * ")+red(str(e)+". %s." % (_("Cannot continue. Your hard disk is probably faulty."),) )) + sys.exit(101) except SystemExit: pass except IOError, e: diff --git a/libraries/entropy.py b/libraries/entropy.py index 41fac4172..e2f7d4401 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -530,10 +530,14 @@ class EquoInterface(TextInterface): self.loadRepositoryConfigProtect(repositoryName, conn) if (repositoryName not in etpConst['client_treeupdatescalled']) and (self.entropyTools.is_user_in_entropy_group()) and (not repositoryName.endswith(etpConst['packagesext'])): + updated = False try: - conn.clientUpdatePackagesData(self.clientDbconn) + updated = conn.clientUpdatePackagesData(self.clientDbconn) except (dbapi2.OperationalError, dbapi2.DatabaseError): pass + if updated: + self.calculate_world_updates(use_cache = False) + self.calculate_available_packages(use_cache = False) return conn def loadRepositoryConfigProtect(self, repoid, dbconn): @@ -2284,14 +2288,14 @@ class EquoInterface(TextInterface): return None # this function searches all the not installed packages available in the repositories - def calculate_available_packages(self): + def calculate_available_packages(self, use_cache = True): # clear masking reasons maskingReasonsStorage.clear() c_hash = self.get_available_packages_chash(etpConst['branch']) - if self.xcache: + if use_cache and self.xcache: cached = self.get_available_packages_cache(myhash = c_hash) if cached != None: return cached @@ -2362,15 +2366,16 @@ class EquoInterface(TextInterface): str(hash(branch)) return str(hash(c_hash)) - def calculate_world_updates(self, empty_deps = False, branch = etpConst['branch']): + def calculate_world_updates(self, empty_deps = False, branch = etpConst['branch'], use_cache = True): # clear masking reasons maskingReasonsStorage.clear() db_digest = self.all_repositories_checksum() - cached = self.get_world_update_cache(empty_deps = empty_deps, branch = branch, db_digest = db_digest) - if cached != None: - return cached + if use_cache and self.xcache: + cached = self.get_world_update_cache(empty_deps = empty_deps, branch = branch, db_digest = db_digest) + if cached != None: + return cached update = [] remove = [] @@ -3073,7 +3078,7 @@ class EquoInterface(TextInterface): if not silent: self.updateProgress( - red(info_package+_("Extacting package metadata")+" ..."), + red(info_package+_("Extracting package metadata")+" ..."), importance = 0, type = "info", header = brown(" * "), @@ -19741,6 +19746,7 @@ class EntropyDatabaseInterface: # clear client cache clientDbconn.clearCache() + return True # this functions will filter either data from /usr/portage/profiles/updates/* # or repository database returning only the needed actions