[oe-commits] Paul Eggleton : devtool: update-recipe: check if source tree is a git repository

git at git.openembedded.org git at git.openembedded.org
Sun Jun 28 08:46:39 UTC 2015


Module: openembedded-core.git
Branch: fido
Commit: c5dc3e819c1bb224e3cb667381faa5abf1888362
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=c5dc3e819c1bb224e3cb667381faa5abf1888362

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Mon Apr 27 10:53:21 2015 +0100

devtool: update-recipe: check if source tree is a git repository

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 at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/lib/devtool/standard.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 0142fe0..6b53781 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -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



More information about the Openembedded-commits mailing list