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 <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN 2014-03-19 17:39:25 +00:00 committed by Richard Purdie
parent a6c3cb705d
commit 1d20fc44ea
1 changed files with 14 additions and 12 deletions

View File

@ -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