A couple of devtool/recipetool fixes
cover A couple of devtool/recipetool fixes
The following changes since commit 6545e402d6411dbd16eae7049a76d47e9a8f996d:
build-appliance-image: Update to jethro head revision (2015-10-01 17:55:07 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/devtool-fixes7
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/devtool-fixes7
Paul Eggleton (2):
devtool: update-recipe: avoid updating patches that have not changed
recipetool: create: fix change in path structure if --extract-to path
exists
scripts/lib/devtool/standard.py | 29 ++++++++++++++++++++++++++--- scripts/lib/recipetool/create.py | 6 ++++++ 2 files changed, 32 insertions(+), 3 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/2 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].
--- scripts/lib/devtool/standard.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
scripts/lib/devtool/standard.py +26 -3
@@ -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),
Signature · 1 line
2.1.0
PATCH 2/2 recipetool: create: fix change in path structure if --extract-to path exists
In reply to Paul EggletonIf the directory specified by --extract-to exists, because we were using shutil.move() to move the temporary extracted directory to the specified path, a subdirectory was being created under that directory instead of moving the contents, which was a different result than if the directory didn't previously exist. We could try to always move the contents but that's complicated when any symlinks are involved; the simplest thing is just to remove the directory (which should be empty anyway) before moving the temporary directory across in its place.
--- scripts/lib/recipetool/create.py | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/lib/recipetool/create.py +6 -0
@@ -260,6 +260,12 @@ def create_recipe(args): if args.extract_to: scriptutils.git_convert_standalone_clone(srctree) + if os.path.isdir(args.extract_to): + # If the directory exists we'll move the temp dir into it instead of + # its contents - of course, we could try to always move its contents + # but that is a pain if there are symlinks; the simplest solution is + # to just remove it first + os.rmdir(args.extract_to) shutil.move(srctree, args.extract_to) logger.info('Source extracted to %s' % args.extract_to)
Signature · 1 line
2.1.0