diff options
| -rwxr-xr-x | scripts/combo-layer | 34 |
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 | ||
| 187 | def 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 | |||
| 187 | def get_repos(conf, args): | 200 | def 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 | ||
