diff mbox series

[4/4] bitbake-setup: Add version check and catch exceptions

Message ID 20260326173951.519326-5-rob.woolley@windriver.com
State New
Headers show
Series [1/4] bin: Move version information to common file | expand

Commit Message

Rob Woolley March 26, 2026, 5:39 p.m. UTC
This modifies the conditional script stanza to match bitbake.

It adds a version check to ensure that the correct bb module
version has been found.  It also catches any exceptions thrown
during execution.

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
---
 bin/bitbake-setup | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index d7e2e187c..65c38b4f7 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -1193,4 +1193,11 @@  def main():
         parser.print_help()
 
 if __name__ == '__main__':
-    main()
+    if __version__ != bb.__version__:
+        sys.exit("Bitbake core version and program version mismatch!")
+    try:
+        sys.exit(main())
+    except Exception:
+        import traceback
+        traceback.print_exc()
+        sys.exit(1)