summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/devtool/__init__.py9
-rw-r--r--scripts/lib/devtool/standard.py22
2 files changed, 24 insertions, 7 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 78ae0aabc8..4c0d5397dc 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -43,12 +43,13 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
43 if watch: 43 if watch:
44 if sys.stdout.isatty(): 44 if sys.stdout.isatty():
45 # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly) 45 # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly)
46 cmd = 'script -q -c "%s" /dev/null' % cmd 46 cmd = 'script -e -q -c "%s" /dev/null' % cmd
47 return exec_watch('%s%s' % (init_prefix, cmd), **options) 47 return exec_watch('%s%s' % (init_prefix, cmd), **options)
48 else: 48 else:
49 return bb.process.run('%s%s' % (init_prefix, cmd), **options) 49 return bb.process.run('%s%s' % (init_prefix, cmd), **options)
50 50
51def exec_watch(cmd, **options): 51def exec_watch(cmd, **options):
52 import bb
52 if isinstance(cmd, basestring) and not "shell" in options: 53 if isinstance(cmd, basestring) and not "shell" in options:
53 options["shell"] = True 54 options["shell"] = True
54 55
@@ -65,7 +66,11 @@ def exec_watch(cmd, **options):
65 buf += out 66 buf += out
66 elif out == '' and process.poll() != None: 67 elif out == '' and process.poll() != None:
67 break 68 break
68 return buf 69
70 if process.returncode != 0:
71 raise bb.process.ExecutionError(cmd, process.returncode, buf, None)
72
73 return buf, None
69 74
70def setup_tinfoil(): 75def setup_tinfoil():
71 import scriptpath 76 import scriptpath
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