aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/rootfs.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-06-08 11:10:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-11 23:55:36 +0100
commit8dfdd329f0137cab8cab97e1d0c1181810fe5b32 (patch)
tree78977dc1400f81e4309d884bcf8c3a58f0653b38 /meta/lib/oe/rootfs.py
parenta938f2117989b596c50d9d7f3929dd3c0f893d08 (diff)
downloadopenembedded-core-contrib-8dfdd329f0137cab8cab97e1d0c1181810fe5b32.tar.gz
lib/oe/rootfs: tidy up log warning reporting
* bb.warn() should only be called once per warning - UIs such as Toaster assume that this is the case, so adjust the output accordingly. (It's tricky here because we have to include "log_check" on every line or we'll end up looping forever as the log checking code's own messages retrigger the log check, sigh...) * Iterating over a file already splits by line, there's no need to do it manually. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r--meta/lib/oe/rootfs.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 5f1f7b3e5d..48e5754b27 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -44,15 +44,14 @@ class Rootfs(object):
r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)')
log_path = self.d.expand("${T}/log.do_rootfs")
with open(log_path, 'r') as log:
- for line in log.read().split('\n'):
+ for line in log:
if 'log_check' in line or 'NOTE:' in line:
continue
m = r.search(line)
if m:
- bb.warn('log_check: There is a warn message in the logfile')
- bb.warn('log_check: Matched keyword: [%s]' % m.group())
- bb.warn('log_check: %s\n' % line)
+ bb.warn('[log_check] %s: found a warning message in the logfile (keyword \'%s\'):\n[log_check] %s'
+ % (self.d.getVar('PN', True), m.group(), line))
def _log_check_error(self):
r = re.compile(self.log_check_regex)
@@ -60,15 +59,15 @@ class Rootfs(object):
with open(log_path, 'r') as log:
found_error = 0
message = "\n"
- for line in log.read().split('\n'):
+ for line in log:
if 'log_check' in line:
continue
m = r.search(line)
if m:
found_error = 1
- bb.warn('log_check: There were error messages in the logfile')
- bb.warn('log_check: Matched keyword: [%s]\n\n' % m.group())
+ bb.warn('[log_check] %s: found an error message in the logfile (keyword \'%s\'):\n[log_check] %s'
+ % (self.d.getVar('PN', True), m.group(), line))
if found_error >= 1 and found_error <= 5:
message += line + '\n'