bitbake: toaster: buildinfohelper Detect command line builds

When we're building using toaster as just a listener to bitbake
(analysis mode) we need to handle the case where the toaster configuration data
isn't present so we don't need to try and update the existing information.

(Bitbake rev: a22faae2c3a5948356ce3cbc73c34509de65d370)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood 2015-10-14 10:09:12 +01:00 committed by Richard Purdie
parent 596c219bf4
commit ae82d778e6
1 changed files with 22 additions and 12 deletions

View File

@ -298,9 +298,13 @@ class ORMWrapper(object):
break break
# If we're in analysis mode then we are wholly responsible for the data
if created and must_exist: # and therefore we return the 'real' recipe rather than the build
raise NotExisting("Recipe object created when expected to exist", recipe_information) # history copy of the recipe.
if recipe_information['layer_version'].build is not None and \
recipe_information['layer_version'].build.project == \
Project.objects.get_default_project():
return recipe
return built_recipe return built_recipe
@ -333,14 +337,20 @@ class ORMWrapper(object):
assert 'priority' in layer_version_information assert 'priority' in layer_version_information
assert 'local_path' in layer_version_information assert 'local_path' in layer_version_information
# If we're doing a command line build then associate this new layer with the
# project to avoid it 'contaminating' toaster data
project = None
if build_obj.project == Project.objects.get_default_project():
project = build_obj.project
layer_version_object, _ = Layer_Version.objects.get_or_create( layer_version_object, _ = Layer_Version.objects.get_or_create(
build = build_obj, build = build_obj,
layer = layer_obj, layer = layer_obj,
branch = layer_version_information['branch'], branch = layer_version_information['branch'],
commit = layer_version_information['commit'], commit = layer_version_information['commit'],
priority = layer_version_information['priority'], priority = layer_version_information['priority'],
local_path = layer_version_information['local_path'], local_path = layer_version_information['local_path'],
) project=project)
self.layer_version_objects.append(layer_version_object) self.layer_version_objects.append(layer_version_object)
@ -845,7 +855,7 @@ class BuildInfoHelper(object):
logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects) logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects)
#mockup the new layer #mockup the new layer
unknown_layer, _ = Layer.objects.get_or_create(name="__FIXME__unidentified_layer", layer_index_url="") unknown_layer, _ = Layer.objects.get_or_create(name="Unidentified layer", layer_index_url="")
unknown_layer_version_obj, _ = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build']) unknown_layer_version_obj, _ = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build'])
# append it so we don't run into this error again and again # append it so we don't run into this error again and again
@ -1067,7 +1077,7 @@ class BuildInfoHelper(object):
task_information['disk_io'] = taskstats['disk_io'] task_information['disk_io'] = taskstats['disk_io']
if 'elapsed_time' in taskstats: if 'elapsed_time' in taskstats:
task_information['elapsed_time'] = taskstats['elapsed_time'] task_information['elapsed_time'] = taskstats['elapsed_time']
self.orm_wrapper.get_update_task_object(task_information, True) # must exist self.orm_wrapper.get_update_task_object(task_information)
def update_and_store_task(self, event): def update_and_store_task(self, event):
assert 'taskfile' in vars(event) assert 'taskfile' in vars(event)