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 76bff16658..9558e71283 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/lib/bb/persist_data.py | |||
@@ -47,10 +47,7 @@ class PersistData: | |||
47 | 47 | ||
48 | Why sqlite? It handles all the locking issues for us. | 48 | Why sqlite? It handles all the locking issues for us. |
49 | """ | 49 | """ |
50 | def __init__(self, d, persistent_database_connection): | 50 | def __init__(self, d): |
51 | if "connection" in persistent_database_connection: | ||
52 | self.cursor = persistent_database_connection["connection"].cursor() | ||
53 | return | ||
54 | self.cachedir = bb.data.getVar("PERSISTENT_DIR", d, True) or bb.data.getVar("CACHE", d, True) | 51 | self.cachedir = bb.data.getVar("PERSISTENT_DIR", d, True) or bb.data.getVar("CACHE", d, True) |
55 | if self.cachedir in [None, '']: | 52 | if self.cachedir in [None, '']: |
56 | bb.msg.fatal(bb.msg.domain.PersistData, "Please set the 'PERSISTENT_DIR' or 'CACHE' variable.") | 53 | bb.msg.fatal(bb.msg.domain.PersistData, "Please set the 'PERSISTENT_DIR' or 'CACHE' variable.") |
@@ -62,9 +59,7 @@ class PersistData: | |||
62 | self.cachefile = os.path.join(self.cachedir, "bb_persist_data.sqlite3") | 59 | self.cachefile = os.path.join(self.cachedir, "bb_persist_data.sqlite3") |
63 | logger.debug(1, "Using '%s' as the persistent data cache", self.cachefile) | 60 | logger.debug(1, "Using '%s' as the persistent data cache", self.cachefile) |
64 | 61 | ||
65 | connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None) | 62 | self.connection = sqlite3.connect(self.cachefile, timeout=5, isolation_level=None) |
66 | persistent_database_connection["connection"] = connection | ||
67 | self.cursor = persistent_database_connection["connection"].cursor() | ||
68 | 63 | ||
69 | def addDomain(self, domain): | 64 | def addDomain(self, domain): |
70 | """ | 65 | """ |
@@ -127,7 +122,7 @@ class PersistData: | |||
127 | count = 0 | 122 | count = 0 |
128 | while True: | 123 | while True: |
129 | try: | 124 | try: |
130 | return self.cursor.execute(*query) | 125 | return self.connection.execute(*query) |
131 | except sqlite3.OperationalError as e: | 126 | except sqlite3.OperationalError as e: |
132 | if 'database is locked' in str(e) and count < 500: | 127 | if 'database is locked' in str(e) and count < 500: |
133 | count = count + 1 | 128 | count = count + 1 |