summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-03-09 14:27:47 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-11 06:27:00 -0700
commit8cec60990e31480fdd212611d47236bfc61dfa68 (patch)
treee6df4ed9800e4b76691884122bdfa2ed265daf08 /scripts/lib/devtool/standard.py
parent7dce685fe41c1474ec0ef5f1bd69926c29d30464 (diff)
downloadpoky-8cec60990e31480fdd212611d47236bfc61dfa68.tar.gz
devtool: add --force-patch-refresh to 'modify' and 'finish' commands
This is very useful for updating patch context so that any fuzz is eliminated. Simply issue: devtool modify <recipe> devtool finish --force-patch-refresh <recipe> <layer_path> Without this flag, devtool will not deem the commits in the workspace different to patches in the layer, even if the commits have different, up-to-date context line in them. (From OE-Core rev: 7e1d1887be8faaaab9996fca9a3fd750aeb7b62f) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index a962ebe09b..a1e8e1d322 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1061,7 +1061,7 @@ def rename(args, config, basepath, workspace):
1061 return 0 1061 return 0
1062 1062
1063 1063
1064def _get_patchset_revs(srctree, recipe_path, initial_rev=None): 1064def _get_patchset_revs(srctree, recipe_path, initial_rev=None, force_patch_refresh=False):
1065 """Get initial and update rev of a recipe. These are the start point of the 1065 """Get initial and update rev of a recipe. These are the start point of the
1066 whole patchset and start point for the patches to be re-generated/updated. 1066 whole patchset and start point for the patches to be re-generated/updated.
1067 """ 1067 """
@@ -1080,7 +1080,7 @@ def _get_patchset_revs(srctree, recipe_path, initial_rev=None):
1080 if line.startswith('# initial_rev:'): 1080 if line.startswith('# initial_rev:'):
1081 if not initial_rev: 1081 if not initial_rev:
1082 initial_rev = line.split(':')[-1].strip() 1082 initial_rev = line.split(':')[-1].strip()
1083 elif line.startswith('# commit:'): 1083 elif line.startswith('# commit:') and not force_patch_refresh:
1084 commits.append(line.split(':')[-1].strip()) 1084 commits.append(line.split(':')[-1].strip())
1085 elif line.startswith('# patches_%s:' % branchname): 1085 elif line.startswith('# patches_%s:' % branchname):
1086 patches = line.split(':')[-1].strip().split(',') 1086 patches = line.split(':')[-1].strip().split(',')
@@ -1102,7 +1102,7 @@ def _get_patchset_revs(srctree, recipe_path, initial_rev=None):
1102 except bb.process.ExecutionError as err: 1102 except bb.process.ExecutionError as err:
1103 stdout = None 1103 stdout = None
1104 1104
1105 if stdout is not None: 1105 if stdout is not None and not force_patch_refresh:
1106 changed_revs = [] 1106 changed_revs = []
1107 for line in stdout.splitlines(): 1107 for line in stdout.splitlines():
1108 if line.startswith('+ '): 1108 if line.startswith('+ '):
@@ -1459,7 +1459,7 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi
1459 _remove_source_files(appendlayerdir, remove_files, destpath, no_report_remove, dry_run=dry_run_outdir) 1459 _remove_source_files(appendlayerdir, remove_files, destpath, no_report_remove, dry_run=dry_run_outdir)
1460 return True, appendfile, remove_files 1460 return True, appendfile, remove_files
1461 1461
1462def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir=None): 1462def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir=None, force_patch_refresh=False):
1463 """Implement the 'patch' mode of update-recipe""" 1463 """Implement the 'patch' mode of update-recipe"""
1464 import bb 1464 import bb
1465 import oe.recipeutils 1465 import oe.recipeutils
@@ -1471,7 +1471,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1471 raise DevtoolError('unable to find workspace bbappend for recipe %s' % 1471 raise DevtoolError('unable to find workspace bbappend for recipe %s' %
1472 recipename) 1472 recipename)
1473 1473
1474 initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev) 1474 initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev, force_patch_refresh)
1475 if not initial_rev: 1475 if not initial_rev:
1476 raise DevtoolError('Unable to find initial revision - please specify ' 1476 raise DevtoolError('Unable to find initial revision - please specify '
1477 'it with --initial-rev') 1477 'it with --initial-rev')
@@ -1623,7 +1623,7 @@ def _guess_recipe_update_mode(srctree, rdata):
1623 1623
1624 return 'patch' 1624 return 'patch'
1625 1625
1626def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_version, no_remove, initial_rev, no_report_remove=False, dry_run_outdir=None, no_overrides=False): 1626def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_version, no_remove, initial_rev, no_report_remove=False, dry_run_outdir=None, no_overrides=False, force_patch_refresh=False):
1627 srctree = workspace[recipename]['srctree'] 1627 srctree = workspace[recipename]['srctree']
1628 if mode == 'auto': 1628 if mode == 'auto':
1629 mode = _guess_recipe_update_mode(srctree, rd) 1629 mode = _guess_recipe_update_mode(srctree, rd)
@@ -1677,7 +1677,7 @@ def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_ver
1677 if mode == 'srcrev': 1677 if mode == 'srcrev':
1678 updated, appendf, removed = _update_recipe_srcrev(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, dry_run_outdir) 1678 updated, appendf, removed = _update_recipe_srcrev(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, dry_run_outdir)
1679 elif mode == 'patch': 1679 elif mode == 'patch':
1680 updated, appendf, removed = _update_recipe_patch(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir) 1680 updated, appendf, removed = _update_recipe_patch(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir, force_patch_refresh)
1681 else: 1681 else:
1682 raise DevtoolError('update_recipe: invalid mode %s' % mode) 1682 raise DevtoolError('update_recipe: invalid mode %s' % mode)
1683 if updated: 1683 if updated:
@@ -1715,7 +1715,7 @@ def update_recipe(args, config, basepath, workspace):
1715 if args.dry_run: 1715 if args.dry_run:
1716 dry_run_output = tempfile.TemporaryDirectory(prefix='devtool') 1716 dry_run_output = tempfile.TemporaryDirectory(prefix='devtool')
1717 dry_run_outdir = dry_run_output.name 1717 dry_run_outdir = dry_run_output.name
1718 updated, _, _ = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides) 1718 updated, _, _ = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides, force_patch_refresh=args.force_patch_refresh)
1719 1719
1720 if updated: 1720 if updated:
1721 rf = rd.getVar('FILE') 1721 rf = rd.getVar('FILE')
@@ -1947,7 +1947,7 @@ def finish(args, config, basepath, workspace):
1947 if args.dry_run: 1947 if args.dry_run:
1948 dry_run_output = tempfile.TemporaryDirectory(prefix='devtool') 1948 dry_run_output = tempfile.TemporaryDirectory(prefix='devtool')
1949 dry_run_outdir = dry_run_output.name 1949 dry_run_outdir = dry_run_output.name
1950 updated, appendfile, removed = _update_recipe(args.recipename, workspace, rd, args.mode, appendlayerdir, wildcard_version=True, no_remove=False, no_report_remove=removing_original, initial_rev=args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides) 1950 updated, appendfile, removed = _update_recipe(args.recipename, workspace, rd, args.mode, appendlayerdir, wildcard_version=True, no_remove=False, no_report_remove=removing_original, initial_rev=args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides, force_patch_refresh=args.force_patch_refresh)
1951 removed = [os.path.relpath(pth, recipedir) for pth in removed] 1951 removed = [os.path.relpath(pth, recipedir) for pth in removed]
1952 1952
1953 # Remove any old files in the case of an upgrade 1953 # Remove any old files in the case of an upgrade
@@ -2134,6 +2134,7 @@ def register_commands(subparsers, context):
2134 parser_update_recipe.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove patches, only add or update') 2134 parser_update_recipe.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove patches, only add or update')
2135 parser_update_recipe.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)') 2135 parser_update_recipe.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)')
2136 parser_update_recipe.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)') 2136 parser_update_recipe.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)')
2137 parser_update_recipe.add_argument('--force-patch-refresh', action="store_true", help='Update patches in the layer even if they have not been modified (useful for refreshing patch context)')
2137 parser_update_recipe.set_defaults(func=update_recipe) 2138 parser_update_recipe.set_defaults(func=update_recipe)
2138 2139
2139 parser_status = subparsers.add_parser('status', help='Show workspace status', 2140 parser_status = subparsers.add_parser('status', help='Show workspace status',
@@ -2159,4 +2160,5 @@ def register_commands(subparsers, context):
2159 parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if there are uncommitted changes in the source tree repository') 2160 parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if there are uncommitted changes in the source tree repository')
2160 parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)') 2161 parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)')
2161 parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)') 2162 parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)')
2163 parser_finish.add_argument('--force-patch-refresh', action="store_true", help='Update patches in the layer even if they have not been modified (useful for refreshing patch context)')
2162 parser_finish.set_defaults(func=finish) 2164 parser_finish.set_defaults(func=finish)