summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/persist_data.py
diff options
context:
space:
mode:
authorYoann Congal <yoann.congal@smile.fr>2023-01-12 20:32:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-13 17:34:08 +0000
commite1a661e3d2d4d62aa0c47c2abb0a6824e1b17ede (patch)
treeabababffa96b963193ca48f185d29997650b7d9c /bitbake/lib/bb/persist_data.py
parent79edc06213935a6ae9fac3abeeb35c646465a7ee (diff)
downloadpoky-e1a661e3d2d4d62aa0c47c2abb0a6824e1b17ede.tar.gz
bitbake: persist_data: Handle sqlite error when cachefile path is too long
Sqlite can't open the cachefile when its path is too long (>= 505 char by my tests). We do have a path length check in sanity.bbclass but this code is called before sanity checks. Treat the error in the exception instead of checking before hand in case sqlite eventually fixes this. Fixes [YOCTO #12374] (Bitbake rev: bf681d173263cd42ffc143655f61abe0573fd83c) Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/persist_data.py')
-rw-r--r--bitbake/lib/bb/persist_data.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index ce84a15825..bcca791edf 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -249,4 +249,23 @@ def persist(domain, d):
249 249
250 bb.utils.mkdirhier(cachedir) 250 bb.utils.mkdirhier(cachedir)
251 cachefile = os.path.join(cachedir, "bb_persist_data.sqlite3") 251 cachefile = os.path.join(cachedir, "bb_persist_data.sqlite3")
252 return SQLTable(cachefile, domain) 252
253 try:
254 return SQLTable(cachefile, domain)
255 except sqlite3.OperationalError:
256 # Sqlite fails to open database when its path is too long.
257 # After testing, 504 is the biggest path length that can be opened by
258 # sqlite.
259 # Note: This code is called before sanity.bbclass and its path length
260 # check
261 max_len = 504
262 if len(cachefile) > max_len:
263 logger.critical("The path of the cache file is too long "
264 "({0} chars > {1}) to be opened by sqlite! "
265 "Your cache file is \"{2}\"".format(
266 len(cachefile),
267 max_len,
268 cachefile))
269 sys.exit(1)
270 else:
271 raise