From 60b4bff0141ff0fbeba2c9fedffc4e86c204ee27 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 23 Nov 2009 18:21:06 +0100 Subject: [PATCH] [entropy.client/entropy.server] remove treeupdates stuff from entropy.const --- libraries/entropy/client/interfaces/client.py | 3 ++- libraries/entropy/client/interfaces/methods.py | 2 +- libraries/entropy/const.py | 2 -- libraries/entropy/server/interfaces/main.py | 15 ++++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libraries/entropy/client/interfaces/client.py b/libraries/entropy/client/interfaces/client.py index 708314392..96f8d42c5 100644 --- a/libraries/entropy/client/interfaces/client.py +++ b/libraries/entropy/client/interfaces/client.py @@ -557,6 +557,7 @@ class Client(Singleton, TextInterface, LoadersMixin, CacheMixin, CalculatorsMixi load_ugc = True, url_fetcher = None, multiple_url_fetcher = None): + self._treeupdates_repos = set() self._can_run_sys_set_hooks = False const_debug_write(__name__, "debug enabled") self.sys_settings_client_plugin_id = \ @@ -723,7 +724,7 @@ class Client(Singleton, TextInterface, LoadersMixin, CacheMixin, CalculatorsMixi # nothing to do if client db is not availabe return False - etpConst['client_treeupdatescalled'].add(repository_identifier) + self._treeupdates_repos.add(repository_identifier) doRescan = False shell_rescan = os.getenv("ETP_TREEUPDATES_RESCAN") diff --git a/libraries/entropy/client/interfaces/methods.py b/libraries/entropy/client/interfaces/methods.py index 6aa8e5d0a..f15a8f732 100644 --- a/libraries/entropy/client/interfaces/methods.py +++ b/libraries/entropy/client/interfaces/methods.py @@ -191,7 +191,7 @@ class RepositoryMixin: ) self._add_plugin_to_client_repository(conn) - if (repoid not in etpConst['client_treeupdatescalled']) and \ + if (repoid not in self._treeupdates_repos) and \ (self.entropyTools.is_root()) and \ (not repoid.endswith(etpConst['packagesext'])): # only as root due to Portage diff --git a/libraries/entropy/const.py b/libraries/entropy/const.py index 51c09da12..e0567452e 100644 --- a/libraries/entropy/const.py +++ b/libraries/entropy/const.py @@ -504,8 +504,6 @@ def const_default_settings(rootdir): 'default_nice': 0, # Default download socket timeout for Entropy Client transceivers 'default_download_timeout': 20, - 'server_treeupdatescalled': set(), - 'client_treeupdatescalled': set(), 'spm': { '(r)depend_id': 0, 'pdepend_id': 1, diff --git a/libraries/entropy/server/interfaces/main.py b/libraries/entropy/server/interfaces/main.py index a4ecb6a69..683cb94a4 100644 --- a/libraries/entropy/server/interfaces/main.py +++ b/libraries/entropy/server/interfaces/main.py @@ -649,6 +649,7 @@ class ServerQAInterfacePlugin(QAInterfacePlugin): class Server(Singleton, TextInterface): _memory_db_instances = {} + _treeupdates_repos = set() def init_singleton(self, default_repository = None, save_repository = False, community_repo = False, fake_default_repo = False, @@ -1290,7 +1291,7 @@ class Server(Singleton, TextInterface): # verify if we need to update the database to sync # with portage updates, we just ignore being readonly in the case - if (repo not in etpConst['server_treeupdatescalled']) and \ + if (repo not in Server._treeupdates_repos) and \ (not just_reading): # sometimes, when filling a new server db # we need to avoid tree updates @@ -1352,18 +1353,18 @@ class Server(Singleton, TextInterface): if repo is None: repo = self.default_repository - etpConst['server_treeupdatescalled'].add(repo) + Server._treeupdates_repos.add(repo) repo_updates_file = self.get_local_database_treeupdates_file(repo) - doRescan = False + do_rescan = False stored_digest = repo_db.retrieveRepositoryUpdatesDigest(repo) if stored_digest == -1: - doRescan = True + do_rescan = True - # check portage files for changes if doRescan is still false + # check portage files for changes if do_rescan is still false portage_dirs_digest = "0" - if not doRescan: + if not do_rescan: if repo in self.repository_treeupdate_digests: portage_dirs_digest = self.repository_treeupdate_digests.get( @@ -1389,7 +1390,7 @@ class Server(Singleton, TextInterface): self.repository_treeupdate_digests[repo] = \ portage_dirs_digest - if doRescan or (str(stored_digest) != str(portage_dirs_digest)): + if do_rescan or (str(stored_digest) != str(portage_dirs_digest)): # force parameters repo_db.readOnly = False