]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: update-recipe: check if source tree is a git repository
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 27 Apr 2015 09:53:21 +0000 (10:53 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 28 Jun 2015 08:41:59 +0000 (09:41 +0100)
If you've done "devtool add" (or "devtool modify" without -x) then it's
possible that the external source tree is not a git repository, so we
should handle that case here instead of printing a traceback.

(From OE-Core master rev: eb2147aa8facd4ef33a0749e9ae660ec686dad48)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/standard.py

index 0142fe0d622e100cac0db90431faf8fe529b1069..6b5378176ea900bd186e5c9061eca6528ee7252a 100644 (file)
@@ -470,13 +470,19 @@ def update_recipe(args, config, basepath, workspace):
         return updated
 
     srctree = workspace[args.recipename]
-    if mode == 'srcrev':
+
+    # Get HEAD revision
+    try:
         (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
-        srcrev = stdout.strip()
-        if len(srcrev) != 40:
-            logger.error('Invalid hash returned by git: %s' % stdout)
-            return 1
+    except bb.process.ExecutionError as err:
+        print('Failed to get HEAD revision in %s: %s' % (srctree, err))
+        return 1
+    srcrev = stdout.strip()
+    if len(srcrev) != 40:
+        logger.error('Invalid hash returned by git: %s' % stdout)
+        return 1
 
+    if mode == 'srcrev':
         logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile))
         patchfields = {}
         patchfields['SRCREV'] = srcrev