diff options
Diffstat (limited to 'bitbake/lib/bb/persist_data.py')
-rw-r--r-- | bitbake/lib/bb/persist_data.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py index 76bff1665..9558e7128 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/lib/bb/persist_data.py @@ -47,10 +47,7 @@ class PersistData: Why sqlite? It handles all the locking issues for us. """ - def __init__(self, d, persistent_database_connection): - if "connection" in persistent_database_connection: - self.cursor = persistent_database_connection["connection"].cursor() - return + def __init__(self, d): self.cachedir = bb.data.getVar("PERSISTENT_DIR", d, True) or bb.data.getVar("CACHE", d, True) if self.cachedir in [None, '']: bb.msg.fatal(bb.msg.domain.PersistData, "Please set the 'PERSISTENT_DIR' or 'CACHE' variable.") @@ -62,9 +59,7 @@ class PersistData: self.cachefile = os.path.join(self.cachedir, "bb_persist_data.sqlite3") logger.debug(1, "Using '%s' as the persistent data cache", self.cachefile) - connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None) - persistent_database_connection["connection"] = connection - self.cursor = persistent_database_connection["connection"].cursor() + self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None) def addDomain(self, domain): """ @@ -127,7 +122,7 @@ class PersistData: count = 0 while True: try: - return self.cursor.execute(*query) + return self.connection.execute(*query) except sqlite3.OperationalError as e: if 'database is locked' in str(e) and count < 500: count = count + 1 |