]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: modify: get correct initial revision from previously extracted source tree
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 4 Mar 2015 13:20:37 +0000 (13:20 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 20 Mar 2015 11:03:11 +0000 (11:03 +0000)
If you point devtool modify to a source tree previously created by
devtool modify or devtool extract, then we need to try to pick up the
correct initial revision so that devtool update-recipe knows where to
start looking for commits that match up with patches in the recipe.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/devtool/standard.py

index 32fb3b656b0902684f43a7c6ef29c45d47c42877..f9369eeef0f3c69e85fc52a781219424af5857fb 100644 (file)
@@ -326,8 +326,19 @@ def modify(args, config, basepath, workspace):
         commits = stdout.split()
     else:
         if os.path.exists(os.path.join(args.srctree, '.git')):
-            (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree)
-            initial_rev = stdout.rstrip()
+            # Check if it's a tree previously extracted by us
+            try:
+                (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=args.srctree)
+            except bb.process.ExecutionError:
+                stdout = ''
+            for line in stdout.splitlines():
+                if line.startswith('*'):
+                    (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=args.srctree)
+                    initial_rev = stdout.rstrip()
+            if not initial_rev:
+                # Otherwise, just grab the head revision
+                (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree)
+                initial_rev = stdout.rstrip()
 
     # Check that recipe isn't using a shared workdir
     s = rd.getVar('S', True)