diff options
| -rw-r--r-- | meta/lib/oe/rootfs.py | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 479e4ccc5e..f5c465fbd2 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
| @@ -40,7 +40,7 @@ class Rootfs(object): | |||
| 40 | def _log_check(self): | 40 | def _log_check(self): |
| 41 | pass | 41 | pass |
| 42 | 42 | ||
| 43 | def _log_check_warn(self): | 43 | def _log_check_common(self, type, match): |
| 44 | # Ignore any lines containing log_check to avoid recursion, and ignore | 44 | # Ignore any lines containing log_check to avoid recursion, and ignore |
| 45 | # lines beginning with a + since sh -x may emit code which isn't | 45 | # lines beginning with a + since sh -x may emit code which isn't |
| 46 | # actually executed, but may contain error messages | 46 | # actually executed, but may contain error messages |
| @@ -48,7 +48,7 @@ class Rootfs(object): | |||
| 48 | if hasattr(self, 'log_check_expected_regexes'): | 48 | if hasattr(self, 'log_check_expected_regexes'): |
| 49 | excludes.extend(self.log_check_expected_regexes) | 49 | excludes.extend(self.log_check_expected_regexes) |
| 50 | excludes = [re.compile(x) for x in excludes] | 50 | excludes = [re.compile(x) for x in excludes] |
| 51 | r = re.compile('^(warn|Warn|WARNING:)') | 51 | r = re.compile(match) |
| 52 | log_path = self.d.expand("${T}/log.do_rootfs") | 52 | log_path = self.d.expand("${T}/log.do_rootfs") |
| 53 | messages = [] | 53 | messages = [] |
| 54 | with open(log_path, 'r') as log: | 54 | with open(log_path, 'r') as log: |
| @@ -65,45 +65,21 @@ class Rootfs(object): | |||
| 65 | messages.append('[log_check] %s' % line) | 65 | messages.append('[log_check] %s' % line) |
| 66 | if messages: | 66 | if messages: |
| 67 | if len(messages) == 1: | 67 | if len(messages) == 1: |
| 68 | msg = 'a warning message' | 68 | msg = '1 %s message' % type |
| 69 | else: | 69 | else: |
| 70 | msg = '%d warning messages' % len(messages) | 70 | msg = '%d %s messages' % (len(messages), type) |
| 71 | bb.warn('[log_check] %s: found %s in the logfile:\n%s' | 71 | msg = '[log_check] %s: found %s in the logfile:\n%s' % \ |
| 72 | % (self.d.getVar('PN', True), msg, ''.join(messages))) | 72 | (self.d.getVar('PN', True), msg, ''.join(messages)) |
| 73 | 73 | if type == 'error': | |
| 74 | def _log_check_error(self): | 74 | bb.fatal(msg) |
| 75 | # Ignore any lines containing log_check to avoid recursion, and ignore | 75 | else: |
| 76 | # lines beginning with a + since sh -x may emit code which isn't | 76 | bb.warn(msg) |
| 77 | # actually executed, but may contain error messages | ||
| 78 | excludes = [ 'log_check', r'^\+' ] | ||
| 79 | if hasattr(self, 'log_check_expected_regexes'): | ||
| 80 | excludes.extend(self.log_check_expected_regexes) | ||
| 81 | excludes = [re.compile(x) for x in excludes] | ||
| 82 | r = re.compile(self.log_check_regex) | ||
| 83 | log_path = self.d.expand("${T}/log.do_rootfs") | ||
| 84 | with open(log_path, 'r') as log: | ||
| 85 | found_error = 0 | ||
| 86 | message = "\n" | ||
| 87 | for line in log: | ||
| 88 | for ee in excludes: | ||
| 89 | m = ee.search(line) | ||
| 90 | if m: | ||
| 91 | break | ||
| 92 | if m: | ||
| 93 | continue | ||
| 94 | |||
| 95 | m = r.search(line) | ||
| 96 | if m: | ||
| 97 | found_error = 1 | ||
| 98 | bb.warn('[log_check] %s: found an error message in the logfile (keyword \'%s\'):\n[log_check] %s' | ||
| 99 | % (self.d.getVar('PN', True), m.group(), line)) | ||
| 100 | 77 | ||
| 101 | if found_error >= 1 and found_error <= 5: | 78 | def _log_check_warn(self): |
| 102 | message += line + '\n' | 79 | self._log_check_common('warning', '^(warn|Warn|WARNING:)') |
| 103 | found_error += 1 | ||
| 104 | 80 | ||
| 105 | if found_error == 6: | 81 | def _log_check_error(self): |
| 106 | bb.fatal(message) | 82 | self._log_check_common('error', self.log_check_regex) |
| 107 | 83 | ||
| 108 | def _insert_feed_uris(self): | 84 | def _insert_feed_uris(self): |
| 109 | if bb.utils.contains("IMAGE_FEATURES", "package-management", | 85 | if bb.utils.contains("IMAGE_FEATURES", "package-management", |
