]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
bblayers/makesetup: raise exceptions when errors happen
authorAlexander Kanavin <alex@linutronix.de>
Tue, 7 May 2024 11:46:21 +0000 (13:46 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 28 May 2024 08:38:19 +0000 (09:38 +0100)
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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/bblayers/makesetup.py

index 99d59737602c304888316537d60edf65aa2949ad..8148b0d9ff43c6f4c407cfa607ddcaef176a7df5 100644 (file)
@@ -48,8 +48,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 = oe.buildcfg.get_metadata_git_toplevel(l_path)
 
             if self._is_submodule(repo_path):
@@ -63,8 +64,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()])