diff mbox series

[RFC,02/10] bblayers/makesetup: raise exceptions when errors happen

Message ID 20240223120134.3713127-2-alex@linutronix.de
State New
Headers show
Series [RFC,01/10] scripts/oe-setup-build: write a build environment initialization one-liner into the build directory | expand

Commit Message

Alexander Kanavin Feb. 23, 2024, 12:01 p.m. UTC
Otherwise the calling code can only issue a generic, unhelpful
erorr message, and it's difficult to tell what went wrong
if logger.error output is obscured or redirected.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/bblayers/makesetup.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/bblayers/makesetup.py b/meta/lib/bblayers/makesetup.py
index 4f27c565eeb..ecfa65adc7f 100644
--- a/meta/lib/bblayers/makesetup.py
+++ b/meta/lib/bblayers/makesetup.py
@@ -65,8 +65,9 @@  class MakeSetupPlugin(LayerPlugin):
             if l_name == 'workspace':
                 continue
             if l_ismodified:
-                logger.error("Layer {name} in {path} has uncommitted modifications or is not in a git repository.".format(name=l_name,path=l_path))
-                return
+                e = "Layer {name} in {path} has uncommitted modifications or is not in a git repository.".format(name=l_name,path=l_path)
+                logger.error(e)
+                raise Exception(e)
             repo_path = self._get_repo_path(l_path)
 
             if self._is_submodule(repo_path):
@@ -76,8 +77,9 @@  class MakeSetupPlugin(LayerPlugin):
                 if repo_path == destdir_repo:
                     repos[repo_path]['contains_this_file'] = True
                 if not repos[repo_path]['git-remote']['remotes'] and not repos[repo_path]['contains_this_file']:
-                    logger.error("Layer repository in {path} does not have any remotes configured. Please add at least one with 'git remote add'.".format(path=repo_path))
-                    return
+                    e = "Layer repository in {path} does not have any remotes configured. Please add at least one with 'git remote add'.".format(path=repo_path)
+                    logger.error(e)
+                    raise Exception(e)
 
         top_path = os.path.commonpath([os.path.dirname(r) for r in repos.keys()])