From a5fcc0566de94d92f78ab156f641ac5dc58855fc Mon Sep 17 00:00:00 2001 From: "samuel.bissig" Date: Thu, 22 Apr 2021 14:25:07 +0200 Subject: uprev-srcrev: return status of subprocess calls So far exceptions have been catched in the python script and have not been reported back to caller. The status code of the script was always 0. This makes it impossible to the build scripts to react on failed runs of uprev-srcrev tool. In case a recipe can not be found, patching further recipes gets skipped and a status code not equal to 0 is returned. Signed-off-by: samuel.bissig --- scripts/uprev-srcrev | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/uprev-srcrev b/scripts/uprev-srcrev index 2c1a6ef..b6bebfb 100755 --- a/scripts/uprev-srcrev +++ b/scripts/uprev-srcrev @@ -54,8 +54,9 @@ def uprev_recipe(args, env, recipe): shell=True) if not args.quiet: print(result.stdout) + return result.returncode except subprocess.CalledProcessError as e: - print('ERROR: recipetool failed:\n%s' % e.output.decode('utf-8')) + logger.error('ERROR: recipetool failed:\n%s' % e.output.decode('utf-8')) return e.returncode @@ -73,7 +74,10 @@ def uprev(args): for recipe in recipes: logger.info('Processing recipe {}'.format(recipe)) - uprev_recipe(args, env, recipe) + res = uprev_recipe(args, env, recipe) + if (res != os.EX_OK): + return res + return os.EX_OK def main(): parser = argparse_oe.ArgumentParser(description='SRCREV uprev tool.') -- cgit v1.2.3