summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-10-15 15:45:13 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-16 14:13:22 +0100
commit93f0b61749155ba600f38dff5604a68da548c486 (patch)
treea38fc2e85a104f2b3b4b1665b0e5251563547c2d
parent069a611097265c0100582dfb69dfdddbc08a31fc (diff)
downloadpoky-93f0b61749155ba600f38dff5604a68da548c486.tar.gz
bitbake: toaster: Record critical errors
Critical errors (where a build failed for reasons of misconfiguration, such as a machine being specified which is not in a project's layers) were being ignored (only log records up to ERROR level were being logged to Toaster's db). This meant that the build would fail but would not correctly report why. Add support for CRITICAL error levels to the LogMessage model, include errors at this level in the errors property for a build, and show errors at this level in the build dashboard. [YOCTO #8320] (Bitbake rev: b6eacbca9cacb607de864ab7d093deb296da8226) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py5
-rw-r--r--bitbake/lib/bb/ui/toasterui.py2
-rw-r--r--bitbake/lib/toaster/orm/models.py20
-rw-r--r--bitbake/lib/toaster/toastergui/templates/builddashboard.html11
4 files changed, 25 insertions, 13 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index a8c884de37..286fb6a74b 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -1394,7 +1394,9 @@ class BuildInfoHelper(object):
1394 1394
1395 log_information = {} 1395 log_information = {}
1396 log_information['build'] = self.internal_state['build'] 1396 log_information['build'] = self.internal_state['build']
1397 if event.levelno == formatter.ERROR: 1397 if event.levelno == formatter.CRITICAL:
1398 log_information['level'] = LogMessage.CRITICAL
1399 elif event.levelno == formatter.ERROR:
1398 log_information['level'] = LogMessage.ERROR 1400 log_information['level'] = LogMessage.ERROR
1399 elif event.levelno == formatter.WARNING: 1401 elif event.levelno == formatter.WARNING:
1400 log_information['level'] = LogMessage.WARNING 1402 log_information['level'] = LogMessage.WARNING
@@ -1407,6 +1409,7 @@ class BuildInfoHelper(object):
1407 log_information['pathname'] = event.pathname 1409 log_information['pathname'] = event.pathname
1408 log_information['lineno'] = event.lineno 1410 log_information['lineno'] = event.lineno
1409 logger.info("Logging error 2: %s", log_information) 1411 logger.info("Logging error 2: %s", log_information)
1412
1410 self.orm_wrapper.create_logmessage(log_information) 1413 self.orm_wrapper.create_logmessage(log_information)
1411 1414
1412 def close(self, errorcode): 1415 def close(self, errorcode):
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index dbe0d0980a..0ed774ee7b 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -145,10 +145,12 @@ def main(server, eventHandler, params ):
145 event.levelno = formatter.ERROR 145 event.levelno = formatter.ERROR
146 146
147 buildinfohelper.store_log_event(event) 147 buildinfohelper.store_log_event(event)
148
148 if event.levelno >= formatter.ERROR: 149 if event.levelno >= formatter.ERROR:
149 errors = errors + 1 150 errors = errors + 1
150 elif event.levelno == formatter.WARNING: 151 elif event.levelno == formatter.WARNING:
151 warnings = warnings + 1 152 warnings = warnings + 1
153
152 # For "normal" logging conditions, don't show note logs from tasks 154 # For "normal" logging conditions, don't show note logs from tasks
153 # but do show them if the user has changed the default log level to 155 # but do show them if the user has changed the default log level to
154 # include verbose/debug messages 156 # include verbose/debug messages
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 44a453a58c..6ca45e0997 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -353,7 +353,9 @@ class Build(models.Model):
353 353
354 @property 354 @property
355 def errors(self): 355 def errors(self):
356 return (self.logmessage_set.filter(level=LogMessage.ERROR)|self.logmessage_set.filter(level=LogMessage.EXCEPTION)) 356 return (self.logmessage_set.filter(level=LogMessage.ERROR) |
357 self.logmessage_set.filter(level=LogMessage.EXCEPTION) |
358 self.logmessage_set.filter(level=LogMessage.CRITICAL))
357 359
358 @property 360 @property
359 def warnings(self): 361 def warnings(self):
@@ -1285,16 +1287,20 @@ class LogMessage(models.Model):
1285 INFO = 0 1287 INFO = 0
1286 WARNING = 1 1288 WARNING = 1
1287 ERROR = 2 1289 ERROR = 2
1288 1290 CRITICAL = 3
1289 LOG_LEVEL = ( (INFO, "info"), 1291
1290 (WARNING, "warn"), 1292 LOG_LEVEL = (
1291 (ERROR, "error"), 1293 (INFO, "info"),
1292 (EXCEPTION, "toaster exception")) 1294 (WARNING, "warn"),
1295 (ERROR, "error"),
1296 (CRITICAL, "critical"),
1297 (EXCEPTION, "toaster exception")
1298 )
1293 1299
1294 build = models.ForeignKey(Build) 1300 build = models.ForeignKey(Build)
1295 task = models.ForeignKey(Task, blank = True, null=True) 1301 task = models.ForeignKey(Task, blank = True, null=True)
1296 level = models.IntegerField(choices=LOG_LEVEL, default=INFO) 1302 level = models.IntegerField(choices=LOG_LEVEL, default=INFO)
1297 message=models.CharField(max_length=240) 1303 message = models.CharField(max_length=240)
1298 pathname = models.FilePathField(max_length=255, blank=True) 1304 pathname = models.FilePathField(max_length=255, blank=True)
1299 lineno = models.IntegerField(null=True) 1305 lineno = models.IntegerField(null=True)
1300 1306
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
index aa991348b8..fc6cae6f29 100644
--- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html
+++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
@@ -69,11 +69,12 @@
69 <div class="accordion-body collapse in" id="collapse-errors"> 69 <div class="accordion-body collapse in" id="collapse-errors">
70 <div class="accordion-inner"> 70 <div class="accordion-inner">
71 <div class="span10"> 71 <div class="span10">
72 {% for error in logmessages %}{% if error.level == 2 %} 72 {% for error in logmessages %}
73 <div class="alert alert-error"> 73 {% if error.level == 2 or error.level == 3 %}
74 <pre>{{error.message}}</pre> 74 <div class="alert alert-error">
75 </div> 75 <pre>{{error.message}}</pre>
76 {% endif %} 76 </div>
77 {% endif %}
77 {% endfor %} 78 {% endfor %}
78 </div> 79 </div>
79 </div> 80 </div>