summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-12-05 15:14:20 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-18 10:24:06 +0000
commitf99f2cdd69f1015953a7e9ab07af46dd63e50ad4 (patch)
treef7f13e4ef5e92f6158d405887da187ad07b5f7ec /bitbake/lib/bb/ui
parentc467bbd841d6ef2caae7fb2693456c50584d23ec (diff)
downloadpoky-f99f2cdd69f1015953a7e9ab07af46dd63e50ad4.tar.gz
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 <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py26
-rw-r--r--bitbake/lib/bb/ui/toasterui.py4
2 files changed, 24 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 9aa8fe319f..6f4f56870a 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"
26 26
27import toaster.toastermain.settings as toaster_django_settings 27import toaster.toastermain.settings as toaster_django_settings
28from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText 28from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText
29from toaster.orm.models import Target_Image_File 29from toaster.orm.models import Target_Image_File, BuildArtifact
30from toaster.orm.models import Variable, VariableHistory 30from toaster.orm.models import Variable, VariableHistory
31from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File 31from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File
32from toaster.orm.models import Task_Dependency, Package_Dependency 32from toaster.orm.models import Task_Dependency, Package_Dependency
@@ -156,8 +156,7 @@ class ORMWrapper(object):
156 build.outcome = outcome 156 build.outcome = outcome
157 build.save() 157 build.save()
158 158
159 def update_target_object(self, target, license_manifest_path): 159 def update_target_set_license_manifest(self, target, license_manifest_path):
160
161 target.license_manifest_path = license_manifest_path 160 target.license_manifest_path = license_manifest_path
162 target.save() 161 target.save()
163 162
@@ -447,7 +446,17 @@ class ORMWrapper(object):
447 target_image_file = Target_Image_File.objects.create( target = target_obj, 446 target_image_file = Target_Image_File.objects.create( target = target_obj,
448 file_name = file_name, 447 file_name = file_name,
449 file_size = file_size) 448 file_size = file_size)
450 target_image_file.save() 449
450 def save_artifact_information(self, build_obj, file_name, file_size):
451 # we skip the image files from other builds
452 if Target_Image_File.objects.filter(file_name = file_name).count() > 0:
453 return
454
455 # do not update artifacts found in other builds
456 if BuildArtifact.objects.filter(file_name = file_name).count() > 0:
457 return
458
459 BuildArtifact.objects.create(build = build_obj, file_name = file_name, file_size = file_size)
451 460
452 def create_logmessage(self, log_information): 461 def create_logmessage(self, log_information):
453 assert 'build' in log_information 462 assert 'build' in log_information
@@ -752,6 +761,11 @@ class BuildInfoHelper(object):
752 if t.target in output and output.split('.rootfs.')[1] in image_fstypes: 761 if t.target in output and output.split('.rootfs.')[1] in image_fstypes:
753 self.orm_wrapper.save_target_image_file_information(t, output, evdata[output]) 762 self.orm_wrapper.save_target_image_file_information(t, output, evdata[output])
754 763
764 def update_artifact_image_file(self, event):
765 evdata = BuildInfoHelper._get_data_from_event(event)
766 for artifact_path in evdata.keys():
767 self.orm_wrapper.save_artifact_information(self.internal_state['build'], artifact_path, evdata[artifact_path])
768
755 def update_build_information(self, event, errors, warnings, taskfailures): 769 def update_build_information(self, event, errors, warnings, taskfailures):
756 if 'build' in self.internal_state: 770 if 'build' in self.internal_state:
757 self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures) 771 self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures)
@@ -760,10 +774,10 @@ class BuildInfoHelper(object):
760 def store_license_manifest_path(self, event): 774 def store_license_manifest_path(self, event):
761 deploy_dir = BuildInfoHelper._get_data_from_event(event)['deploy_dir'] 775 deploy_dir = BuildInfoHelper._get_data_from_event(event)['deploy_dir']
762 image_name = BuildInfoHelper._get_data_from_event(event)['image_name'] 776 image_name = BuildInfoHelper._get_data_from_event(event)['image_name']
763 path = deploy_dir + "/licenses/" + image_name + "/" 777 path = deploy_dir + "/licenses/" + image_name + "/license.manifest"
764 for target in self.internal_state['targets']: 778 for target in self.internal_state['targets']:
765 if target.target in image_name: 779 if target.target in image_name:
766 self.orm_wrapper.update_target_object(target, path) 780 self.orm_wrapper.update_target_set_license_manifest(target, path)
767 781
768 782
769 def store_started_task(self, event): 783 def store_started_task(self, event):
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 3a6104bcab..9aff489c1d 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -261,8 +261,12 @@ def main(server, eventHandler, params ):
261 buildinfohelper.store_missed_state_tasks(event) 261 buildinfohelper.store_missed_state_tasks(event)
262 elif event.type == "ImageFileSize": 262 elif event.type == "ImageFileSize":
263 buildinfohelper.update_target_image_file(event) 263 buildinfohelper.update_target_image_file(event)
264 elif event.type == "ArtifactFileSize":
265 buildinfohelper.update_artifact_image_file(event)
264 elif event.type == "LicenseManifestPath": 266 elif event.type == "LicenseManifestPath":
265 buildinfohelper.store_license_manifest_path(event) 267 buildinfohelper.store_license_manifest_path(event)
268 else:
269 logger.error("Unprocessed MetadataEvent %s " % str(event))
266 continue 270 continue
267 271
268 if isinstance(event, bb.cooker.CookerExit): 272 if isinstance(event, bb.cooker.CookerExit):