summaryrefslogtreecommitdiffstats
path: root/bitbake
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
parent9858ddb9c53135a94c1e29f84bc98d8ade1b738c (diff)
downloadpoky-71068e7cee684b45fc6fdfe756fa54b7462e735f.tar.gz
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')
-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:
50 self.cachefile = os.path.join(self.cachedir,"bb_persist_data.sqlite3") 50 self.cachefile = os.path.join(self.cachedir,"bb_persist_data.sqlite3")
51 bb.msg.debug(1, bb.msg.domain.PersistData, "Using '%s' as the persistent data cache" % self.cachefile) 51 bb.msg.debug(1, bb.msg.domain.PersistData, "Using '%s' as the persistent data cache" % self.cachefile)
52 52
53 self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level="IMMEDIATE") 53 self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None)
54 54
55 def addDomain(self, domain): 55 def addDomain(self, domain):
56 """ 56 """
@@ -82,14 +82,25 @@ class PersistData:
82 for row in data: 82 for row in data:
83 rows = rows + 1 83 rows = rows + 1
84 if rows: 84 if rows:
85 self.connection.execute("UPDATE %s SET value=? WHERE key=?;" % domain, [value, key]) 85 self._execute("UPDATE %s SET value=? WHERE key=?;" % domain, [value, key])
86 else: 86 else:
87 self.connection.execute("INSERT into %s(key, value) values (?, ?);" % domain, [key, value]) 87 self._execute("INSERT into %s(key, value) values (?, ?);" % domain, [key, value])
88 self.connection.commit()
89 88
90 def delValue(self, domain, key): 89 def delValue(self, domain, key):
91 """ 90 """
92 Deletes a key/value pair 91 Deletes a key/value pair
93 """ 92 """
94 self.connection.execute("DELETE from %s where key=?;" % domain, [key]) 93 self._execute("DELETE from %s where key=?;" % domain, [key])
94
95 def _execute(self, *query):
96 while True:
97 try:
98 self.connection.execute(query)
99 return
100 except pysqlite2.dbapi2.OperationalError, e:
101 if 'database is locked' in str(e):
102 continue
103 raise
104
105
95 106