From 1d20fc44ea74696a85bd86e42a1f1a11f474fb55 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Wed, 19 Mar 2014 17:39:25 +0000 Subject: bitbake: toaster: select recipe based on PN name When saving task stats, if there were multiple tasks executed based on the same recipe file, we might have saved the stats to the wrong task by selecting another recipe. This patch takes the PN into account to properly select the file stats. A check is also made to make sure we don't fail saving data due to interrupted builds. (Bitbake rev: e855031410daf2b99a6ca40b70956fe67c96f71c) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/buildinfohelper.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'bitbake/lib/bb') diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 30c9b92395..71b2ff508a 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -678,20 +678,18 @@ class BuildInfoHelper(object): def store_tasks_stats(self, event): - for (taskfile, taskname, taskstats) in event.data: + for (taskfile, taskname, taskstats, recipename) in event.data: localfilepath = taskfile.split(":")[-1] assert localfilepath.startswith("/") recipe_information = self._get_recipe_information_from_taskfile(taskfile) - try: - recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True) - except NotExisting: - recipe = Recipe.objects.get(layer_version = recipe_information['layer_version'], - file_path__endswith = recipe_information['file_path']) + recipe_object = Recipe.objects.get(layer_version = recipe_information['layer_version'], + file_path__endswith = recipe_information['file_path'], + name = recipename) task_information = {} task_information['build'] = self.internal_state['build'] - task_information['recipe'] = recipe + task_information['recipe'] = recipe_object task_information['task_name'] = taskname task_information['cpu_usage'] = taskstats['cpu_usage'] task_information['disk_io'] = taskstats['disk_io'] @@ -756,11 +754,15 @@ class BuildInfoHelper(object): # for all image targets for target in self.internal_state['targets']: if target.is_image: - pkgdata = event.data['pkgdata'] - imgdata = event.data['imgdata'][target.target] - self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes']) - filedata = event.data['filedata'][target.target] - self.orm_wrapper.save_target_file_information(self.internal_state['build'], target, filedata) + try: + pkgdata = event.data['pkgdata'] + imgdata = event.data['imgdata'][target.target] + self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes']) + filedata = event.data['filedata'][target.target] + self.orm_wrapper.save_target_file_information(self.internal_state['build'], target, filedata) + except KeyError: + # we must have not got the data for this image, nothing to save + pass -- cgit v1.2.3-54-g00ecf