summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-11-01 15:58:28 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-04 09:36:21 +0000
commitf04a32162d6e3d31cf199bd8544e770e25655ed3 (patch)
tree9478cfd590b1b5e692db528b19cf9536e1e825d2
parentd870d3e38a980019715df00dcfc6cec8c99eaddb (diff)
downloadpoky-f04a32162d6e3d31cf199bd8544e770e25655ed3.tar.gz
bitbake: toaster: fixes for null values from events
Some of the data values may come of as None through the event system, and the UI would encounter a problem saving the Configuration. It would be trying to save these values as NULL in the database, which is not allowed. This patch adds more verification for data coming through the event system. Other minor updates: * update for the event model from toaster.bbclass * minor code flow fix in the event system (Bitbake rev: 03fafd086381723c6486522873671515824e49f2) 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.py40
-rw-r--r--bitbake/lib/bb/ui/toasterui.py3
2 files changed, 19 insertions, 24 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index fbb2620fda..5881d136c2 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -171,7 +171,7 @@ class ORMWrapper(object):
171 return log_object.save() 171 return log_object.save()
172 172
173 173
174 def save_build_package_information(self, build_obj, package_info, recipes, files): 174 def save_build_package_information(self, build_obj, package_info, recipes):
175 # create and save the object 175 # create and save the object
176 bp_object = Build_Package.objects.create( build = build_obj, 176 bp_object = Build_Package.objects.create( build = build_obj,
177 recipe = recipes[package_info['PN']], 177 recipe = recipes[package_info['PN']],
@@ -185,35 +185,33 @@ class ORMWrapper(object):
185 license = package_info['LICENSE'], 185 license = package_info['LICENSE'],
186 ) 186 )
187 # save any attached file information 187 # save any attached file information
188 if bp_object.name in files.keys(): 188 for path in package_info['FILES_INFO']:
189 for path, size in files[bp_object.name]:
190 fo = Build_File.objects.create( bpackage = bp_object, 189 fo = Build_File.objects.create( bpackage = bp_object,
191 path = path, 190 path = path,
192 size = size ) 191 size = package_info['FILES_INFO'][path] )
193 del files[bp_object.name]
194 192
195 # save soft dependency information 193 # save soft dependency information
196 if package_info['RDEPENDS']: 194 if 'RDEPENDS' in package_info and package_info['RDEPENDS']:
197 for p in bb.utils.explode_deps(package_info['RDEPENDS']): 195 for p in bb.utils.explode_deps(package_info['RDEPENDS']):
198 Build_Package_Dependency.objects.get_or_create( package = bp_object, 196 Build_Package_Dependency.objects.get_or_create( package = bp_object,
199 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RDEPENDS) 197 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RDEPENDS)
200 if package_info['RPROVIDES']: 198 if 'RPROVIDES' in package_info and package_info['RPROVIDES']:
201 for p in bb.utils.explode_deps(package_info['RPROVIDES']): 199 for p in bb.utils.explode_deps(package_info['RPROVIDES']):
202 Build_Package_Dependency.objects.get_or_create( package = bp_object, 200 Build_Package_Dependency.objects.get_or_create( package = bp_object,
203 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RPROVIDES) 201 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RPROVIDES)
204 if package_info['RRECOMMENDS']: 202 if 'RRECOMMENDS' in package_info and package_info['RRECOMMENDS']:
205 for p in bb.utils.explode_deps(package_info['RRECOMMENDS']): 203 for p in bb.utils.explode_deps(package_info['RRECOMMENDS']):
206 Build_Package_Dependency.objects.get_or_create( package = bp_object, 204 Build_Package_Dependency.objects.get_or_create( package = bp_object,
207 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RRECOMMENDS) 205 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RRECOMMENDS)
208 if package_info['RSUGGESTS']: 206 if 'RSUGGESTS' in package_info and package_info['RSUGGESTS']:
209 for p in bb.utils.explode_deps(package_info['RSUGGESTS']): 207 for p in bb.utils.explode_deps(package_info['RSUGGESTS']):
210 Build_Package_Dependency.objects.get_or_create( package = bp_object, 208 Build_Package_Dependency.objects.get_or_create( package = bp_object,
211 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RSUGGESTS) 209 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RSUGGESTS)
212 if package_info['RREPLACES']: 210 if 'RREPLACES' in package_info and package_info['RREPLACES']:
213 for p in bb.utils.explode_deps(package_info['RREPLACES']): 211 for p in bb.utils.explode_deps(package_info['RREPLACES']):
214 Build_Package_Dependency.objects.get_or_create( package = bp_object, 212 Build_Package_Dependency.objects.get_or_create( package = bp_object,
215 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RREPLACES) 213 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RREPLACES)
216 if package_info['RCONFLICTS']: 214 if 'RCONFLICTS' in package_info and package_info['RCONFLICTS']:
217 for p in bb.utils.explode_deps(package_info['RCONFLICTS']): 215 for p in bb.utils.explode_deps(package_info['RCONFLICTS']):
218 Build_Package_Dependency.objects.get_or_create( package = bp_object, 216 Build_Package_Dependency.objects.get_or_create( package = bp_object,
219 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RCONFLICTS) 217 depends_on = p, dep_type = Build_Package_Dependency.TYPE_RCONFLICTS)
@@ -223,10 +221,16 @@ class ORMWrapper(object):
223 def save_build_variables(self, build_obj, vardump): 221 def save_build_variables(self, build_obj, vardump):
224 for k in vardump: 222 for k in vardump:
225 if not bool(vardump[k]['func']): 223 if not bool(vardump[k]['func']):
224 value = vardump[k]['v'];
225 if value is None:
226 value = ''
227 desc = vardump[k]['doc'];
228 if desc is None:
229 desc = ''
226 Variable.objects.create( build = build_obj, 230 Variable.objects.create( build = build_obj,
227 variable_name = k, 231 variable_name = k,
228 variable_value = vardump[k]['v'], 232 variable_value = value,
229 description = vardump[k]['doc']) 233 description = desc)
230 234
231 235
232class BuildInfoHelper(object): 236class BuildInfoHelper(object):
@@ -668,15 +672,7 @@ class BuildInfoHelper(object):
668 self.orm_wrapper.save_build_package_information(self.internal_state['build'], 672 self.orm_wrapper.save_build_package_information(self.internal_state['build'],
669 package_info, 673 package_info,
670 self.internal_state['recipes'], 674 self.internal_state['recipes'],
671 self.internal_state['package_files']) 675 )
672
673
674 def store_package_file_information(self, event):
675 if not 'package_files' in self.internal_state.keys():
676 self.internal_state['package_files'] = {}
677
678 data = event.data
679 self.internal_state['package_files'][data['PKG']] = data['FILES']
680 676
681 def _store_log_information(self, level, text): 677 def _store_log_information(self, level, text):
682 log_information = {} 678 log_information = {}
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index ab87092e63..6c5b1529df 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -140,6 +140,7 @@ def main(server, eventHandler, params ):
140 logfile = event.logfile 140 logfile = event.logfile
141 if logfile and os.path.exists(logfile): 141 if logfile and os.path.exists(logfile):
142 bb.error("Logfile of failure stored in: %s" % logfile) 142 bb.error("Logfile of failure stored in: %s" % logfile)
143 continue
143 144
144 # these events are unprocessed now, but may be used in the future to log 145 # these events are unprocessed now, but may be used in the future to log
145 # timing and error informations from the parsing phase in Toaster 146 # timing and error informations from the parsing phase in Toaster
@@ -230,8 +231,6 @@ def main(server, eventHandler, params ):
230 if isinstance(event, bb.event.MetadataEvent): 231 if isinstance(event, bb.event.MetadataEvent):
231 if event.type == "SinglePackageInfo": 232 if event.type == "SinglePackageInfo":
232 buildinfohelper.store_build_package_information(event) 233 buildinfohelper.store_build_package_information(event)
233 elif event.type == "PackageFileSize":
234 buildinfohelper.store_package_file_information(event)
235 continue 234 continue
236 235
237 # ignore 236 # ignore