From f99f2cdd69f1015953a7e9ab07af46dd63e50ad4 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 5 Dec 2014 15:14:20 +0000 Subject: bitbake: add build artifacts table and other improvements We add a BuildArtifacts class to store data about files discovered during the build process and not stored anywhere else. Small cosmetic changes in the toasterui. Add model methods to return file path display data relative to the build environment instead of absolute file paths. [YOCTO #6834] (Bitbake rev: bbe24d912869312d561be199b2c029b0c898e049) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/buildinfohelper.py | 26 ++++++++++++++++++++------ bitbake/lib/bb/ui/toasterui.py | 4 ++++ 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'bitbake/lib/bb') diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 9aa8fe3..6f4f568 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -26,7 +26,7 @@ os.environ["DJANGO_SETTINGS_MODULE"] = "toaster.toastermain.settings" import toaster.toastermain.settings as toaster_django_settings from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText -from toaster.orm.models import Target_Image_File +from toaster.orm.models import Target_Image_File, BuildArtifact from toaster.orm.models import Variable, VariableHistory from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File from toaster.orm.models import Task_Dependency, Package_Dependency @@ -156,8 +156,7 @@ class ORMWrapper(object): build.outcome = outcome build.save() - def update_target_object(self, target, license_manifest_path): - + def update_target_set_license_manifest(self, target, license_manifest_path): target.license_manifest_path = license_manifest_path target.save() @@ -447,7 +446,17 @@ class ORMWrapper(object): target_image_file = Target_Image_File.objects.create( target = target_obj, file_name = file_name, file_size = file_size) - target_image_file.save() + + def save_artifact_information(self, build_obj, file_name, file_size): + # we skip the image files from other builds + if Target_Image_File.objects.filter(file_name = file_name).count() > 0: + return + + # do not update artifacts found in other builds + if BuildArtifact.objects.filter(file_name = file_name).count() > 0: + return + + BuildArtifact.objects.create(build = build_obj, file_name = file_name, file_size = file_size) def create_logmessage(self, log_information): assert 'build' in log_information @@ -752,6 +761,11 @@ class BuildInfoHelper(object): if t.target in output and output.split('.rootfs.')[1] in image_fstypes: self.orm_wrapper.save_target_image_file_information(t, output, evdata[output]) + def update_artifact_image_file(self, event): + evdata = BuildInfoHelper._get_data_from_event(event) + for artifact_path in evdata.keys(): + self.orm_wrapper.save_artifact_information(self.internal_state['build'], artifact_path, evdata[artifact_path]) + def update_build_information(self, event, errors, warnings, taskfailures): if 'build' in self.internal_state: self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures) @@ -760,10 +774,10 @@ class BuildInfoHelper(object): def store_license_manifest_path(self, event): deploy_dir = BuildInfoHelper._get_data_from_event(event)['deploy_dir'] image_name = BuildInfoHelper._get_data_from_event(event)['image_name'] - path = deploy_dir + "/licenses/" + image_name + "/" + path = deploy_dir + "/licenses/" + image_name + "/license.manifest" for target in self.internal_state['targets']: if target.target in image_name: - self.orm_wrapper.update_target_object(target, path) + self.orm_wrapper.update_target_set_license_manifest(target, path) def store_started_task(self, event): diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 3a6104b..9aff489 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py @@ -261,8 +261,12 @@ def main(server, eventHandler, params ): buildinfohelper.store_missed_state_tasks(event) elif event.type == "ImageFileSize": buildinfohelper.update_target_image_file(event) + elif event.type == "ArtifactFileSize": + buildinfohelper.update_artifact_image_file(event) elif event.type == "LicenseManifestPath": buildinfohelper.store_license_manifest_path(event) + else: + logger.error("Unprocessed MetadataEvent %s " % str(event)) continue if isinstance(event, bb.cooker.CookerExit): -- cgit v1.1