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-06-28 09:44:14 +0100 |
commit | f64d73f8c458b0bf1d3a585e92e1e37965af7aa1 (patch) | |
tree | c206bc6b2ec9f3e245c173d7b7fa5553b35fc4c7 /scripts/lib/devtool | |
parent | f1d3b5f1859f0bf411ed05e0695c813b3ed96305 (diff) | |
download | poky-f64d73f8c458b0bf1d3a585e92e1e37965af7aa1.tar.gz |
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)
(From OE-Core rev: c5dc3e819c1bb224e3cb667381faa5abf1888362)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-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 0142fe0d62..6b5378176e 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -470,13 +470,19 @@ def update_recipe(args, config, basepath, workspace): | |||
470 | return updated | 470 | return updated |
471 | 471 | ||
472 | srctree = workspace[args.recipename] | 472 | srctree = workspace[args.recipename] |
473 | if mode == 'srcrev': | 473 | |
474 | # Get HEAD revision | ||
475 | try: | ||
474 | (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) | 476 | (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) |
475 | srcrev = stdout.strip() | 477 | except bb.process.ExecutionError as err: |
476 | if len(srcrev) != 40: | 478 | print('Failed to get HEAD revision in %s: %s' % (srctree, err)) |
477 | logger.error('Invalid hash returned by git: %s' % stdout) | 479 | return 1 |
478 | return 1 | 480 | srcrev = stdout.strip() |
481 | if len(srcrev) != 40: | ||
482 | logger.error('Invalid hash returned by git: %s' % stdout) | ||
483 | return 1 | ||
479 | 484 | ||
485 | if mode == 'srcrev': | ||
480 | logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) | 486 | logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) |
481 | patchfields = {} | 487 | patchfields = {} |
482 | patchfields['SRCREV'] = srcrev | 488 | patchfields['SRCREV'] = srcrev |