aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-31 01:06:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 07:56:59 +0100
commitc82b28982c4f630c130c827a7da3ac0454cd93b6 (patch)
tree330ccad789a1a36ea6fca622ca891f328ddeaccf /scripts/combo-layer
parentfea477ac55e2555c5bb0aad36db641aaa27aa915 (diff)
downloadopenembedded-core-contrib-c82b28982c4f630c130c827a7da3ac0454cd93b6.tar.gz
combo-layer: drop to a shell when apply fails during update
If applying a patch fails during the update process, drop to a shell instead of exiting; at that point the user can manually apply the patch, do nothing and "exit" to skip it, or "exit 1" to abort the process. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer34
1 files changed, 23 insertions, 11 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index a93fb9b0e69..4025b72a870 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -184,6 +184,19 @@ def check_patch(patchfile):
of.close()
os.rename(patchfile + '.tmp', patchfile)
+def drop_to_shell(workdir=None):
+ shell = os.environ.get('SHELL', 'bash')
+ print('Dropping to shell "%s"\n' \
+ 'When you are finished, run the following to continue:\n' \
+ ' exit -- continue to apply the patches\n' \
+ ' exit 1 -- abort\n' % shell);
+ ret = subprocess.call([shell], cwd=workdir)
+ if ret != 0:
+ print "Aborting"
+ return False
+ else:
+ return True
+
def get_repos(conf, args):
repos = []
if len(args) > 1:
@@ -295,14 +308,9 @@ def action_update(conf, args):
# Step 5: invoke bash for user to edit patch and patch list
if conf.interactive:
- print 'Edit the patch and patch list in %s\n' \
- 'For example, remove the unwanted patch entry from patchlist-*, so that it will be not applied later\n' \
- 'When you are finished, run the following to continue:\n' \
- ' exit 0 -- exit and continue to apply the patch\n' \
- ' exit 1 -- abort and do not apply the patch\n' % patch_dir
- ret = subprocess.call(["bash"], cwd=patch_dir)
- if ret != 0:
- print "Aborting without applying the patch"
+ 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)
# Step 6: apply the generated and revised patch
@@ -328,6 +336,7 @@ def apply_patchlist(conf, repos):
for name in repos:
repo = conf.repos[name]
lastrev = repo["last_revision"]
+ prevrev = lastrev
for line in open(repo['patchlist']):
patchfile = line.split()[0]
lastrev = line.split()[1]
@@ -343,9 +352,12 @@ def apply_patchlist(conf, repos):
runcmd("git am --abort")
logger.error('"%s" failed' % cmd)
logger.info("please manually apply patch %s" % patchfile)
- logger.info("After applying, run this tool again to apply the remaining patches")
- conf.update(name, "last_revision", lastrev)
- sys.exit(0)
+ logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped")
+ if not drop_to_shell():
+ if prevrev != repo['last_revision']:
+ conf.update(name, "last_revision", prevrev)
+ sys.exit(0)
+ prevrev = lastrev
if lastrev != repo['last_revision']:
conf.update(name, "last_revision", lastrev)