From 945a9c4657f3b10e308d3da5da6747c133daba94 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 31 Oct 2009 14:19:12 +0100 Subject: [PATCH] [entropy.server/entropy.db] move server-side EntropyRepository status metadata generation to entropy.server for now (to avoid infinite loops) --- libraries/entropy/db.py | 13 ------------- libraries/entropy/server/interfaces/main.py | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/libraries/entropy/db.py b/libraries/entropy/db.py index da8ea1b3e..6b3b49601 100644 --- a/libraries/entropy/db.py +++ b/libraries/entropy/db.py @@ -574,7 +574,6 @@ class EntropyRepository: if not self.clientDatabase: self.server_repo = self.dbname[len(etpConst['serverdbid']):] - self._create_dbstatus_data() if not self.skipChecks: # no caching for non root and server connections @@ -631,18 +630,6 @@ class EntropyRepository: if not self.dbclosed: self.closeDB() - def _create_dbstatus_data(self): - """ - Server-side function that setups server status information - """ - from entropy.server.interfaces import Server - srv = Server() - taint_file = srv.get_local_database_taint_file(self.server_repo) - if os.path.isfile(taint_file): - dbs = ServerRepositoryStatus() - dbs.set_tainted(self.dbFile) - dbs.set_bumped(self.dbFile) - def closeDB(self): """ Close repository storage communication. diff --git a/libraries/entropy/server/interfaces/main.py b/libraries/entropy/server/interfaces/main.py index c141a4673..ed3c4c8b4 100644 --- a/libraries/entropy/server/interfaces/main.py +++ b/libraries/entropy/server/interfaces/main.py @@ -25,7 +25,7 @@ from entropy.i18n import _ from entropy.core.settings.base import SystemSettings from entropy.core.settings.plugins.skel import SystemSettingsPlugin from entropy.transceivers import FtpInterface -from entropy.db import EntropyRepository +from entropy.db import EntropyRepository, ServerRepositoryStatus from entropy.spm.plugins.factory import get_default_instance as get_spm, \ get_default_class as get_spm_class from entropy.qa import QAInterfacePlugin @@ -880,6 +880,18 @@ class Server(Singleton, TextInterface): dbc.initializeDatabase() return dbc + def __setup_server_repository_status(self, repo, local_dbfile): + """ + Setup server repository status information for newly created repos. + NOTE: This is a temp. workaround waiting for real pluggable + EntropyRepository interface calls. + """ + taint_file = self.get_local_database_taint_file(repo) + if os.path.isfile(taint_file): + dbs = ServerRepositoryStatus() + dbs.set_tainted(local_dbfile) + dbs.set_bumped(local_dbfile) + def open_server_repository( self, read_only = True, @@ -937,6 +949,8 @@ class Server(Singleton, TextInterface): useBranch = use_branch, lockRemote = lock_remote ) + # FIXME: remove this once we have a pluggable EntropyRepository class + self.__setup_server_repository_status(repo, local_dbfile) if not local_dbfile_exists: # better than having a completely broken db conn.readOnly = False