[OE-core] [PATCH 06/12] devtool: modify: pick up commits from previously created source tree

Paul Eggleton paul.eggleton at linux.intel.com
Tue Dec 5 01:41:15 UTC 2017


If you use devtool modify, then devtool reset, keep the source tree and
then devtool modify on the same recipe with the -n option to re-use the
existing source tree, we should pick up the commit hashes properly from
the source tree so that later on devtool finish has these to compare to
the commits in the tree at that time. We also need to be careful the
second time around that we only get the original commits rather than the
current HEAD which may be the result of user changes (hence using
"devtool-patched", the tag that was placed at the original HEAD).

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 scripts/lib/devtool/standard.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index a6656e4..ae48406 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -750,13 +750,11 @@ def modify(args, config, basepath, workspace):
         initial_rev = None
         commits = []
         check_commits = False
+        torev = 'HEAD'
         if not args.no_extract:
             ret = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
             initial_rev = ret.initial_rev
             logger.info('Source tree extracted to %s' % srctree)
-            # Get list of commits since this revision
-            (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree)
-            commits = stdout.split()
             check_commits = True
         else:
             if os.path.exists(os.path.join(srctree, '.git')):
@@ -767,6 +765,7 @@ def modify(args, config, basepath, workspace):
                     stdout = ''
                 if stdout:
                     check_commits = True
+                    torev = 'devtool-patched'
                 for line in stdout.splitlines():
                     if line.startswith('*'):
                         (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=srctree)
@@ -776,6 +775,11 @@ def modify(args, config, basepath, workspace):
                     (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
                     initial_rev = stdout.rstrip()
 
+        if initial_rev:
+            # Get list of commits since this revision
+            (stdout, _) = bb.process.run('git rev-list --reverse %s..%s' % (initial_rev, torev), cwd=srctree)
+            commits = stdout.split()
+
         branch_patches = {}
         if check_commits:
             # Check if there are override branches
-- 
2.9.5




More information about the Openembedded-core mailing list