From 058d3119acdee8a6d3311b5acef474cae0dffd44 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Mon, 4 Feb 2008 11:35:52 +0000 Subject: [PATCH] - working implementation of the client side branch move function git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1121 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/databaseTools.py | 16 ++++++++++++++++ libraries/entropy.py | 5 +---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index 5cd21cf97..097667f8f 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -3414,6 +3414,7 @@ class etpDatabase(TextInterface): return True def createXpakTable(self): + self.checkReadOnly() self.cursor.execute('CREATE TABLE xpakdata ( idpackage INTEGER PRIMARY KEY, data BLOB );') self.commitChanges() @@ -3437,6 +3438,7 @@ class etpDatabase(TextInterface): pass def createCountersTable(self): + self.checkReadOnly() self.cursor.execute('DROP TABLE IF EXISTS counters;') self.cursor.execute('CREATE TABLE counters ( counter INTEGER PRIMARY KEY, idpackage INTEGER );') self.commitChanges() @@ -3448,27 +3450,32 @@ class etpDatabase(TextInterface): self.createExtrainfoIndex() def createContentIndex(self): + self.checkReadOnly() if self.dbname != "etpdb" and self.indexing: self.cursor.execute('CREATE INDEX IF NOT EXISTS contentindex ON content ( file )') self.commitChanges() def createBaseinfoIndex(self): + self.checkReadOnly() if self.dbname != "etpdb" and self.indexing: self.cursor.execute('CREATE INDEX IF NOT EXISTS baseindex ON baseinfo ( idpackage, atom, name, version, slot, branch, revision )') self.commitChanges() def createDependenciesIndex(self): + self.checkReadOnly() if self.dbname != "etpdb" and self.indexing: 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): + self.checkReadOnly() if self.dbname != "etpdb" and self.indexing: self.cursor.execute('CREATE INDEX IF NOT EXISTS extrainfoindex ON extrainfo ( idpackage, description, homepage, download, digest, datecreation, size )') self.commitChanges() def regenerateCountersTable(self, output = False): + self.checkReadOnly() self.createCountersTable() # assign a counter to an idpackage try: @@ -3502,6 +3509,7 @@ class etpDatabase(TextInterface): self.commitChanges() def clearTreeupdatesEntries(self, repository): + self.checkReadOnly() # treeupdates if not self.doesTableExist("treeupdates"): self.createTreeupdatesTable() @@ -3509,6 +3517,14 @@ class etpDatabase(TextInterface): self.cursor.execute("DELETE FROM treeupdates WHERE repository = (?)", (repository,)) self.commitChanges() + def resetTreeupdatesDigests(self): + self.checkReadOnly() + if not self.doesTableExist("treeupdates"): + self.createTreeupdatesTable() + else: + self.cursor.execute('UPDATE treeupdates SET digest = "-1"') + self.commitChanges() + # # FIXME: remove these when 1.0 will be out # diff --git a/libraries/entropy.py b/libraries/entropy.py index 0a1364b57..0b3ea7b0c 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -609,10 +609,7 @@ class EquoInterface(TextInterface): # update configuration self.entropyTools.writeNewBranch(branch) # reset treeupdatesactions - try: - self.clientDbconn.resetTreeupdatesDigests() - except: - pass + self.clientDbconn.resetTreeupdatesDigests() # clean cache self.purge_cache(showProgress = False) self.load_cache(showProgress = False)