summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-02 14:05:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-07 00:09:10 +0100
commite9616885fce0bef5009de851843efc83ab0a8ff3 (patch)
treed7b3bfdfc69e9f085ce3cedeeabeb6c875fb4fed /scripts/lib/devtool
parent07fc8c2dfba6251d074b9499e59e56799c0067aa (diff)
downloadpoky-e9616885fce0bef5009de851843efc83ab0a8ff3.tar.gz
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]. (From OE-Core rev: 7baf57ad896112cf2258b3e2c2a1f8b756fb39bc) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/standard.py29
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):
605 commits.append(line.split(':')[-1].strip()) 605 commits.append(line.split(':')[-1].strip())
606 606
607 update_rev = initial_rev 607 update_rev = initial_rev
608 changed_revs = None
608 if initial_rev: 609 if initial_rev:
609 # Find first actually changed revision 610 # Find first actually changed revision
610 stdout, _ = bb.process.run('git rev-list --reverse %s..HEAD' % 611 stdout, _ = bb.process.run('git rev-list --reverse %s..HEAD' %
@@ -614,7 +615,21 @@ def _get_patchset_revs(args, srctree, recipe_path):
614 if newcommits[i] == commits[i]: 615 if newcommits[i] == commits[i]:
615 update_rev = commits[i] 616 update_rev = commits[i]
616 617
617 return initial_rev, update_rev 618 try:
619 stdout, _ = bb.process.run('git cherry devtool-patched',
620 cwd=srctree)
621 except bb.process.ExecutionError as err:
622 stdout = None
623
624 if stdout is not None:
625 changed_revs = []
626 for line in stdout.splitlines():
627 if line.startswith('+ '):
628 rev = line.split()[1]
629 if rev in newcommits:
630 changed_revs.append(rev)
631
632 return initial_rev, update_rev, changed_revs
618 633
619def _remove_file_entries(srcuri, filelist): 634def _remove_file_entries(srcuri, filelist):
620 """Remove file:// entries from SRC_URI""" 635 """Remove file:// entries from SRC_URI"""
@@ -835,7 +850,7 @@ def _update_recipe_patch(args, config, srctree, rd, config_data):
835 raise DevtoolError('unable to find workspace bbappend for recipe %s' % 850 raise DevtoolError('unable to find workspace bbappend for recipe %s' %
836 args.recipename) 851 args.recipename)
837 852
838 initial_rev, update_rev = _get_patchset_revs(args, srctree, append) 853 initial_rev, update_rev, changed_revs = _get_patchset_revs(args, srctree, append)
839 if not initial_rev: 854 if not initial_rev:
840 raise DevtoolError('Unable to find initial revision - please specify ' 855 raise DevtoolError('Unable to find initial revision - please specify '
841 'it with --initial-rev') 856 'it with --initial-rev')
@@ -888,8 +903,16 @@ def _update_recipe_patch(args, config, srctree, rd, config_data):
888 _move_file(os.path.join(local_files_dir, basepath), path) 903 _move_file(os.path.join(local_files_dir, basepath), path)
889 updatefiles = True 904 updatefiles = True
890 for basepath, path in upd_p.iteritems(): 905 for basepath, path in upd_p.iteritems():
906 patchfn = os.path.join(patches_dir, basepath)
907 if changed_revs is not None:
908 # Avoid updating patches that have not actually changed
909 with open(patchfn, 'r') as f:
910 firstlineitems = f.readline().split()
911 if len(firstlineitems) > 1 and len(firstlineitems[1]) == 40:
912 if not firstlineitems[1] in changed_revs:
913 continue
891 logger.info('Updating patch %s' % basepath) 914 logger.info('Updating patch %s' % basepath)
892 _move_file(os.path.join(patches_dir, basepath), path) 915 _move_file(patchfn, path)
893 updatefiles = True 916 updatefiles = True
894 # Add any new files 917 # Add any new files
895 files_dir = os.path.join(os.path.dirname(recipefile), 918 files_dir = os.path.join(os.path.dirname(recipefile),