aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-26 11:14:48 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit000ebf4d59f6a71b8fefa9a1ec7c73240fb24714 (patch)
tree7dd283fdad5aafce155d9c134439d4f3c58faa19
parent7831eec5434d076a30e397a9562b12fbbcae8491 (diff)
downloadopenembedded-core-contrib-000ebf4d59f6a71b8fefa9a1ec7c73240fb24714.tar.gz
rrs_upstream_history: use try...finally to ensure tinfoil is shut down
We want tinfoil.shutdown() to be called even if an exception occurs. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xrrs/tools/rrs_upstream_history.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index e3f16b3463..5e0590f82c 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -173,35 +173,36 @@ if __name__=="__main__":
(tinfoil, d, recipes) = load_recipes(layerbranch, bitbakepath,
fetchdir, settings, logger, recipe_files=recipe_files)
+ try:
- if not recipes:
- tinfoil.shutdown()
- continue
+ if not recipes:
+ continue
- utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
+ utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
- for recipe_data in recipes:
- set_regexes(recipe_data)
+ for recipe_data in recipes:
+ set_regexes(recipe_data)
- history = RecipeUpstreamHistory(start_date = datetime.now())
+ history = RecipeUpstreamHistory(start_date = datetime.now())
- result = []
- for recipe_data in recipes:
- get_upstream_info(layerbranch, recipe_data, result)
+ result = []
+ for recipe_data in recipes:
+ get_upstream_info(layerbranch, recipe_data, result)
- history.end_date = datetime.now()
- history.save()
+ history.end_date = datetime.now()
+ history.save()
- for res in result:
- (recipe, ru) = res
+ for res in result:
+ (recipe, ru) = res
- ru.history = history
- ru.save()
+ ru.history = history
+ ru.save()
- logger.debug('%s: layer branch %s, pv %s, upstream (%s)' % (recipe.pn,
- str(layerbranch), recipe.pv, str(ru)))
+ logger.debug('%s: layer branch %s, pv %s, upstream (%s)' % (recipe.pn,
+ str(layerbranch), recipe.pv, str(ru)))
- tinfoil.shutdown()
+ finally:
+ tinfoil.shutdown()
if options.dry_run:
raise DryRunRollbackException
except DryRunRollbackException: