[PATCH v3 05/10] bitbake-setup: Add version check and catch exceptions

Rob Woolley <[email protected]> Tue, 16 Jun 2026 14:31:25 -0700
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
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 <[email protected]>
---
 bin/bitbake-setup | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 8218a500..af70d0cd 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -1408,4 +1408,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)

-- 
2.49.0