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:31:34 +0100 |
commit | 321df88088fbfa657b61b2bae32751f03daec46f (patch) | |
tree | 590dfcaed51cf136401ba20aa8f3e06f4b5de22c /meta/lib | |
parent | 865ab39f18a52ed84217df56d0e65113e2894d02 (diff) | |
download | openembedded-core-321df88088fbfa657b61b2bae32751f03daec46f.tar.gz openembedded-core-321df88088fbfa657b61b2bae32751f03daec46f.tar.bz2 openembedded-core-321df88088fbfa657b61b2bae32751f03daec46f.zip |
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.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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): % (self.d.getVar('PN', True), m.group(), line)) def _log_check_error(self): + # Ignore any lines containing log_check to avoid recursion, and ignore + # lines beginning with a + since sh -x may emit code which isn't + # actually executed, but may contain error messages + excludes = [ 'log_check', r'^\+' ] + if hasattr(self, 'log_check_expected_errors_regexes'): + excludes.extend(self.log_check_expected_errors_regexes) + excludes = [re.compile(x) for x in excludes] r = re.compile(self.log_check_regex) log_path = self.d.expand("${T}/log.do_rootfs") with open(log_path, 'r') as log: found_error = 0 message = "\n" for line in log: - if 'log_check' in line: - continue - # sh -x may emit code which isn't actually executed - if line.startswith('+'): - continue - - if hasattr(self, 'log_check_expected_errors_regexes'): - m = None - for ee in self.log_check_expected_errors_regexes: - m = re.search(ee, line) - if m: - break + for ee in excludes: + m = ee.search(line) if m: - continue + break + if m: + continue m = r.search(line) if m: |