From 5f5b6eda7f99cff39b2940b5093e581a74ded0bb Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Mon, 4 Feb 2008 20:01:33 +0000 Subject: [PATCH] fix indexing when running readonly git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1130 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/databaseTools.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index cf824d199..2ff3c645f 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -3451,26 +3451,38 @@ class etpDatabase(TextInterface): def createContentIndex(self): if self.dbname != "etpdb" and self.indexing: - self.checkReadOnly() + try: + self.checkReadOnly() + except exceptionTools.OperationNotPermitted: + return self.cursor.execute('CREATE INDEX IF NOT EXISTS contentindex ON content ( file )') self.commitChanges() def createBaseinfoIndex(self): if self.dbname != "etpdb" and self.indexing: - self.checkReadOnly() + try: + self.checkReadOnly() + except exceptionTools.OperationNotPermitted: + return self.cursor.execute('CREATE INDEX IF NOT EXISTS baseindex ON baseinfo ( idpackage, atom, name, version, slot, branch, revision )') self.commitChanges() def createDependenciesIndex(self): if self.dbname != "etpdb" and self.indexing: - self.checkReadOnly() + try: + self.checkReadOnly() + except exceptionTools.OperationNotPermitted: + return self.cursor.execute('CREATE INDEX IF NOT EXISTS dependenciesindex ON dependencies ( idpackage, iddependency )') self.cursor.execute('CREATE INDEX IF NOT EXISTS dependenciesreferenceindex ON dependenciesreference ( iddependency, dependency )') self.commitChanges() def createExtrainfoIndex(self): if self.dbname != "etpdb" and self.indexing: - self.checkReadOnly() + try: + self.checkReadOnly() + except exceptionTools.OperationNotPermitted: + return self.cursor.execute('CREATE INDEX IF NOT EXISTS extrainfoindex ON extrainfo ( idpackage, description, homepage, download, digest, datecreation, size )') self.commitChanges()