diff mbox series

oe-setup-build: raise exceptions on errors

Message ID 20241217140701.1445851-1-alex.kanavin@gmail.com
State New
Headers show
Series oe-setup-build: raise exceptions on errors | expand

Commit Message

Alexander Kanavin Dec. 17, 2024, 2:07 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Otherwise the tool simply prints what went wrong and exits without error,
which makes it impossible for tools like bitbake-setup to determine that
the requested operation did not succeed.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 scripts/oe-setup-build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build
index 80d8c70bacc..49603d9fd17 100755
--- a/scripts/oe-setup-build
+++ b/scripts/oe-setup-build
@@ -18,8 +18,7 @@  def makebuildpath(topdir, template):
 
 def discover_templates(layers_file):
     if not os.path.exists(layers_file):
-        print("List of layers {} does not exist; were the layers set up using the setup-layers script?".format(layers_file))
-        return None
+        raise Exception("List of layers {} does not exist; were the layers set up using the setup-layers script or bitbake-setup tool?".format(layers_file))
 
     templates = []
     layers_list = json.load(open(layers_file))["layers"]
@@ -77,8 +76,7 @@  def find_template(template_name, templates):
         for t in templates:
             if t["templatename"] == template_name:
                 return t
-        print("Configuration {} is not one of {}, please try again.".format(template_name, [t["templatename"] for t in templates]))
-        return None
+        raise Exception("Configuration {} is not one of {}, please try again.".format(template_name, [t["templatename"] for t in templates]))
 
 def setup_build_env(args):
     templates = discover_templates(args.layerlist)