summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-05-14 10:18:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-28 09:44:15 +0100
commitb317d79fb7a058582f587e24463a1b67f38aec37 (patch)
tree041e4abb9457434f56df91f4e58a19eb80a158e2 /scripts/lib/devtool/standard.py
parent8c9551a7a32036ac1f0bfba0b3f3dc24d006483e (diff)
downloadpoky-b317d79fb7a058582f587e24463a1b67f38aec37.tar.gz
devtool: fix build env command execution error handling
If we execute an external command, we ought to prepare for the possibility that it can fail and handle the failure appropriately. We can especially expect this to happen when running bitbake in this scenario. Ensure we return the appropriate exit code to the calling process. Fixes [YOCTO #7757]. (From OE-Core master rev: 98a716d79bfc5434a5b42d3ca683eab3eea30a41) (From OE-Core rev: 2791fe9236f7173e6b998cf9b40fe238566ed8ee) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 4dc175d117..d9b5d15279 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -64,8 +64,12 @@ def add(args, config, basepath, workspace):
64 color = 'always' 64 color = 'always'
65 else: 65 else:
66 color = args.color 66 color = args.color
67 stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s %s' % (color, recipefile, srctree)) 67 try:
68 logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) 68 stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s"' % (color, recipefile, srctree))
69 logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile)
70 except bb.process.ExecutionError as e:
71 logger.error('Command \'%s\' failed:\n%s' % (e.command, e.stdout))
72 return 1
69 73
70 _add_md5(config, args.recipename, recipefile) 74 _add_md5(config, args.recipename, recipefile)
71 75
@@ -610,7 +614,7 @@ def status(args, config, basepath, workspace):
610 614
611 615
612def reset(args, config, basepath, workspace): 616def reset(args, config, basepath, workspace):
613 import bb.utils 617 import bb
614 if args.recipename: 618 if args.recipename:
615 if args.all: 619 if args.all:
616 logger.error("Recipe cannot be specified if -a/--all is used") 620 logger.error("Recipe cannot be specified if -a/--all is used")
@@ -630,7 +634,11 @@ def reset(args, config, basepath, workspace):
630 for pn in recipes: 634 for pn in recipes:
631 if not args.no_clean: 635 if not args.no_clean:
632 logger.info('Cleaning sysroot for recipe %s...' % pn) 636 logger.info('Cleaning sysroot for recipe %s...' % pn)
633 exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn) 637 try:
638 exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn)
639 except bb.process.ExecutionError as e:
640 logger.error('Command \'%s\' failed, output:\n%s\nIf you wish, you may specify -n/--no-clean to skip running this command when resetting' % (e.command, e.stdout))
641 return 1
634 642
635 _check_preserve(config, pn) 643 _check_preserve(config, pn)
636 644
@@ -656,7 +664,11 @@ def build(args, config, basepath, workspace):
656 logger.error("no recipe named %s in your workspace" % args.recipename) 664 logger.error("no recipe named %s in your workspace" % args.recipename)
657 return -1 665 return -1
658 build_task = config.get('Build', 'build_task', 'populate_sysroot') 666 build_task = config.get('Build', 'build_task', 'populate_sysroot')
659 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) 667 try:
668 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
669 except bb.process.ExecutionError as e:
670 # We've already seen the output since watch=True, so just ensure we return something to the user
671 return e.exitcode
660 672
661 return 0 673 return 0
662 674