diff options
-rw-r--r-- | meta/classes/image.bbclass | 10 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 29 |
2 files changed, 25 insertions, 14 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index b10272a415..e63f6a3bfe 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -208,6 +208,14 @@ PACKAGE_EXCLUDE[type] = "list" | |||
208 | fakeroot python do_rootfs () { | 208 | fakeroot python do_rootfs () { |
209 | from oe.rootfs import create_rootfs | 209 | from oe.rootfs import create_rootfs |
210 | from oe.manifest import create_manifest | 210 | from oe.manifest import create_manifest |
211 | import logging | ||
212 | |||
213 | logger = d.getVar('BB_TASK_LOGGER', False) | ||
214 | if logger: | ||
215 | logcatcher = bb.utils.LogCatcher() | ||
216 | logger.addHandler(logcatcher) | ||
217 | else: | ||
218 | logcatcher = None | ||
211 | 219 | ||
212 | # NOTE: if you add, remove or significantly refactor the stages of this | 220 | # NOTE: if you add, remove or significantly refactor the stages of this |
213 | # process then you should recalculate the weightings here. This is quite | 221 | # process then you should recalculate the weightings here. This is quite |
@@ -255,7 +263,7 @@ fakeroot python do_rootfs () { | |||
255 | progress_reporter.next_stage() | 263 | progress_reporter.next_stage() |
256 | 264 | ||
257 | # generate rootfs | 265 | # generate rootfs |
258 | create_rootfs(d, progress_reporter=progress_reporter) | 266 | create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher) |
259 | 267 | ||
260 | progress_reporter.finish() | 268 | progress_reporter.finish() |
261 | } | 269 | } |
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) |