From fc75011506c2109bb060c4d0c30266603a39ac6d Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 31 Oct 2014 19:17:01 +0000 Subject: bitbake: toasterui: improvements in data reading We add improvements in data reading, following issues discovered in testing. - elapsed_time is now read from buildstats - we add safeguards to not fail logging if the build was triggered with a toaster_brbe configuration, but it's running in 1.6 mode - added log markups for build finish to let other programs known when the work is done. [YOCTO #6833] [YOCTO #6685] [YOCTO #6887] (Bitbake rev: 0b225035cefee3d3713a93f9a432e5e4d4e174f1) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/buildinfohelper.py | 22 +++++++++++++--------- bitbake/lib/bb/ui/toasterui.py | 6 ++++-- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index fcef53b63d..b5ae9e97b2 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -67,13 +67,15 @@ class ORMWrapper(object): if brbe is not None: from bldcontrol.models import BuildEnvironment, BuildRequest - br, be = brbe.split(":") - buildrequest = BuildRequest.objects.get(pk = br) - buildrequest.build = build - buildrequest.save() - build.project_id = buildrequest.project_id - build.save() - + try: + br, be = brbe.split(":") + buildrequest = BuildRequest.objects.get(pk = br) + buildrequest.build = build + buildrequest.save() + build.project_id = buildrequest.project_id + build.save() + except BuildRequest.DoesNotExist: + pass return build def create_target_objects(self, target_info): @@ -146,6 +148,8 @@ class ORMWrapper(object): if 'start_time' in task_information.keys() and 'end_time' in task_information.keys(): duration = task_information['end_time'] - task_information['start_time'] task_object.elapsed_time = duration + del task_information['start_time'] + del task_information['end_time'] task_object.save() return task_object @@ -320,8 +324,7 @@ class ORMWrapper(object): searchname = pkgpnmap[p]['OPKGN'] packagedict[p]['object'], created = Package.objects.get_or_create( build = build_obj, name = searchname ) - if created: - # package was not build in the current build, but + if True: # save the data anyway we can, not just if it was not created here; bug [YOCTO #6887] # fill in everything we can from the runtime-reverse package data try: packagedict[p]['object'].recipe = recipes[pkgpnmap[p]['PN']] @@ -717,6 +720,7 @@ class BuildInfoHelper(object): task_information['task_name'] = taskname task_information['cpu_usage'] = taskstats['cpu_usage'] task_information['disk_io'] = taskstats['disk_io'] + task_information['elapsed_time'] = taskstats['elapsed_time'] task_obj = self.orm_wrapper.get_update_task_object(task_information, True) # must exist def update_and_store_task(self, event): diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 0c53843149..007c6b6114 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py @@ -231,14 +231,16 @@ def main(server, eventHandler, params ): buildinfohelper.update_build_information(event, errors, warnings, taskfailures) buildinfohelper.close(errorcode) + # mark the log output; controllers may kill the toasterUI after seeing this log + logger.info("ToasterUI build done") # we start a new build info if buildinfohelper.brbe is not None: - print "we are under BuildEnvironment management - after the build, we exit" + logger.debug(1, "ToasterUI under BuildEnvironment management - exiting after the build") server.terminateServer() else: - print "prepared for new build" + logger.debug(1, "ToasterUI prepared for new build") errors = 0 warnings = 0 taskfailures = [] -- cgit v1.2.3-54-g00ecf