summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-26 17:09:16 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:03:00 +0000
commitaf51fb06740768a85f4840ff2f93ef0c73f46877 (patch)
treeda089effb729bec6d5817047b35ff77e44aacb24 /bitbake/lib
parentdc1be9c4380bb7ee3b4422ee0d34bfcee8082762 (diff)
downloadpoky-af51fb06740768a85f4840ff2f93ef0c73f46877.tar.gz
bitbake: toasterui: Compatibility patch for daisy and dizzy
This patch brings in changes that allow a toasterUI coming in from 'master' branch to record data from a 'daisy' or 'dizzy' bitbake server. This is needed to allow Toaster to record builds running on older branch releases. (Bitbake rev: 8d75e28e0688a6520311afce36543175f36910b3) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py43
-rw-r--r--bitbake/lib/bb/ui/toasterui.py3
2 files changed, 27 insertions, 19 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index e428e4c649..9aa8fe319f 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -695,10 +695,19 @@ class BuildInfoHelper(object):
695 695
696 ################################ 696 ################################
697 ## external available methods to store information 697 ## external available methods to store information
698 @staticmethod
699 def _get_data_from_event(event):
700 evdata = None
701 if '_localdata' in vars(event):
702 evdata = event._localdata
703 elif 'data' in vars(event):
704 evdata = event.data
705 else:
706 raise Exception("Event with neither _localdata or data properties")
707 return evdata
698 708
699 def store_layer_info(self, event): 709 def store_layer_info(self, event):
700 assert '_localdata' in vars(event) 710 layerinfos = BuildInfoHelper._get_data_from_event(event)
701 layerinfos = event._localdata
702 self.internal_state['lvs'] = {} 711 self.internal_state['lvs'] = {}
703 for layer in layerinfos: 712 for layer in layerinfos:
704 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer], self.brbe)] = layerinfos[layer]['version'] 713 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer], self.brbe)] = layerinfos[layer]['version']
@@ -732,15 +741,16 @@ class BuildInfoHelper(object):
732 return self.brbe 741 return self.brbe
733 742
734 743
735
736 def update_target_image_file(self, event): 744 def update_target_image_file(self, event):
737 image_fstypes = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"])[0] 745 image_fstypes = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"])[0]
746 evdata = BuildInfoHelper._get_data_from_event(event)
747
738 for t in self.internal_state['targets']: 748 for t in self.internal_state['targets']:
739 if t.is_image == True: 749 if t.is_image == True:
740 output_files = list(event._localdata.viewkeys()) 750 output_files = list(evdata.viewkeys())
741 for output in output_files: 751 for output in output_files:
742 if t.target in output and output.split('.rootfs.')[1] in image_fstypes: 752 if t.target in output and output.split('.rootfs.')[1] in image_fstypes:
743 self.orm_wrapper.save_target_image_file_information(t, output, event._localdata[output]) 753 self.orm_wrapper.save_target_image_file_information(t, output, evdata[output])
744 754
745 def update_build_information(self, event, errors, warnings, taskfailures): 755 def update_build_information(self, event, errors, warnings, taskfailures):
746 if 'build' in self.internal_state: 756 if 'build' in self.internal_state:
@@ -748,8 +758,8 @@ class BuildInfoHelper(object):
748 758
749 759
750 def store_license_manifest_path(self, event): 760 def store_license_manifest_path(self, event):
751 deploy_dir = event._localdata['deploy_dir'] 761 deploy_dir = BuildInfoHelper._get_data_from_event(event)['deploy_dir']
752 image_name = event._localdata['image_name'] 762 image_name = BuildInfoHelper._get_data_from_event(event)['image_name']
753 path = deploy_dir + "/licenses/" + image_name + "/" 763 path = deploy_dir + "/licenses/" + image_name + "/"
754 for target in self.internal_state['targets']: 764 for target in self.internal_state['targets']:
755 if target.target in image_name: 765 if target.target in image_name:
@@ -797,7 +807,7 @@ class BuildInfoHelper(object):
797 807
798 808
799 def store_tasks_stats(self, event): 809 def store_tasks_stats(self, event):
800 for (taskfile, taskname, taskstats, recipename) in event._localdata: 810 for (taskfile, taskname, taskstats, recipename) in BuildInfoHelper._get_data_from_event(event):
801 localfilepath = taskfile.split(":")[-1] 811 localfilepath = taskfile.split(":")[-1]
802 assert localfilepath.startswith("/") 812 assert localfilepath.startswith("/")
803 813
@@ -812,7 +822,8 @@ class BuildInfoHelper(object):
812 task_information['task_name'] = taskname 822 task_information['task_name'] = taskname
813 task_information['cpu_usage'] = taskstats['cpu_usage'] 823 task_information['cpu_usage'] = taskstats['cpu_usage']
814 task_information['disk_io'] = taskstats['disk_io'] 824 task_information['disk_io'] = taskstats['disk_io']
815 task_information['elapsed_time'] = taskstats['elapsed_time'] 825 if 'elapsed_time' in taskstats:
826 task_information['elapsed_time'] = taskstats['elapsed_time']
816 task_obj = self.orm_wrapper.get_update_task_object(task_information, True) # must exist 827 task_obj = self.orm_wrapper.get_update_task_object(task_information, True) # must exist
817 828
818 def update_and_store_task(self, event): 829 def update_and_store_task(self, event):
@@ -870,7 +881,7 @@ class BuildInfoHelper(object):
870 881
871 882
872 def store_missed_state_tasks(self, event): 883 def store_missed_state_tasks(self, event):
873 for (fn, taskname, taskhash, sstatefile) in event._localdata['missed']: 884 for (fn, taskname, taskhash, sstatefile) in BuildInfoHelper._get_data_from_event(event)['missed']:
874 885
875 identifier = fn + taskname + "_setscene" 886 identifier = fn + taskname + "_setscene"
876 recipe_information = self._get_recipe_information_from_taskfile(fn) 887 recipe_information = self._get_recipe_information_from_taskfile(fn)
@@ -888,7 +899,7 @@ class BuildInfoHelper(object):
888 899
889 self.orm_wrapper.get_update_task_object(task_information) 900 self.orm_wrapper.get_update_task_object(task_information)
890 901
891 for (fn, taskname, taskhash, sstatefile) in event._localdata['found']: 902 for (fn, taskname, taskhash, sstatefile) in BuildInfoHelper._get_data_from_event(event)['found']:
892 903
893 identifier = fn + taskname + "_setscene" 904 identifier = fn + taskname + "_setscene"
894 recipe_information = self._get_recipe_information_from_taskfile(fn) 905 recipe_information = self._get_recipe_information_from_taskfile(fn)
@@ -904,15 +915,14 @@ class BuildInfoHelper(object):
904 915
905 916
906 def store_target_package_data(self, event): 917 def store_target_package_data(self, event):
907 assert '_localdata' in vars(event)
908 # for all image targets 918 # for all image targets
909 for target in self.internal_state['targets']: 919 for target in self.internal_state['targets']:
910 if target.is_image: 920 if target.is_image:
911 try: 921 try:
912 pkgdata = event._localdata['pkgdata'] 922 pkgdata = BuildInfoHelper._get_data_from_event(event)['pkgdata']
913 imgdata = event._localdata['imgdata'][target.target] 923 imgdata = BuildInfoHelper._get_data_from_event(event)['imgdata'][target.target]
914 self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes']) 924 self.orm_wrapper.save_target_package_information(self.internal_state['build'], target, imgdata, pkgdata, self.internal_state['recipes'])
915 filedata = event._localdata['filedata'][target.target] 925 filedata = BuildInfoHelper._get_data_from_event(event)['filedata'][target.target]
916 self.orm_wrapper.save_target_file_information(self.internal_state['build'], target, filedata) 926 self.orm_wrapper.save_target_file_information(self.internal_state['build'], target, filedata)
917 except KeyError: 927 except KeyError:
918 # we must have not got the data for this image, nothing to save 928 # we must have not got the data for this image, nothing to save
@@ -1026,8 +1036,7 @@ class BuildInfoHelper(object):
1026 1036
1027 1037
1028 def store_build_package_information(self, event): 1038 def store_build_package_information(self, event):
1029 assert '_localdata' in vars(event) 1039 package_info = BuildInfoHelper._get_data_from_event(event)
1030 package_info = event._localdata
1031 self.orm_wrapper.save_build_package_information(self.internal_state['build'], 1040 self.orm_wrapper.save_build_package_information(self.internal_state['build'],
1032 package_info, 1041 package_info,
1033 self.internal_state['recipes'], 1042 self.internal_state['recipes'],
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 9bd04df1c6..3a6104bcab 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -296,10 +296,9 @@ def main(server, eventHandler, params ):
296 pass 296 pass
297 except Exception as e: 297 except Exception as e:
298 # print errors to log 298 # print errors to log
299 logger.error(e)
300 import traceback 299 import traceback
301 exception_data = traceback.format_exc() 300 exception_data = traceback.format_exc()
302 print(exception_data) 301 logger.error("%s\n%s" % (e, exception_data))
303 302
304 # save them to database, if possible; if it fails, we already logged to console. 303 # save them to database, if possible; if it fails, we already logged to console.
305 try: 304 try: