summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2014-03-12 18:47:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-14 07:18:46 -0700
commit839f30486e82710b54deaa979bf69390013ec8b6 (patch)
treefa8b05426616274e4467f8776ae27fb33d196a1b
parenta3eb7da31c998ae202717a91917954e98cbf8eb8 (diff)
downloadpoky-839f30486e82710b54deaa979bf69390013ec8b6.tar.gz
bitbake: toaster: populate target image file table
Using ImageFileSize Metadata event, the image output file and its size are populated into target_image_file table. [YOCTO #5189] [YOCTO #5228] (Bitbake rev: a0b06d362b9aa08fda293489467af343c6ca6de4) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py13
-rw-r--r--bitbake/lib/bb/ui/toasterui.py2
-rw-r--r--bitbake/lib/toaster/bldviewer/api.py1
-rw-r--r--bitbake/lib/toaster/bldviewer/views.py3
4 files changed, 18 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index f9b067fab9..1b17c1f6e3 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -26,6 +26,7 @@ os.environ.setdefault("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 28from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage
29from toaster.orm.models import Target_Image_File
29from toaster.orm.models import Variable, VariableHistory 30from toaster.orm.models import Variable, VariableHistory
30from 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
31from toaster.orm.models import Task_Dependency, Package_Dependency 32from toaster.orm.models import Task_Dependency, Package_Dependency
@@ -344,6 +345,11 @@ class ORMWrapper(object):
344 if (len(errormsg) > 0): 345 if (len(errormsg) > 0):
345 raise Exception(errormsg) 346 raise Exception(errormsg)
346 347
348 def save_target_image_file_information(self, target_obj, file_name, file_size):
349 target_image_file = Target_Image_File.objects.create( target = target_obj,
350 file_name = file_name,
351 file_size = file_size)
352 target_image_file.save()
347 353
348 def create_logmessage(self, log_information): 354 def create_logmessage(self, log_information):
349 assert 'build' in log_information 355 assert 'build' in log_information
@@ -598,6 +604,13 @@ class BuildInfoHelper(object):
598 # Save build configuration 604 # Save build configuration
599 self.orm_wrapper.save_build_variables(build_obj, self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0]) 605 self.orm_wrapper.save_build_variables(build_obj, self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0])
600 606
607 def update_target_image_file(self, event):
608 for t in self.internal_state['targets']:
609 if t.is_image == True:
610 output_files = list(event.data.viewkeys())
611 for output in output_files:
612 if t.target in output:
613 self.orm_wrapper.save_target_image_file_information(t, output, event.data[output])
601 614
602 def update_build_information(self, event, errors, warnings, taskfailures): 615 def update_build_information(self, event, errors, warnings, taskfailures):
603 if 'build' in self.internal_state: 616 if 'build' in self.internal_state:
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index e469d93e82..04e0f99342 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -241,6 +241,8 @@ def main(server, eventHandler, params ):
241 buildinfohelper.store_tasks_stats(event) 241 buildinfohelper.store_tasks_stats(event)
242 if event.type == "ImagePkgList": 242 if event.type == "ImagePkgList":
243 buildinfohelper.store_target_package_data(event) 243 buildinfohelper.store_target_package_data(event)
244 elif event.type == "ImageFileSize":
245 buildinfohelper.update_target_image_file(event)
244 continue 246 continue
245 247
246 # ignore 248 # ignore
diff --git a/bitbake/lib/toaster/bldviewer/api.py b/bitbake/lib/toaster/bldviewer/api.py
index 654864e1e8..76d45c7d2c 100644
--- a/bitbake/lib/toaster/bldviewer/api.py
+++ b/bitbake/lib/toaster/bldviewer/api.py
@@ -25,6 +25,7 @@ from django.conf.urls import patterns, include, url
25urlpatterns = patterns('bldviewer.views', 25urlpatterns = patterns('bldviewer.views',
26 url(r'^builds$', 'model_explorer', {'model_name':'build'}, name='builds'), 26 url(r'^builds$', 'model_explorer', {'model_name':'build'}, name='builds'),
27 url(r'^targets$', 'model_explorer', {'model_name':'target'}, name='targets'), 27 url(r'^targets$', 'model_explorer', {'model_name':'target'}, name='targets'),
28 url(r'^target_image_file$', 'model_explorer', {'model_name':'target_image_file'}, name='target_image_file'),
28 url(r'^tasks$', 'model_explorer', {'model_name':'task'}, name='task'), 29 url(r'^tasks$', 'model_explorer', {'model_name':'task'}, name='task'),
29 url(r'^task_dependencies$', 'model_explorer', {'model_name':'task_dependency'}, name='task_dependencies'), 30 url(r'^task_dependencies$', 'model_explorer', {'model_name':'task_dependency'}, name='task_dependencies'),
30 url(r'^packages$', 'model_explorer', {'model_name':'package'}, name='package'), 31 url(r'^packages$', 'model_explorer', {'model_name':'package'}, name='package'),
diff --git a/bitbake/lib/toaster/bldviewer/views.py b/bitbake/lib/toaster/bldviewer/views.py
index 435bc8e6bd..6f863796db 100644
--- a/bitbake/lib/toaster/bldviewer/views.py
+++ b/bitbake/lib/toaster/bldviewer/views.py
@@ -25,7 +25,7 @@ from django.db.models import Q
25from django.shortcuts import render 25from django.shortcuts import render
26from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable, Target_Installed_Package 26from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable, Target_Installed_Package
27from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency 27from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
28from orm.models import Target_Installed_Package, VariableHistory 28from orm.models import Target_Installed_Package, VariableHistory, Target_Image_File
29from django.views.decorators.cache import cache_control 29from django.views.decorators.cache import cache_control
30from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger 30from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
31 31
@@ -159,6 +159,7 @@ def model_explorer(request, model_name):
159 model_mapping = { 159 model_mapping = {
160 'build': Build, 160 'build': Build,
161 'target': Target, 161 'target': Target,
162 'target_image_file': Target_Image_File,
162 'task': Task, 163 'task': Task,
163 'task_dependency': Task_Dependency, 164 'task_dependency': Task_Dependency,
164 'package': Package, 165 'package': Package,