From 141241a1ec622091d4e7cd87e7337f145ada4775 Mon Sep 17 00:00:00 2001 From: lxnay Date: Fri, 16 Jan 2009 13:45:01 +0000 Subject: [PATCH] Entropy/SystemSettings: - before bugging the Entropy client database on scan() check if it's valid and initialized git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2909 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/entropy.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/libraries/entropy.py b/libraries/entropy.py index 80e58b967..fd66bfa70 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -10584,20 +10584,26 @@ class SystemSettings: # match installed packages of system_mask self.__settings['repos_system_mask_installed'] = [] self.__settings['repos_system_mask_installed_keys'] = {} - if self.Entropy.clientDbconn != None: - mc_cache = set() - m_list = self.__settings['repos_system_mask']+self.__settings['system_mask'] - for atom in m_list: - m_ids,m_r = self.Entropy.clientDbconn.atomMatch(atom, multiMatch = True) - if m_r != 0: continue - mykey = self.entropyTools.dep_getkey(atom) - if mykey not in self.__settings['repos_system_mask_installed_keys']: - self.__settings['repos_system_mask_installed_keys'][mykey] = set() - for xm in m_ids: - if xm in mc_cache: continue - mc_cache.add(xm) - self.__settings['repos_system_mask_installed'].append(xm) - self.__settings['repos_system_mask_installed_keys'][mykey].add(xm) + if isinstance(self.Entropy.clientDbconn,EntropyDatabaseInterface): + while 1: + try: + self.Entropy.clientDbconn.validateDatabase() + except exceptionTools.SystemDatabaseError: + break + mc_cache = set() + m_list = self.__settings['repos_system_mask']+self.__settings['system_mask'] + for atom in m_list: + m_ids,m_r = self.Entropy.clientDbconn.atomMatch(atom, multiMatch = True) + if m_r != 0: continue + mykey = self.entropyTools.dep_getkey(atom) + if mykey not in self.__settings['repos_system_mask_installed_keys']: + self.__settings['repos_system_mask_installed_keys'][mykey] = set() + for xm in m_ids: + if xm in mc_cache: continue + mc_cache.add(xm) + self.__settings['repos_system_mask_installed'].append(xm) + self.__settings['repos_system_mask_installed_keys'][mykey].add(xm) + break # Live package masking self.__settings.update(self.__persistent_settings)