summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2015-03-19 13:17:52 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-22 14:42:16 +0000
commit86aec93902af2e2d7d73ca9a643707fcca45055c (patch)
tree0cad2a70cc443f66d4cb7c4e6083b82cb8272376 /meta/lib/oe
parentf4d90ecf88a0f8b1a4b15665bb4a614dae7b5da1 (diff)
downloadpoky-86aec93902af2e2d7d73ca9a643707fcca45055c.tar.gz
rootfs.py: add log checking ability for deb and ipk
Extract the common codes of log checking and add the ability of log checking for deb and ipk package backend. (From OE-Core rev: d995871b433643958845e1d476813fa12888100e) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/rootfs.py61
1 files changed, 44 insertions, 17 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 7e06d5635f..4e4e6ebe39 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -40,6 +40,43 @@ 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):
44 r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)')
45 log_path = self.d.expand("${T}/log.do_rootfs")
46 with open(log_path, 'r') as log:
47 for line in log.read().split('\n'):
48 if 'log_check' in line or 'NOTE:' in line:
49 continue
50
51 m = r.search(line)
52 if m:
53 bb.warn('log_check: There is a warn message in the logfile')
54 bb.warn('log_check: Matched keyword: [%s]' % m.group())
55 bb.warn('log_check: %s\n' % line)
56
57 def _log_check_error(self):
58 r = re.compile(self.log_check_regex)
59 log_path = self.d.expand("${T}/log.do_rootfs")
60 with open(log_path, 'r') as log:
61 found_error = 0
62 message = "\n"
63 for line in log.read().split('\n'):
64 if 'log_check' in line:
65 continue
66
67 m = r.search(line)
68 if m:
69 found_error = 1
70 bb.warn('log_check: There were error messages in the logfile')
71 bb.warn('log_check: Matched keyword: [%s]\n\n' % m.group())
72
73 if found_error >= 1 and found_error <= 5:
74 message += line + '\n'
75 found_error += 1
76
77 if found_error == 6:
78 bb.fatal(message)
79
43 def _insert_feed_uris(self): 80 def _insert_feed_uris(self):
44 if bb.utils.contains("IMAGE_FEATURES", "package-management", 81 if bb.utils.contains("IMAGE_FEATURES", "package-management",
45 True, False, self.d): 82 True, False, self.d):
@@ -256,7 +293,7 @@ class Rootfs(object):
256class RpmRootfs(Rootfs): 293class RpmRootfs(Rootfs):
257 def __init__(self, d, manifest_dir): 294 def __init__(self, d, manifest_dir):
258 super(RpmRootfs, self).__init__(d) 295 super(RpmRootfs, self).__init__(d)
259 296 self.log_check_regex = '(unpacking of archive failed|Cannot find package|exit 1|ERR|Fail)'
260 self.manifest = RpmManifest(d, manifest_dir) 297 self.manifest = RpmManifest(d, manifest_dir)
261 298
262 self.pm = RpmPM(d, 299 self.pm = RpmPM(d,
@@ -353,20 +390,6 @@ class RpmRootfs(Rootfs):
353 # already saved in /etc/rpm-postinsts 390 # already saved in /etc/rpm-postinsts
354 pass 391 pass
355 392
356 def _log_check_warn(self):
357 r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)')
358 log_path = self.d.expand("${T}/log.do_rootfs")
359 with open(log_path, 'r') as log:
360 for line in log.read().split('\n'):
361 if 'log_check' in line or 'NOTE:' in line:
362 continue
363
364 m = r.search(line)
365 if m:
366 bb.warn('log_check: There is a warn message in the logfile')
367 bb.warn('log_check: Matched keyword: [%s]' % m.group())
368 bb.warn('log_check: %s\n' % line)
369
370 def _log_check_error(self): 393 def _log_check_error(self):
371 r = re.compile('(unpacking of archive failed|Cannot find package|exit 1|ERR|Fail)') 394 r = re.compile('(unpacking of archive failed|Cannot find package|exit 1|ERR|Fail)')
372 log_path = self.d.expand("${T}/log.do_rootfs") 395 log_path = self.d.expand("${T}/log.do_rootfs")
@@ -417,6 +440,7 @@ class RpmRootfs(Rootfs):
417class DpkgRootfs(Rootfs): 440class DpkgRootfs(Rootfs):
418 def __init__(self, d, manifest_dir): 441 def __init__(self, d, manifest_dir):
419 super(DpkgRootfs, self).__init__(d) 442 super(DpkgRootfs, self).__init__(d)
443 self.log_check_regex = '^E:'
420 444
421 bb.utils.remove(self.image_rootfs, True) 445 bb.utils.remove(self.image_rootfs, True)
422 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True) 446 bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
@@ -488,7 +512,8 @@ class DpkgRootfs(Rootfs):
488 self.pm.mark_packages("unpacked", registered_pkgs.split()) 512 self.pm.mark_packages("unpacked", registered_pkgs.split())
489 513
490 def _log_check(self): 514 def _log_check(self):
491 pass 515 self._log_check_warn()
516 self._log_check_error()
492 517
493 def _cleanup(self): 518 def _cleanup(self):
494 pass 519 pass
@@ -497,6 +522,7 @@ class DpkgRootfs(Rootfs):
497class OpkgRootfs(Rootfs): 522class OpkgRootfs(Rootfs):
498 def __init__(self, d, manifest_dir): 523 def __init__(self, d, manifest_dir):
499 super(OpkgRootfs, self).__init__(d) 524 super(OpkgRootfs, self).__init__(d)
525 self.log_check_regex = '(exit 1|Collected errors)'
500 526
501 self.manifest = OpkgManifest(d, manifest_dir) 527 self.manifest = OpkgManifest(d, manifest_dir)
502 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True) 528 self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True)
@@ -758,7 +784,8 @@ class OpkgRootfs(Rootfs):
758 self.pm.mark_packages("unpacked", registered_pkgs.split()) 784 self.pm.mark_packages("unpacked", registered_pkgs.split())
759 785
760 def _log_check(self): 786 def _log_check(self):
761 pass 787 self._log_check_warn()
788 self._log_check_error()
762 789
763 def _cleanup(self): 790 def _cleanup(self):
764 pass 791 pass