diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-04-06 17:46:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-06 23:10:30 +0100 |
commit | acb94078c4aa917417c3f77f9f92a7d6ffa068ff (patch) | |
tree | 18b03973bc0e525c188d6cc3c69fe07ad8fe35df | |
parent | 52c8740e1be75f8817f47d0769728920c80e52b4 (diff) | |
download | poky-acb94078c4aa917417c3f77f9f92a7d6ffa068ff.tar.gz |
bitbake: buildinfohelper: fix KeyError
When bitbake doesn't need to build anything it still sends
ImagePkgList event with empty 'pkgdata', 'imgdata' and 'filedata'
fields. This causes crash in buildinfohelper code as it's assumed
that above mentioned fields always have data keyed by build target:
ERROR: u'core-image-minimal'
Traceback (most recent call last):
File "toasterui.py", line 423, in main
buildinfohelper.store_target_package_data(event)
File "buildinfohelper.py", line 1218, in store_target_package_data
imgdata = BuildInfoHelper._get_data_from_event(event)['imgdata'][target.target]
KeyError: u'core-image-minimal'
Fixed this by using dict.get method with empty dictionary as default
return value instead of trying to get value without checking if target
key is in the data.
(Bitbake rev: c39cc463e6d9594bf2c5ac8bb74e834f6f2cf7c8)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 37a3fcb9c7..9cb2c54067 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -1231,8 +1231,8 @@ class BuildInfoHelper(object): | |||
1231 | for target in self.internal_state['targets']: | 1231 | for target in self.internal_state['targets']: |
1232 | if target.is_image: | 1232 | if target.is_image: |
1233 | pkgdata = BuildInfoHelper._get_data_from_event(event)['pkgdata'] | 1233 | pkgdata = BuildInfoHelper._get_data_from_event(event)['pkgdata'] |
1234 | imgdata = BuildInfoHelper._get_data_from_event(event)['imgdata'][target.target] | 1234 | imgdata = BuildInfoHelper._get_data_from_event(event)['imgdata'].get(target.target, {}) |
1235 | filedata = BuildInfoHelper._get_data_from_event(event)['filedata'][target.target] | 1235 | filedata = BuildInfoHelper._get_data_from_event(event)['filedata'].get(target.target, {}) |
1236 | 1236 | ||
1237 | try: | 1237 | try: |
1238 | self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes'], built_package=True) | 1238 | self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes'], built_package=True) |