mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
13916a4fab
commit
af867199a5
@@ -208,6 +208,14 @@ PACKAGE_EXCLUDE[type] = "list"
|
|||||||
fakeroot python do_rootfs () {
|
fakeroot python do_rootfs () {
|
||||||
from oe.rootfs import create_rootfs
|
from oe.rootfs import create_rootfs
|
||||||
from oe.manifest import create_manifest
|
from oe.manifest import create_manifest
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = d.getVar('BB_TASK_LOGGER', False)
|
||||||
|
if logger:
|
||||||
|
logcatcher = bb.utils.LogCatcher()
|
||||||
|
logger.addHandler(logcatcher)
|
||||||
|
else:
|
||||||
|
logcatcher = None
|
||||||
|
|
||||||
# NOTE: if you add, remove or significantly refactor the stages of this
|
# NOTE: if you add, remove or significantly refactor the stages of this
|
||||||
# process then you should recalculate the weightings here. This is quite
|
# process then you should recalculate the weightings here. This is quite
|
||||||
@@ -255,7 +263,7 @@ fakeroot python do_rootfs () {
|
|||||||
progress_reporter.next_stage()
|
progress_reporter.next_stage()
|
||||||
|
|
||||||
# generate rootfs
|
# generate rootfs
|
||||||
create_rootfs(d, progress_reporter=progress_reporter)
|
create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
|
||||||
|
|
||||||
progress_reporter.finish()
|
progress_reporter.finish()
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-13
@@ -15,12 +15,13 @@ class Rootfs(object, metaclass=ABCMeta):
|
|||||||
This is an abstract class. Do not instantiate this directly.
|
This is an abstract class. Do not instantiate this directly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, d, progress_reporter=None):
|
def __init__(self, d, progress_reporter=None, logcatcher=None):
|
||||||
self.d = d
|
self.d = d
|
||||||
self.pm = None
|
self.pm = None
|
||||||
self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True)
|
self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True)
|
||||||
self.deploydir = self.d.getVar('IMGDEPLOYDIR', True)
|
self.deploydir = self.d.getVar('IMGDEPLOYDIR', True)
|
||||||
self.progress_reporter = progress_reporter
|
self.progress_reporter = progress_reporter
|
||||||
|
self.logcatcher = logcatcher
|
||||||
|
|
||||||
self.install_order = Manifest.INSTALL_ORDER
|
self.install_order = Manifest.INSTALL_ORDER
|
||||||
|
|
||||||
@@ -53,6 +54,8 @@ class Rootfs(object, metaclass=ABCMeta):
|
|||||||
messages = []
|
messages = []
|
||||||
with open(log_path, 'r') as log:
|
with open(log_path, 'r') as log:
|
||||||
for line in log:
|
for line in log:
|
||||||
|
if self.logcatcher and self.logcatcher.contains(line.rstrip()):
|
||||||
|
continue
|
||||||
for ee in excludes:
|
for ee in excludes:
|
||||||
m = ee.search(line)
|
m = ee.search(line)
|
||||||
if m:
|
if m:
|
||||||
@@ -375,8 +378,8 @@ class Rootfs(object, metaclass=ABCMeta):
|
|||||||
|
|
||||||
|
|
||||||
class RpmRootfs(Rootfs):
|
class RpmRootfs(Rootfs):
|
||||||
def __init__(self, d, manifest_dir, progress_reporter=None):
|
def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
|
||||||
super(RpmRootfs, self).__init__(d, progress_reporter)
|
super(RpmRootfs, self).__init__(d, progress_reporter, logcatcher)
|
||||||
self.log_check_regex = '(unpacking of archive failed|Cannot find package'\
|
self.log_check_regex = '(unpacking of archive failed|Cannot find package'\
|
||||||
'|exit 1|ERROR: |Error: |Error |ERROR '\
|
'|exit 1|ERROR: |Error: |Error |ERROR '\
|
||||||
'|Failed |Failed: |Failed$|Failed\(\d+\):)'
|
'|Failed |Failed: |Failed$|Failed\(\d+\):)'
|
||||||
@@ -530,8 +533,8 @@ class RpmRootfs(Rootfs):
|
|||||||
bb.utils.remove(self.pm.install_dir_path, True)
|
bb.utils.remove(self.pm.install_dir_path, True)
|
||||||
|
|
||||||
class DpkgOpkgRootfs(Rootfs):
|
class DpkgOpkgRootfs(Rootfs):
|
||||||
def __init__(self, d, progress_reporter=None):
|
def __init__(self, d, progress_reporter=None, logcatcher=None):
|
||||||
super(DpkgOpkgRootfs, self).__init__(d, progress_reporter)
|
super(DpkgOpkgRootfs, self).__init__(d, progress_reporter, logcatcher)
|
||||||
|
|
||||||
def _get_pkgs_postinsts(self, status_file):
|
def _get_pkgs_postinsts(self, status_file):
|
||||||
def _get_pkg_depends_list(pkg_depends):
|
def _get_pkg_depends_list(pkg_depends):
|
||||||
@@ -625,8 +628,8 @@ class DpkgOpkgRootfs(Rootfs):
|
|||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
class DpkgRootfs(DpkgOpkgRootfs):
|
class DpkgRootfs(DpkgOpkgRootfs):
|
||||||
def __init__(self, d, manifest_dir, progress_reporter=None):
|
def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
|
||||||
super(DpkgRootfs, self).__init__(d, progress_reporter)
|
super(DpkgRootfs, self).__init__(d, progress_reporter, logcatcher)
|
||||||
self.log_check_regex = '^E:'
|
self.log_check_regex = '^E:'
|
||||||
self.log_check_expected_regexes = \
|
self.log_check_expected_regexes = \
|
||||||
[
|
[
|
||||||
@@ -717,8 +720,8 @@ class DpkgRootfs(DpkgOpkgRootfs):
|
|||||||
|
|
||||||
|
|
||||||
class OpkgRootfs(DpkgOpkgRootfs):
|
class OpkgRootfs(DpkgOpkgRootfs):
|
||||||
def __init__(self, d, manifest_dir, progress_reporter=None):
|
def __init__(self, d, manifest_dir, progress_reporter=None, logcatcher=None):
|
||||||
super(OpkgRootfs, self).__init__(d, progress_reporter)
|
super(OpkgRootfs, self).__init__(d, progress_reporter, logcatcher)
|
||||||
self.log_check_regex = '(exit 1|Collected errors)'
|
self.log_check_regex = '(exit 1|Collected errors)'
|
||||||
|
|
||||||
self.manifest = OpkgManifest(d, manifest_dir)
|
self.manifest = OpkgManifest(d, manifest_dir)
|
||||||
@@ -994,16 +997,16 @@ def variable_depends(d, manifest_dir=None):
|
|||||||
cls = get_class_for_type(img_type)
|
cls = get_class_for_type(img_type)
|
||||||
return cls._depends_list()
|
return cls._depends_list()
|
||||||
|
|
||||||
def create_rootfs(d, manifest_dir=None, progress_reporter=None):
|
def create_rootfs(d, manifest_dir=None, progress_reporter=None, logcatcher=None):
|
||||||
env_bkp = os.environ.copy()
|
env_bkp = os.environ.copy()
|
||||||
|
|
||||||
img_type = d.getVar('IMAGE_PKGTYPE', True)
|
img_type = d.getVar('IMAGE_PKGTYPE', True)
|
||||||
if img_type == "rpm":
|
if img_type == "rpm":
|
||||||
RpmRootfs(d, manifest_dir, progress_reporter).create()
|
RpmRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
|
||||||
elif img_type == "ipk":
|
elif img_type == "ipk":
|
||||||
OpkgRootfs(d, manifest_dir, progress_reporter).create()
|
OpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
|
||||||
elif img_type == "deb":
|
elif img_type == "deb":
|
||||||
DpkgRootfs(d, manifest_dir, progress_reporter).create()
|
DpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
|
||||||
|
|
||||||
os.environ.clear()
|
os.environ.clear()
|
||||||
os.environ.update(env_bkp)
|
os.environ.update(env_bkp)
|
||||||
|
|||||||
Reference in New Issue
Block a user