[PATCH][autobuilder-helper][warrior 04/41] layer-config: fixing silent failures from always exiting '0'


Richard Purdie
 

From: Thomas Goodwin <btgoodwin@...>

The return value from bitbakecmd was not being returned when
errors occurred which allowed shared-repo-unpack to succeed
despite the failure. This fix changes to check_call and a
try-catch when attempting to add repos that fail for whatever
reason during add-layer, like a missing conf/layer.conf at
the top level or a previously-added layer breaks parsing
because of missing dependencies.

Signed-off-by: Thomas Goodwin <btgoodwin@...>
Signed-off-by: Richard Purdie <richard.purdie@...>
---
scripts/layer-config | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/layer-config b/scripts/layer-config
index bfc62da..286451a 100755
--- a/scripts/layer-config
+++ b/scripts/layer-config
@@ -24,9 +24,7 @@ args = parser.parse_args()
ourconfig = utils.loadconfig()

def bitbakecmd(targetdir, cmd):
- ret = subprocess.call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)
- if ret:
- utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (cmd, ret))
+ subprocess.check_call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)

needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, args.target, None)

@@ -51,5 +49,8 @@ if callinit:
for repo in needrepos:
if repo in repos and "no-layer-add" in repos[repo] and repos[repo]["no-layer-add"]:
continue
- bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
-
+ try:
+ bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
+ except subprocess.CalledProcessError as e:
+ utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (e.cmd, e.returncode))
+ sys.exit(e.returncode)
--
2.25.1

Join yocto@lists.yoctoproject.org to automatically receive all group messages.