Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] A couple of devtool/recipetool fixes
@ 2015-10-02 13:05 Paul Eggleton
  2015-10-02 13:05 ` [PATCH 1/2] devtool: update-recipe: avoid updating patches that have not changed Paul Eggleton
  2015-10-02 13:05 ` [PATCH 2/2] recipetool: create: fix change in path structure if --extract-to path exists Paul Eggleton
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-10-02 13:05 UTC (permalink / raw)
  To: openembedded-core

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(-)

-- 
2.1.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] devtool: update-recipe: avoid updating patches that have not changed
  2015-10-02 13:05 [PATCH 0/2] A couple of devtool/recipetool fixes Paul Eggleton
@ 2015-10-02 13:05 ` Paul Eggleton
  2015-10-02 13:05 ` [PATCH 2/2] recipetool: create: fix change in path structure if --extract-to path exists Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-10-02 13:05 UTC (permalink / raw)
  To: openembedded-core

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>
---
 scripts/lib/devtool/standard.py | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 8676e42..6ce3144 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),
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] recipetool: create: fix change in path structure if --extract-to path exists
  2015-10-02 13:05 [PATCH 0/2] A couple of devtool/recipetool fixes Paul Eggleton
  2015-10-02 13:05 ` [PATCH 1/2] devtool: update-recipe: avoid updating patches that have not changed Paul Eggleton
@ 2015-10-02 13:05 ` Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-10-02 13:05 UTC (permalink / raw)
  To: openembedded-core

If 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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/lib/recipetool/create.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 844073b..15aa9bd 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -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)
 
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-02 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 13:05 [PATCH 0/2] A couple of devtool/recipetool fixes Paul Eggleton
2015-10-02 13:05 ` [PATCH 1/2] devtool: update-recipe: avoid updating patches that have not changed Paul Eggleton
2015-10-02 13:05 ` [PATCH 2/2] recipetool: create: fix change in path structure if --extract-to path exists Paul Eggleton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox