summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index ef58523dc8..fa5b8ef3c7 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -261,7 +261,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
261 revs = {} 261 revs = {}
262 for path in paths: 262 for path in paths:
263 (stdout, _) = _run('git rev-parse HEAD', cwd=path) 263 (stdout, _) = _run('git rev-parse HEAD', cwd=path)
264 revs[os.path.relpath(path,srctree)] = stdout.rstrip() 264 revs[os.path.relpath(path, srctree)] = stdout.rstrip()
265 265
266 if no_patch: 266 if no_patch:
267 patches = oe.recipeutils.get_recipe_patches(crd) 267 patches = oe.recipeutils.get_recipe_patches(crd)
@@ -272,17 +272,35 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
272 _run('git checkout devtool-patched -b %s' % branch, cwd=path) 272 _run('git checkout devtool-patched -b %s' % branch, cwd=path)
273 (stdout, _) = _run('git branch --list devtool-override-*', cwd=path) 273 (stdout, _) = _run('git branch --list devtool-override-*', cwd=path)
274 branches_to_rebase = [branch] + stdout.split() 274 branches_to_rebase = [branch] + stdout.split()
275 target_branch = revs[os.path.relpath(path, srctree)]
276
277 # There is a bug (or feature?) in git rebase where if a commit with
278 # a note is fully rebased away by being part of an old commit, the
279 # note is still attached to the old commit. Avoid this by making
280 # sure all old devtool related commits have a note attached to them
281 # (this assumes git config notes.rewriteMode is set to ignore).
282 (stdout, _) = __run('git rev-list devtool-base..%s' % target_branch)
283 for rev in stdout.splitlines():
284 if not oe.patch.GitApplyTree.getNotes(path, rev):
285 oe.patch.GitApplyTree.addNote(path, rev, "dummy")
286
275 for b in branches_to_rebase: 287 for b in branches_to_rebase:
276 logger.info("Rebasing {} onto {}".format(b, revs[os.path.relpath(path,srctree)])) 288 logger.info("Rebasing {} onto {}".format(b, target_branch))
277 _run('git checkout %s' % b, cwd=path) 289 _run('git checkout %s' % b, cwd=path)
278 try: 290 try:
279 _run('git rebase %s' % revs[os.path.relpath(path, srctree)], cwd=path) 291 _run('git rebase %s' % target_branch, cwd=path)
280 except bb.process.ExecutionError as e: 292 except bb.process.ExecutionError as e:
281 if 'conflict' in e.stdout: 293 if 'conflict' in e.stdout:
282 logger.warning('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) 294 logger.warning('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip()))
283 _run('git rebase --abort', cwd=path) 295 _run('git rebase --abort', cwd=path)
284 else: 296 else:
285 logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) 297 logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout))
298
299 # Remove any dummy notes added above.
300 (stdout, _) = __run('git rev-list devtool-base..%s' % target_branch)
301 for rev in stdout.splitlines():
302 oe.patch.GitApplyTree.removeNote(path, rev, "dummy")
303
286 _run('git checkout %s' % branch, cwd=path) 304 _run('git checkout %s' % branch, cwd=path)
287 305
288 if tmpsrctree: 306 if tmpsrctree: