diff mbox series

[RFC,1/2] cooker: use BB_HASHSERVE_DB_DIR for hash server database location

Message ID 20251215145418.2680311-1-alex.kanavin@gmail.com
State New
Headers show
Series [RFC,1/2] cooker: use BB_HASHSERVE_DB_DIR for hash server database location | expand

Commit Message

Alexander Kanavin Dec. 15, 2025, 2:54 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

If unset, the existing behavior is preseved.

The use case is sharing the database in bitbake-setup's driven builds
without having to set up/start/stop a common single server shared
between them (this is added to bitbake-setup in the next commit).

Also create the specified directory if it doesn't yet exist.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 lib/bb/cooker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index fa7747d64..c1281a847 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -328,7 +328,9 @@  class BBCooker:
         if self.data.getVar("BB_HASHSERVE") == "auto":
             # Create a new hash server bound to a unix domain socket
             if not self.hashserv:
-                dbfile = (self.data.getVar("PERSISTENT_DIR") or self.data.getVar("CACHE")) + "/hashserv.db"
+                dbdir = self.data.getVar("BB_HASHSERVE_DB_DIR") or self.data.getVar("PERSISTENT_DIR") or self.data.getVar("CACHE")
+                os.makedirs(dbdir, exist_ok=True)
+                dbfile = dbdir + "/hashserv.db"
                 upstream = self.data.getVar("BB_HASHSERVE_UPSTREAM") or None
                 if upstream:
                     try: