diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-10-16 10:31:12 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-27 07:24:30 +0000 |
commit | 851f0d82d9744e2eebb1f382a9963f3815b9822c (patch) | |
tree | 3210cb44c9c88d9f378448445d635f31d35dc444 /bitbake/lib | |
parent | dcd9cd0f9e117d5cc1440ddbf7582e3440d0cc66 (diff) | |
download | poky-851f0d82d9744e2eebb1f382a9963f3815b9822c.tar.gz |
bitbake: toaster: add get_or_create_targets API
Target objects are created before the build if build is
started from UI in build mode. However, in analysis mode Target
objects don't exist and need to be created using information
from bitbake events.
Added new API call get_or_create_targets to retrive existing
target objects or create them if they don't exist yet.
(Bitbake rev: ef69be31d133696bde54605f5a18da660099734c)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 286fb6a74b..2fc1a43c40 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -162,8 +162,6 @@ class ORMWrapper(object): | |||
162 | build.bitbake_version=build_info['bitbake_version'] | 162 | build.bitbake_version=build_info['bitbake_version'] |
163 | build.save() | 163 | build.save() |
164 | 164 | ||
165 | Target.objects.filter(build = build).delete() | ||
166 | |||
167 | else: | 165 | else: |
168 | build = Build.objects.create( | 166 | build = Build.objects.create( |
169 | project = prj, | 167 | project = prj, |
@@ -184,18 +182,26 @@ class ORMWrapper(object): | |||
184 | 182 | ||
185 | return build | 183 | return build |
186 | 184 | ||
187 | def create_target_objects(self, target_info): | 185 | @staticmethod |
188 | assert 'build' in target_info | 186 | def get_or_create_targets(target_info): |
189 | assert 'targets' in target_info | 187 | result = [] |
190 | 188 | for target in target_info['targets']: | |
191 | targets = [] | 189 | task = '' |
192 | for tgt_name in target_info['targets']: | 190 | if ':' in target: |
193 | tgt_object = Target.objects.create( build = target_info['build'], | 191 | target, task = target.split(':', 1) |
194 | target = tgt_name, | 192 | if task.startswith('do_'): |
195 | is_image = False, | 193 | task = task[3:] |
196 | ) | 194 | if task == 'build': |
197 | targets.append(tgt_object) | 195 | task = '' |
198 | return targets | 196 | obj, created = Target.objects.get_or_create(build=target_info['build'], |
197 | target=target) | ||
198 | if created: | ||
199 | obj.is_image = False | ||
200 | if task: | ||
201 | obj.task = task | ||
202 | obj.save() | ||
203 | result.append(obj) | ||
204 | return result | ||
199 | 205 | ||
200 | def update_build_object(self, build, errors, warnings, taskfailures): | 206 | def update_build_object(self, build, errors, warnings, taskfailures): |
201 | assert isinstance(build,Build) | 207 | assert isinstance(build,Build) |
@@ -950,7 +956,7 @@ class BuildInfoHelper(object): | |||
950 | target_information['targets'] = event._pkgs | 956 | target_information['targets'] = event._pkgs |
951 | target_information['build'] = build_obj | 957 | target_information['build'] = build_obj |
952 | 958 | ||
953 | self.internal_state['targets'] = self.orm_wrapper.create_target_objects(target_information) | 959 | self.internal_state['targets'] = self.orm_wrapper.get_or_create_targets(target_information) |
954 | 960 | ||
955 | # Save build configuration | 961 | # Save build configuration |
956 | data = self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0] | 962 | data = self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0] |