diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-10-02 14:05:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-03 00:01:13 +0100 |
commit | 7baf57ad896112cf2258b3e2c2a1f8b756fb39bc (patch) | |
tree | 635ed84caf83e240e1521bcf5b9595af38d9d39d | |
parent | 037b757722093ced372eaae8cc9305ad2ea81ab5 (diff) | |
download | openembedded-core-7baf57ad896112cf2258b3e2c2a1f8b756fb39bc.tar.gz openembedded-core-7baf57ad896112cf2258b3e2c2a1f8b756fb39bc.tar.bz2 openembedded-core-7baf57ad896112cf2258b3e2c2a1f8b756fb39bc.zip |
devtool: update-recipe: avoid updating patches that have not changed
Use "git cherry" against the original tag that we made when we extracted
the source in order to find the revisions that are definitely new. This
allows you to modify a commit in the middle of the series and then run
devtool update-recipe and not have the subsequent patches unnecessarily
modified.
Fixes [YOCTO #8388].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/devtool/standard.py | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 8676e4202f..6ce3144dd0 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -605,6 +605,7 @@ def _get_patchset_revs(args, srctree, recipe_path): commits.append(line.split(':')[-1].strip()) update_rev = initial_rev + changed_revs = None if initial_rev: # Find first actually changed revision stdout, _ = bb.process.run('git rev-list --reverse %s..HEAD' % @@ -614,7 +615,21 @@ def _get_patchset_revs(args, srctree, recipe_path): if newcommits[i] == commits[i]: update_rev = commits[i] - return initial_rev, update_rev + try: + stdout, _ = bb.process.run('git cherry devtool-patched', + cwd=srctree) + except bb.process.ExecutionError as err: + stdout = None + + if stdout is not None: + changed_revs = [] + for line in stdout.splitlines(): + if line.startswith('+ '): + rev = line.split()[1] + if rev in newcommits: + changed_revs.append(rev) + + return initial_rev, update_rev, changed_revs def _remove_file_entries(srcuri, filelist): """Remove file:// entries from SRC_URI""" @@ -835,7 +850,7 @@ def _update_recipe_patch(args, config, srctree, rd, config_data): raise DevtoolError('unable to find workspace bbappend for recipe %s' % args.recipename) - initial_rev, update_rev = _get_patchset_revs(args, srctree, append) + initial_rev, update_rev, changed_revs = _get_patchset_revs(args, srctree, append) if not initial_rev: raise DevtoolError('Unable to find initial revision - please specify ' 'it with --initial-rev') @@ -888,8 +903,16 @@ def _update_recipe_patch(args, config, srctree, rd, config_data): _move_file(os.path.join(local_files_dir, basepath), path) updatefiles = True for basepath, path in upd_p.iteritems(): + patchfn = os.path.join(patches_dir, basepath) + if changed_revs is not None: + # Avoid updating patches that have not actually changed + with open(patchfn, 'r') as f: + firstlineitems = f.readline().split() + if len(firstlineitems) > 1 and len(firstlineitems[1]) == 40: + if not firstlineitems[1] in changed_revs: + continue logger.info('Updating patch %s' % basepath) - _move_file(os.path.join(patches_dir, basepath), path) + _move_file(patchfn, path) updatefiles = True # Add any new files files_dir = os.path.join(os.path.dirname(recipefile), |