diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2016-05-19 00:28:15 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-19 22:32:07 +0100 |
commit | e3e8d500e25788db54ea96b080e73fd325d1d414 (patch) | |
tree | 91907809f8fa61a36499c55dafa24a7e19b9f18d | |
parent | a653f36814fca438db834509f99ad37e74719d45 (diff) | |
download | poky-e3e8d500e25788db54ea96b080e73fd325d1d414.tar.gz |
rootfs.py: Use one way to exclude lines in _log_check_error()
Before there were three different ways to exclude a line from being
searched for error messages in _log_check_error(). Now there is only
one: an array of regular expressions. This should make it easy to add
more excludes if nedded.
(From OE-Core rev: 321df88088fbfa657b61b2bae32751f03daec46f)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/rootfs.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index a92aa22103..63ca22f311 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -54,26 +54,25 @@ class Rootfs(object): | |||
54 | % (self.d.getVar('PN', True), m.group(), line)) | 54 | % (self.d.getVar('PN', True), m.group(), line)) |
55 | 55 | ||
56 | def _log_check_error(self): | 56 | def _log_check_error(self): |
57 | # Ignore any lines containing log_check to avoid recursion, and ignore | ||
58 | # lines beginning with a + since sh -x may emit code which isn't | ||
59 | # actually executed, but may contain error messages | ||
60 | excludes = [ 'log_check', r'^\+' ] | ||
61 | if hasattr(self, 'log_check_expected_errors_regexes'): | ||
62 | excludes.extend(self.log_check_expected_errors_regexes) | ||
63 | excludes = [re.compile(x) for x in excludes] | ||
57 | r = re.compile(self.log_check_regex) | 64 | r = re.compile(self.log_check_regex) |
58 | log_path = self.d.expand("${T}/log.do_rootfs") | 65 | log_path = self.d.expand("${T}/log.do_rootfs") |
59 | with open(log_path, 'r') as log: | 66 | with open(log_path, 'r') as log: |
60 | found_error = 0 | 67 | found_error = 0 |
61 | message = "\n" | 68 | message = "\n" |
62 | for line in log: | 69 | for line in log: |
63 | if 'log_check' in line: | 70 | for ee in excludes: |
64 | continue | 71 | m = ee.search(line) |
65 | # sh -x may emit code which isn't actually executed | ||
66 | if line.startswith('+'): | ||
67 | continue | ||
68 | |||
69 | if hasattr(self, 'log_check_expected_errors_regexes'): | ||
70 | m = None | ||
71 | for ee in self.log_check_expected_errors_regexes: | ||
72 | m = re.search(ee, line) | ||
73 | if m: | ||
74 | break | ||
75 | if m: | 72 | if m: |
76 | continue | 73 | break |
74 | if m: | ||
75 | continue | ||
77 | 76 | ||
78 | m = r.search(line) | 77 | m = r.search(line) |
79 | if m: | 78 | if m: |