summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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