From 46b119eb62a5a612fe4c0847862d34f408e556f7 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Mon, 28 Sep 2015 21:45:31 -0700 Subject: Revert "bitbake: toaster: don't re-create Target objects" This delete followed up the foreign keys and deleted things that were not expected to be deleted. This reverts commit 08000eb27eb8413686fb2c8daf14d234a8bff83a. Signed-off-by: Michael Wood Signed-off-by: brian avery Signed-off-by: Richard Purdie --- lib/bb/ui/buildinfohelper.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py index e036ef6d..9fdde29e 100644 --- a/lib/bb/ui/buildinfohelper.py +++ b/lib/bb/ui/buildinfohelper.py @@ -162,6 +162,8 @@ class ORMWrapper(object): build.bitbake_version=build_info['bitbake_version'] build.save() + Target.objects.filter(build = build).delete() + else: build = Build.objects.create( project = prj, @@ -182,6 +184,19 @@ class ORMWrapper(object): return build + def create_target_objects(self, target_info): + assert 'build' in target_info + assert 'targets' in target_info + + targets = [] + for tgt_name in target_info['targets']: + tgt_object = Target.objects.create( build = target_info['build'], + target = tgt_name, + is_image = False, + ) + targets.append(tgt_object) + return targets + def update_build_object(self, build, errors, warnings, taskfailures): assert isinstance(build,Build) assert isinstance(errors, int) @@ -911,7 +926,7 @@ class BuildInfoHelper(object): target_information['targets'] = event._pkgs target_information['build'] = build_obj - self.internal_state['targets'] = Target.objects.filter(build=target_information['build']) + self.internal_state['targets'] = self.orm_wrapper.create_target_objects(target_information) # Save build configuration data = self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0] -- cgit v1.2.3