diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-12-13 11:05:06 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-14 12:30:49 +0000 |
commit | af867199a5df1b0416f1d1b91427c028d4fa2efd (patch) | |
tree | 0479b53fba336e606893ef84e79e725d32dd73ab /meta/lib | |
parent | 13916a4fab0b428ae6b51e6863921eac14821368 (diff) | |
download | poky-af867199a5df1b0416f1d1b91427c028d4fa2efd.tar.gz |
classes/image: suppress log_check mechanism for warnings/errors logged through BitBake
If you printed a warning through bb.warn() / bbwarn or an error through
bb.error() / bberror, this was also being picked up by our log_check
mechanism that was designed to pick up warnings and errors printed by
other programs used during do_rootfs. This meant you saw not only the
warning or error itself, you saw it a second time through log_check,
which is a bit ugly. Use the just-added BB_TASK_LOGGER to access the
logger and add a handler that we can use to find out if any warning or
error we find in the logs is one we should ignore as it has already been
printed.
Fixes [YOCTO #8223].
(From OE-Core rev: fb37304d27857df3c53c0867e81fbc8899b48089)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/rootfs.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index ed40b23ee4..74fc3bd256 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -15,12 +15,13 @@ class Rootfs(object, metaclass=ABCMeta): | |||
15 | This is an abstract class. Do not instantiate this directly. | 15 | This is an abstract class. Do not instantiate this directly. |
16 | """ | 16 | """ |
17 | 17 | ||
18 | def __init__(self, d, progress_reporter=None): | 18 | def __init__(self, d, progress_reporter=None, logcatcher=None): |
19 | self.d = d | 19 | self.d = d |
20 | self.pm = None | 20 | self.pm = None |
21 | self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True) | 21 | self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True) |
22 | self.deploydir = self.d.getVar('IMGDEPLOYDIR', True) | 22 | self.deploydir = self.d.getVar('IMGDEPLOYDIR', True) |
23 | self.progress_reporter = progress_reporter | 23 | self.progress_reporter = progress_reporter |
24 | self.logcatcher = logcatcher | ||
24 | 25 | ||
25 | self.install_order = Manifest.INSTALL_ORDER | 26 | self.install_order = Manifest.INSTALL_ORDER |
26 | 27 | ||
@@ -53,6 +54,8 @@ class Rootfs(object, metaclass=ABCMeta): | |||
53 | messages = [] | 54 | messages = [] |
54 | with open(log_path, 'r') as log: | 55 | with open(log_path, 'r') as log: |
55 | for line in log: | 56 | for line in log: |
57 | if self.logcatcher and self.logcatcher.contains(line.rstrip()): | ||
58 | continue | ||
56 | for ee in excludes: | 59 | for ee in excludes: |
57 | m = ee.search(line) | 60 | m = ee.search(line) |
58 | if m: | 61 | if m: |
@@ -375,8 +378,8 @@ class Rootfs(object, metaclass=ABCMeta): | |||
375 | 378 | ||
376 | 379 | ||
377 | class RpmRootfs(Rootfs): | 380 | class RpmRootfs(Rootfs): |
378 | def __init__(self, d, manifest_dir, progress_reporter=None): | 381 | def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): |
379 | super(RpmRootfs, self).__init__(d, progress_reporter) | 382 | super(RpmRootfs, self).__init__(d, progress_reporter, logcatcher) |
380 | self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ | 383 | self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ |
381 | '|exit 1|ERROR: |Error: |Error |ERROR '\ | 384 | '|exit 1|ERROR: |Error: |Error |ERROR '\ |
382 | '|Failed |Failed: |Failed$|Failed\(\d+\):)' | 385 | '|Failed |Failed: |Failed$|Failed\(\d+\):)' |
@@ -530,8 +533,8 @@ class RpmRootfs(Rootfs): | |||
530 | bb.utils.remove(self.pm.install_dir_path, True) | 533 | bb.utils.remove(self.pm.install_dir_path, True) |
531 | 534 | ||
532 | class DpkgOpkgRootfs(Rootfs): | 535 | class DpkgOpkgRootfs(Rootfs): |
533 | def __init__(self, d, progress_reporter=None): | 536 | def __init__(self, d, progress_reporter=None, logcatcher=None): |
534 | super(DpkgOpkgRootfs, self).__init__(d, progress_reporter) | 537 | super(DpkgOpkgRootfs, self).__init__(d, progress_reporter, logcatcher) |
535 | 538 | ||
536 | def _get_pkgs_postinsts(self, status_file): | 539 | def _get_pkgs_postinsts(self, status_file): |
537 | def _get_pkg_depends_list(pkg_depends): | 540 | def _get_pkg_depends_list(pkg_depends): |
@@ -625,8 +628,8 @@ class DpkgOpkgRootfs(Rootfs): | |||
625 | num += 1 | 628 | num += 1 |
626 | 629 | ||
627 | class DpkgRootfs(DpkgOpkgRootfs): | 630 | class DpkgRootfs(DpkgOpkgRootfs): |
628 | def __init__(self, d, manifest_dir, progress_reporter=None): | 631 | def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): |
629 | super(DpkgRootfs, self).__init__(d, progress_reporter) | 632 | super(DpkgRootfs, self).__init__(d, progress_reporter, logcatcher) |
630 | self.log_check_regex = '^E:' | 633 | self.log_check_regex = '^E:' |
631 | self.log_check_expected_regexes = \ | 634 | self.log_check_expected_regexes = \ |
632 | [ | 635 | [ |
@@ -717,8 +720,8 @@ class DpkgRootfs(DpkgOpkgRootfs): | |||
717 | 720 | ||
718 | 721 | ||
719 | class OpkgRootfs(DpkgOpkgRootfs): | 722 | class OpkgRootfs(DpkgOpkgRootfs): |
720 | def __init__(self, d, manifest_dir, progress_reporter=None): | 723 | def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None): |
721 | super(OpkgRootfs, self).__init__(d, progress_reporter) | 724 | super(OpkgRootfs, self).__init__(d, progress_reporter, logcatcher) |
722 | self.log_check_regex = '(exit 1|Collected errors)' | 725 | self.log_check_regex = '(exit 1|Collected errors)' |
723 | 726 | ||
724 | self.manifest = OpkgManifest(d, manifest_dir) | 727 | self.manifest = OpkgManifest(d, manifest_dir) |
@@ -994,16 +997,16 @@ def variable_depends(d, manifest_dir=None): | |||
994 | cls = get_class_for_type(img_type) | 997 | cls = get_class_for_type(img_type) |
995 | return cls._depends_list() | 998 | return cls._depends_list() |
996 | 999 | ||
997 | def create_rootfs(d, manifest_dir=None, progress_reporter=None): | 1000 | def create_rootfs(d, manifest_dir=None, progress_reporter=None, logcatcher=None): |
998 | env_bkp = os.environ.copy() | 1001 | env_bkp = os.environ.copy() |
999 | 1002 | ||
1000 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 1003 | img_type = d.getVar('IMAGE_PKGTYPE', True) |
1001 | if img_type == "rpm": | 1004 | if img_type == "rpm": |
1002 | RpmRootfs(d, manifest_dir, progress_reporter).create() | 1005 | RpmRootfs(d, manifest_dir, progress_reporter, logcatcher).create() |
1003 | elif img_type == "ipk": | 1006 | elif img_type == "ipk": |
1004 | OpkgRootfs(d, manifest_dir, progress_reporter).create() | 1007 | OpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create() |
1005 | elif img_type == "deb": | 1008 | elif img_type == "deb": |
1006 | DpkgRootfs(d, manifest_dir, progress_reporter).create() | 1009 | DpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create() |
1007 | 1010 | ||
1008 | os.environ.clear() | 1011 | os.environ.clear() |
1009 | os.environ.update(env_bkp) | 1012 | os.environ.update(env_bkp) |