summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-07-04 12:17:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-14 14:10:03 +0100
commit1dcdd877c7946be4c0b1203deb14e2f842f9d0c2 (patch)
tree71ca889b0ba58f59ee59f52270c09a78c821dfc7 /bitbake/lib
parente7fa0c325d59811c272b7dad671225fea8c29609 (diff)
downloadpoky-1dcdd877c7946be4c0b1203deb14e2f842f9d0c2.tar.gz
bitbake: toasterui: fix build - project identification
This patches fixes the build - project identification when running under managed mode. The build is assigned to the project from which it was triggered, and to the build request, as to simplify relationships queries in the database. (Bitbake rev: af1d3373706d365f9138caec110fcb20a5966b7b) 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.py17
-rw-r--r--bitbake/lib/bb/ui/toasterui.py7
2 files changed, 18 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 77be7c744c..29cfc81ce1 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -46,7 +46,7 @@ class ORMWrapper(object):
46 pass 46 pass
47 47
48 48
49 def create_build_object(self, build_info): 49 def create_build_object(self, build_info, brbe):
50 assert 'machine' in build_info 50 assert 'machine' in build_info
51 assert 'distro' in build_info 51 assert 'distro' in build_info
52 assert 'distro_version' in build_info 52 assert 'distro_version' in build_info
@@ -65,6 +65,13 @@ class ORMWrapper(object):
65 build_name=build_info['build_name'], 65 build_name=build_info['build_name'],
66 bitbake_version=build_info['bitbake_version']) 66 bitbake_version=build_info['bitbake_version'])
67 67
68 if brbe is not None:
69 from bldcontrol.models import BuildEnvironment, BuildRequest
70 br, be = brbe.split(":")
71 buildrequest = BuildRequest.objects.get(pk = br)
72 build.project = buildrequest.project
73 build.save()
74
68 return build 75 return build
69 76
70 def create_target_objects(self, target_info): 77 def create_target_objects(self, target_info):
@@ -600,7 +607,10 @@ class BuildInfoHelper(object):
600 assert '_pkgs' in vars(event) 607 assert '_pkgs' in vars(event)
601 build_information = self._get_build_information() 608 build_information = self._get_build_information()
602 609
603 build_obj = self.orm_wrapper.create_build_object(build_information) 610 brbe = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0]
611
612 build_obj = self.orm_wrapper.create_build_object(build_information, brbe)
613
604 self.internal_state['build'] = build_obj 614 self.internal_state['build'] = build_obj
605 615
606 # save layer version information for this build 616 # save layer version information for this build
@@ -619,6 +629,9 @@ class BuildInfoHelper(object):
619 # Save build configuration 629 # Save build configuration
620 self.orm_wrapper.save_build_variables(build_obj, self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0]) 630 self.orm_wrapper.save_build_variables(build_obj, self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0])
621 631
632 return brbe
633
634
622 def update_target_image_file(self, event): 635 def update_target_image_file(self, event):
623 image_fstypes = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"])[0] 636 image_fstypes = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"])[0]
624 for t in self.internal_state['targets']: 637 for t in self.internal_state['targets']:
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 5f87a9d963..2f628e9a72 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -94,7 +94,7 @@ def main(server, eventHandler, params ):
94 first = True 94 first = True
95 95
96 buildinfohelper = BuildInfoHelper(server, build_history_enabled) 96 buildinfohelper = BuildInfoHelper(server, build_history_enabled)
97 97 brbe = None
98 98
99 while True: 99 while True:
100 try: 100 try:
@@ -111,7 +111,7 @@ def main(server, eventHandler, params ):
111 helper.eventHandler(event) 111 helper.eventHandler(event)
112 112
113 if isinstance(event, bb.event.BuildStarted): 113 if isinstance(event, bb.event.BuildStarted):
114 buildinfohelper.store_started_build(event) 114 brbe = buildinfohelper.store_started_build(event)
115 115
116 if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)): 116 if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):
117 buildinfohelper.update_and_store_task(event) 117 buildinfohelper.update_and_store_task(event)
@@ -231,10 +231,9 @@ def main(server, eventHandler, params ):
231 buildinfohelper.update_build_information(event, errors, warnings, taskfailures) 231 buildinfohelper.update_build_information(event, errors, warnings, taskfailures)
232 232
233 233
234 brbe = server.runCommand(["getVariable", "TOASTER_BRBE"])[0]
235 br_id, be_id = brbe.split(":")
236 # we start a new build info 234 # we start a new build info
237 if brbe is not None: 235 if brbe is not None:
236 br_id, be_id = brbe.split(":")
238 buildinfohelper.store_build_done(br_id, be_id) 237 buildinfohelper.store_build_done(br_id, be_id)
239 238
240 print "we are under BuildEnvironment management - after the build, we exit" 239 print "we are under BuildEnvironment management - after the build, we exit"