summaryrefslogtreecommitdiffstats
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 08:02:10 +0100
commit2dc0b337bc53c94ca60423dd0a39086bb62d36ef (patch)
tree3079873e4f742289208ecf5ff1908ce10fca12a1
parentf558ecf90e05e7ba32f1a4a24572c450360244dc (diff)
downloadpoky-2dc0b337bc53c94ca60423dd0a39086bb62d36ef.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. (From OE-Core rev: c82b28982c4f630c130c827a7da3ac0454cd93b6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/combo-layer34
1 files changed, 23 insertions, 11 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index a93fb9b0e6..4025b72a87 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -184,6 +184,19 @@ def check_patch(patchfile):
184 of.close() 184 of.close()
185 os.rename(patchfile + '.tmp', patchfile) 185 os.rename(patchfile + '.tmp', patchfile)
186 186
187def drop_to_shell(workdir=None):
188 shell = os.environ.get('SHELL', 'bash')
189 print('Dropping to shell "%s"\n' \
190 'When you are finished, run the following to continue:\n' \
191 ' exit -- continue to apply the patches\n' \
192 ' exit 1 -- abort\n' % shell);
193 ret = subprocess.call([shell], cwd=workdir)
194 if ret != 0:
195 print "Aborting"
196 return False
197 else:
198 return True
199
187def get_repos(conf, args): 200def get_repos(conf, args):
188 repos = [] 201 repos = []
189 if len(args) > 1: 202 if len(args) > 1:
@@ -295,14 +308,9 @@ def action_update(conf, args):
295 308
296 # Step 5: invoke bash for user to edit patch and patch list 309 # Step 5: invoke bash for user to edit patch and patch list
297 if conf.interactive: 310 if conf.interactive:
298 print 'Edit the patch and patch list in %s\n' \ 311 print('You may now edit the patch and patch list in %s\n' \
299 'For example, remove the unwanted patch entry from patchlist-*, so that it will be not applied later\n' \ 312 'For example, you can remove unwanted patch entries from patchlist-*, so that they will be not applied later' % patch_dir);
300 'When you are finished, run the following to continue:\n' \ 313 if not drop_to_shell(patch_dir):
301 ' exit 0 -- exit and continue to apply the patch\n' \
302 ' exit 1 -- abort and do not apply the patch\n' % patch_dir
303 ret = subprocess.call(["bash"], cwd=patch_dir)
304 if ret != 0:
305 print "Aborting without applying the patch"
306 sys.exit(0) 314 sys.exit(0)
307 315
308 # Step 6: apply the generated and revised patch 316 # Step 6: apply the generated and revised patch
@@ -328,6 +336,7 @@ def apply_patchlist(conf, repos):
328 for name in repos: 336 for name in repos:
329 repo = conf.repos[name] 337 repo = conf.repos[name]
330 lastrev = repo["last_revision"] 338 lastrev = repo["last_revision"]
339 prevrev = lastrev
331 for line in open(repo['patchlist']): 340 for line in open(repo['patchlist']):
332 patchfile = line.split()[0] 341 patchfile = line.split()[0]
333 lastrev = line.split()[1] 342 lastrev = line.split()[1]
@@ -343,9 +352,12 @@ def apply_patchlist(conf, repos):
343 runcmd("git am --abort") 352 runcmd("git am --abort")
344 logger.error('"%s" failed' % cmd) 353 logger.error('"%s" failed' % cmd)
345 logger.info("please manually apply patch %s" % patchfile) 354 logger.info("please manually apply patch %s" % patchfile)
346 logger.info("After applying, run this tool again to apply the remaining patches") 355 logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped")
347 conf.update(name, "last_revision", lastrev) 356 if not drop_to_shell():
348 sys.exit(0) 357 if prevrev != repo['last_revision']:
358 conf.update(name, "last_revision", prevrev)
359 sys.exit(0)
360 prevrev = lastrev
349 if lastrev != repo['last_revision']: 361 if lastrev != repo['last_revision']:
350 conf.update(name, "last_revision", lastrev) 362 conf.update(name, "last_revision", lastrev)
351 363