diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-01-20 09:39:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-18 10:24:06 +0000 |
commit | d086fa3aed34a05d52e73c255ca22379149a64a1 (patch) | |
tree | c55f38b6b86b513c0d4b47a01fed47c9db1cb163 /bitbake/lib/bb | |
parent | f99f2cdd69f1015953a7e9ab07af46dd63e50ad4 (diff) | |
download | poky-d086fa3aed34a05d52e73c255ca22379149a64a1.tar.gz |
bitbake: toasterui: add extra debug and development infos
We update and add logs throughout the code in order to help
with development. The extra logging is turned off by default,
but it can be enabled by using environment variables.
All logging happens through the Python logging facilities.
The toaster UI will save a log of all incoming events if the
TOASTER_EVENTLOG variable is set.
If TOASTER_SQLDEBUG is set all DB queries will be logged.
If TOASTER_DEVEL is set and the django-fresh module is available,
the module is enabled to allow auto-reload of pages when the
source is changed.
(Bitbake rev: 10c27450601b4d24bbb273bd0e053498807d1060)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 19 |
2 files changed, 20 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 6f4f56870a..533f4cef3b 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -33,6 +33,11 @@ from toaster.orm.models import Task_Dependency, Package_Dependency | |||
33 | from toaster.orm.models import Recipe_Dependency | 33 | from toaster.orm.models import Recipe_Dependency |
34 | from bb.msg import BBLogFormatter as format | 34 | from bb.msg import BBLogFormatter as format |
35 | from django.db import models | 35 | from django.db import models |
36 | import logging | ||
37 | |||
38 | |||
39 | logger = logging.getLogger("BitBake") | ||
40 | |||
36 | 41 | ||
37 | class NotExisting(Exception): | 42 | class NotExisting(Exception): |
38 | pass | 43 | pass |
@@ -115,7 +120,9 @@ class ORMWrapper(object): | |||
115 | build_name=build_info['build_name'], | 120 | build_name=build_info['build_name'], |
116 | bitbake_version=build_info['bitbake_version']) | 121 | bitbake_version=build_info['bitbake_version']) |
117 | 122 | ||
123 | logger.debug(1, "buildinfohelper: build is created %s" % build) | ||
118 | if brbe is not None: | 124 | if brbe is not None: |
125 | logger.debug(1, "buildinfohelper: brbe is %s" % brbe) | ||
119 | from bldcontrol.models import BuildEnvironment, BuildRequest | 126 | from bldcontrol.models import BuildEnvironment, BuildRequest |
120 | br, be = brbe.split(":") | 127 | br, be = brbe.split(":") |
121 | 128 | ||
@@ -605,6 +612,7 @@ class BuildInfoHelper(object): | |||
605 | self.has_build_history = has_build_history | 612 | self.has_build_history = has_build_history |
606 | self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0] | 613 | self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0] |
607 | self.brbe = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0] | 614 | self.brbe = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0] |
615 | logger.debug(1, "buildinfohelper: Build info helper inited %s" % vars(self)) | ||
608 | 616 | ||
609 | 617 | ||
610 | def _configure_django(self): | 618 | def _configure_django(self): |
@@ -1110,10 +1118,10 @@ class BuildInfoHelper(object): | |||
1110 | if 'build' in self.internal_state and 'backlog' in self.internal_state: | 1118 | if 'build' in self.internal_state and 'backlog' in self.internal_state: |
1111 | if len(self.internal_state['backlog']): | 1119 | if len(self.internal_state['backlog']): |
1112 | tempevent = self.internal_state['backlog'].pop() | 1120 | tempevent = self.internal_state['backlog'].pop() |
1113 | print "DEBUG: Saving stored event ", tempevent | 1121 | logger.debug(1, "buildinfohelper: Saving stored event %s " % tempevent) |
1114 | self.store_log_event(tempevent) | 1122 | self.store_log_event(tempevent) |
1115 | else: | 1123 | else: |
1116 | print "ERROR: Events not saved: \n", self.internal_state['backlog'] | 1124 | logger.error("buildinfohelper: Events not saved: %s" % self.internal_state['backlog']) |
1117 | del self.internal_state['backlog'] | 1125 | del self.internal_state['backlog'] |
1118 | 1126 | ||
1119 | log_information = {} | 1127 | log_information = {} |
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 9aff489c1d..7a316be57c 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
@@ -62,15 +62,6 @@ def _log_settings_from_server(server): | |||
62 | 62 | ||
63 | def main(server, eventHandler, params ): | 63 | def main(server, eventHandler, params ): |
64 | 64 | ||
65 | includelogs, loglines = _log_settings_from_server(server) | ||
66 | |||
67 | # verify and warn | ||
68 | build_history_enabled = True | ||
69 | inheritlist, error = server.runCommand(["getVariable", "INHERIT"]) | ||
70 | if not "buildhistory" in inheritlist.split(" "): | ||
71 | logger.warn("buildhistory is not enabled. Please enable INHERIT += \"buildhistory\" to see image details.") | ||
72 | build_history_enabled = False | ||
73 | |||
74 | helper = uihelper.BBUIHelper() | 65 | helper = uihelper.BBUIHelper() |
75 | 66 | ||
76 | console = logging.StreamHandler(sys.stdout) | 67 | console = logging.StreamHandler(sys.stdout) |
@@ -80,6 +71,16 @@ def main(server, eventHandler, params ): | |||
80 | console.setFormatter(format) | 71 | console.setFormatter(format) |
81 | logger.addHandler(console) | 72 | logger.addHandler(console) |
82 | 73 | ||
74 | includelogs, loglines = _log_settings_from_server(server) | ||
75 | |||
76 | # verify and warn | ||
77 | build_history_enabled = True | ||
78 | inheritlist, error = server.runCommand(["getVariable", "INHERIT"]) | ||
79 | |||
80 | if not "buildhistory" in inheritlist.split(" "): | ||
81 | logger.warn("buildhistory is not enabled. Please enable INHERIT += \"buildhistory\" to see image details.") | ||
82 | build_history_enabled = False | ||
83 | |||
83 | if not params.observe_only: | 84 | if not params.observe_only: |
84 | logger.error("ToasterUI can only work in observer mode") | 85 | logger.error("ToasterUI can only work in observer mode") |
85 | return | 86 | return |