diff mbox series

lib/bb/cooker.py: produce an error when BB_HASHSERVE_UPSTREAM cannot be used due to missing python module

Message ID 20250226165017.561683-1-alex.kanavin@gmail.com
State Accepted, archived
Commit cfba2a9fca9dfa3b05ec9040fe0cb8143ac04af7
Headers show
Series lib/bb/cooker.py: produce an error when BB_HASHSERVE_UPSTREAM cannot be used due to missing python module | expand

Commit Message

Alexander Kanavin Feb. 26, 2025, 4:50 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Previously if the websockets module was not installed
bitbake would only print a warning and continue, resulting in a degraded user
experience due to inability to use the configured sstate server.

Let's consider that as fatal misconfiguration, so that users can address
the issue properly and not wonder why builds are taking forever.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/cooker.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 5b885cddd7e..e21815daad8 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -316,8 +316,14 @@  class BBCooker:
                     try:
                         with hashserv.create_client(upstream) as client:
                             client.ping()
-                    except (ConnectionError, ImportError) as e:
-                        bb.warn("BB_HASHSERVE_UPSTREAM is not valid, unable to connect hash equivalence server at '%s': %s"
+                    except ImportError as e:
+                        bb.fatal(""""Unable to use hash equivalence server at '%s' due to missing or incorrect python module:
+%s
+Please install the needed module on the build host, or use an environment containing it (e.g a pip venv or OpenEmbedded's buildtools tarball).
+You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in significantly longer build times as bitbake will be unable to reuse prebuilt sstate artefacts."""
+                                 % (upstream, repr(e)))
+                    except ConnectionError as e:
+                        bb.warn("Unable to connect to hash equivalence server at '%s', please correct or remove BB_HASHSERVE_UPSTREAM:\n%s"
                                  % (upstream, repr(e)))
                         upstream = None