summaryrefslogtreecommitdiffstats
path: root/meta
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:59:09 +0100
commit0090170e77baa2a2e9888f5d4b076ddca879d06b (patch)
treee5caf1da865be57bc1411faee14b8cbb5f2f75a9 /meta
parent63e62599a6af469c1705c9272cd280b54d5b7144 (diff)
downloadpoky-0090170e77baa2a2e9888f5d4b076ddca879d06b.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. (From OE-Core rev: 8dfdd329f0137cab8cab97e1d0c1181810fe5b32) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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):
44 r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)') 44 r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)')
45 log_path = self.d.expand("${T}/log.do_rootfs") 45 log_path = self.d.expand("${T}/log.do_rootfs")
46 with open(log_path, 'r') as log: 46 with open(log_path, 'r') as log:
47 for line in log.read().split('\n'): 47 for line in log:
48 if 'log_check' in line or 'NOTE:' in line: 48 if 'log_check' in line or 'NOTE:' in line:
49 continue 49 continue
50 50
51 m = r.search(line) 51 m = r.search(line)
52 if m: 52 if m:
53 bb.warn('log_check: There is a warn message in the logfile') 53 bb.warn('[log_check] %s: found a warning message in the logfile (keyword \'%s\'):\n[log_check] %s'
54 bb.warn('log_check: Matched keyword: [%s]' % m.group()) 54 % (self.d.getVar('PN', True), m.group(), line))
55 bb.warn('log_check: %s\n' % line)
56 55
57 def _log_check_error(self): 56 def _log_check_error(self):
58 r = re.compile(self.log_check_regex) 57 r = re.compile(self.log_check_regex)
@@ -60,15 +59,15 @@ class Rootfs(object):
60 with open(log_path, 'r') as log: 59 with open(log_path, 'r') as log:
61 found_error = 0 60 found_error = 0
62 message = "\n" 61 message = "\n"
63 for line in log.read().split('\n'): 62 for line in log:
64 if 'log_check' in line: 63 if 'log_check' in line:
65 continue 64 continue
66 65
67 m = r.search(line) 66 m = r.search(line)
68 if m: 67 if m:
69 found_error = 1 68 found_error = 1
70 bb.warn('log_check: There were error messages in the logfile') 69 bb.warn('[log_check] %s: found an error message in the logfile (keyword \'%s\'):\n[log_check] %s'
71 bb.warn('log_check: Matched keyword: [%s]\n\n' % m.group()) 70 % (self.d.getVar('PN', True), m.group(), line))
72 71
73 if found_error >= 1 and found_error <= 5: 72 if found_error >= 1 and found_error <= 5:
74 message += line + '\n' 73 message += line + '\n'