aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-01-16 09:58:25 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2017-01-16 13:08:18 +1300
commita5a3c47b694a661566b5fe64d5e7723365c26c92 (patch)
treea894109a73f80b007adc97d0c5e94692ac873f2a
parent15748efcc18e0576dd9bee2acd8f35814f568c2d (diff)
downloadopenembedded-core-contrib-a5a3c47b694a661566b5fe64d5e7723365c26c92.tar.gz
openembedded-core-contrib-a5a3c47b694a661566b5fe64d5e7723365c26c92.tar.bz2
openembedded-core-contrib-a5a3c47b694a661566b5fe64d5e7723365c26c92.zip
Fix layerconfparser lifetime handling
* Setting of the object has to be before the try: or otherwise the finally block can get called if that doesn't succeed with the result that the layerconfparser object won't have a value, which will trigger an exception * We shouldn't be using the config_data object after shutting down tinfoil, so avoid doing that Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xlayerindex/tools/import_layer.py8
-rwxr-xr-xlayerindex/update.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/layerindex/tools/import_layer.py b/layerindex/tools/import_layer.py
index 377a0f099d..6e90a29bb1 100755
--- a/layerindex/tools/import_layer.py
+++ b/layerindex/tools/import_layer.py
@@ -375,14 +375,14 @@ def main():
layerdep.layerbranch = layerbranch
layerdep.dependency = core_layer
layerdep.save()
+ layerconfparser = LayerConfParse(logger=logger)
try:
- layerconfparser = LayerConfParse(logger=logger)
config_data = layerconfparser.parse_layer(layerbranch, layerdir)
+ if config_data:
+ utils.add_dependencies(layerbranch, config_data, logger=logger)
+ utils.add_recommends(layerbranch, config_data, logger=logger)
finally:
layerconfparser.shutdown()
- if config_data:
- utils.add_dependencies(layerbranch, config_data, logger=logger)
- utils.add_recommends(layerbranch, config_data, logger=logger)
# Get some extra meta-information
readme_files = glob.glob(os.path.join(layerdir, 'README*'))
diff --git a/layerindex/update.py b/layerindex/update.py
index 3a4df2f1e1..9529371c21 100755
--- a/layerindex/update.py
+++ b/layerindex/update.py
@@ -266,8 +266,8 @@ def main():
# dependencies that may have been missed. Note that creating the
# dependencies is a best-effort and continues if they are not found.
for branch in branches:
+ layerconfparser = LayerConfParse(logger=logger, bitbakepath=bitbakepath)
try:
- layerconfparser = LayerConfParse(logger=logger, bitbakepath=bitbakepath)
for layer in layerquery:
layerbranch = layer.get_layerbranch(branch)