summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-08-04 22:12:42 +0000
committerRichard Purdie <richard@openedhand.com>2007-08-04 22:12:42 +0000
commit71068e7cee684b45fc6fdfe756fa54b7462e735f (patch)
tree7380a2b08f3dcfd9ff5a5104c01710e6a86c254c /bitbake/lib/bb
parent9858ddb9c53135a94c1e29f84bc98d8ade1b738c (diff)
downloadopenembedded-core-71068e7cee684b45fc6fdfe756fa54b7462e735f.tar.gz
openembedded-core-71068e7cee684b45fc6fdfe756fa54b7462e735f.tar.bz2
openembedded-core-71068e7cee684b45fc6fdfe756fa54b7462e735f.zip
bitbake persist_data: Add own retry logic
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2363 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/persist_data.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index 6fc96c6ebd..8120135511 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -50,7 +50,7 @@ class PersistData:
self.cachefile = os.path.join(self.cachedir,"bb_persist_data.sqlite3")
bb.msg.debug(1, bb.msg.domain.PersistData, "Using '%s' as the persistent data cache" % self.cachefile)
- self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level="IMMEDIATE")
+ self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None)
def addDomain(self, domain):
"""
@@ -82,14 +82,25 @@ class PersistData:
for row in data:
rows = rows + 1
if rows:
- self.connection.execute("UPDATE %s SET value=? WHERE key=?;" % domain, [value, key])
+ self._execute("UPDATE %s SET value=? WHERE key=?;" % domain, [value, key])
else:
- self.connection.execute("INSERT into %s(key, value) values (?, ?);" % domain, [key, value])
- self.connection.commit()
+ self._execute("INSERT into %s(key, value) values (?, ?);" % domain, [key, value])
def delValue(self, domain, key):
"""
Deletes a key/value pair
"""
- self.connection.execute("DELETE from %s where key=?;" % domain, [key])
+ self._execute("DELETE from %s where key=?;" % domain, [key])
+
+ def _execute(self, *query):
+ while True:
+ try:
+ self.connection.execute(query)
+ return
+ except pysqlite2.dbapi2.OperationalError, e:
+ if 'database is locked' in str(e):
+ continue
+ raise
+
+