diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-04-27 10:53:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-27 15:05:40 +0100 |
commit | eb2147aa8facd4ef33a0749e9ae660ec686dad48 (patch) | |
tree | b38a51dc632c2dff2a614acfd4f315b601fb95cf /scripts/lib | |
parent | 3332d68ef7b2a300ce8dcf5021497d98e5b17baa (diff) | |
download | openembedded-core-eb2147aa8facd4ef33a0749e9ae660ec686dad48.tar.gz openembedded-core-eb2147aa8facd4ef33a0749e9ae660ec686dad48.tar.bz2 openembedded-core-eb2147aa8facd4ef33a0749e9ae660ec686dad48.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/devtool/standard.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index a64211211b..94b5e0bdd1 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -477,13 +477,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 |