summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-03 17:44:27 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-11 15:00:20 +0100
commiteb4a134a60e3ac26a48379675ad6346a44010339 (patch)
treeeb3b16e2d8ad4e89c09b8c2f4c8f527ae7c1afce /scripts
parent508c4cac320d78a983ce105a78c0599102e2c349 (diff)
downloadast2050-yocto-poky-eb4a134a60e3ac26a48379675ad6346a44010339.zip
ast2050-yocto-poky-eb4a134a60e3ac26a48379675ad6346a44010339.tar.gz
scripts/combo-layer: Fix exit codes and tty handling
If combo-layer is called from a non-interactive context we should exit with a correct error code rather than try and drop to a shell. This patch cleans up a few error case exit codes as well as detecting and handling non-interactive usage. (From OE-Core rev: 3b1d89a51445cf526ca84eb5b53de434f9585d6e) (From OE-Core rev: b08ee8478f0cc2e2f9394c7e209dae45de2d845e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combo-layer10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 698d3e3..4029d2b 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -502,6 +502,10 @@ def check_patch(patchfile):
os.rename(patchfile + '.tmp', patchfile)
def drop_to_shell(workdir=None):
+ if not sys.stdin.isatty():
+ print "Not a TTY so can't drop to shell for resolution, exiting."
+ return False
+
shell = os.environ.get('SHELL', 'bash')
print('Dropping to shell "%s"\n' \
'When you are finished, run the following to continue:\n' \
@@ -547,7 +551,7 @@ def get_repos(conf, repo_names):
for repo in repos:
if not repo in conf.repos:
logger.error("Specified component '%s' not found in configuration" % repo)
- sys.exit(0)
+ sys.exit(1)
if not repos:
repos = conf.repos
@@ -695,7 +699,7 @@ def action_update(conf, args):
print('You may now edit the patch and patch list in %s\n' \
'For example, you can remove unwanted patch entries from patchlist-*, so that they will be not applied later' % patch_dir);
if not drop_to_shell(patch_dir):
- sys.exit(0)
+ sys.exit(1)
# Step 6: apply the generated and revised patch
apply_patchlist(conf, repos)
@@ -761,7 +765,7 @@ def apply_patchlist(conf, repos):
if not drop_to_shell():
if prevrev != repo['last_revision']:
conf.update(name, "last_revision", prevrev)
- sys.exit(0)
+ sys.exit(1)
prevrev = lastrev
i += 1
# Once all patches are applied, we should update
OpenPOWER on IntegriCloud