Skip to contentSkip to conversation

A couple of fixes for do_rootfs log checking

PATCH New Paul Eggleton 1 participant 3 messages Jun 8, 2015

lore
Share & tools
lore
#0 lore raw

cover A couple of fixes for do_rootfs log checking

The following changes since commit 3b1d89a51445cf526ca84eb5b53de434f9585d6e:

scripts/combo-layer: Fix exit codes and tty handling (2015-06-05 16:42:07 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib paule/rootfs-warning
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/rootfs-warning

Paul Eggleton (2):
lib/oe/rootfs: tidy up log warning reporting
python-smartpm: change "already installed" warnings into info messages

 meta/lib/oe/rootfs.py                              | 13 +++---
 .../smart-already-installed-message.patch          | 54 ++++++++++++++++++++++
 .../python/python-smartpm_1.4.1.bb                 |  1 +
 3 files changed, 61 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-already-installed-message.patch
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 lib/oe/rootfs: tidy up log warning reporting

* bb.warn() should only be called once per warning - UIs such as Toaster assume that this is the case, so adjust the output accordingly. (It's tricky here because we have to include "log_check" on every line or we'll end up looping forever as the log checking code's own messages retrigger the log check, sigh...)
* Iterating over a file already splits by line, there's no need to do it manually.

---
 meta/lib/oe/rootfs.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
meta/lib/oe/rootfs.py +6 -7
index 5f1f7b3e..48e5754 100644
@@ -44,15 +44,14 @@ class Rootfs(object):
         r = re.compile('^(warn|Warn|NOTE: warn|NOTE: Warn|WARNING:)')
         log_path = self.d.expand("${T}/log.do_rootfs")
         with open(log_path, 'r') as log:
-            for line in log.read().split('\n'):
+            for line in log:
                 if 'log_check' in line or 'NOTE:' in line:
                     continue
 
                 m = r.search(line)
                 if m:
-                    bb.warn('log_check: There is a warn message in the logfile')
-                    bb.warn('log_check: Matched keyword: [%s]' % m.group())
-                    bb.warn('log_check: %s\n' % line)
+                    bb.warn('[log_check] %s: found a warning message in the logfile (keyword \'%s\'):\n[log_check] %s'
+				    % (self.d.getVar('PN', True), m.group(), line))
 
     def _log_check_error(self):
         r = re.compile(self.log_check_regex)
@@ -60,15 +59,15 @@ class Rootfs(object):
         with open(log_path, 'r') as log:
             found_error = 0
             message = "\n"
-            for line in log.read().split('\n'):
+            for line in log:
                 if 'log_check' in line:
                     continue
 
                 m = r.search(line)
                 if m:
                     found_error = 1
-                    bb.warn('log_check: There were error messages in the logfile')
-                    bb.warn('log_check: Matched keyword: [%s]\n\n' % m.group())
+                    bb.warn('[log_check] %s: found an error message in the logfile (keyword \'%s\'):\n[log_check] %s'
+				    % (self.d.getVar('PN', True), m.group(), line))
 
                 if found_error >= 1 and found_error <= 5:
                     message += line + '\n'
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/2 python-smartpm: change "already installed" warnings into info messages

In reply to Paul Eggleton

It's possible to trigger "already installed" messages during normal usage if you explicitly install something in the image through IMAGE_INSTALL that has a dependency on some -dev packages and also have dev-pkgs in IMAGE_FEATURES. Since we now check the do_rootfs log for warnings, these are reported as warnings at the build system level. This situation should not trigger warnings, nor is it really cause for concern under any other circumstance if the user asks smart to install something that's already installed, so make it an info message rather than a warning.

Fixes [YOCTO #7840].

---
 .../smart-already-installed-message.patch          | 54 ++++++++++++++++++++++
 .../python/python-smartpm_1.4.1.bb                 |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-already-installed-message.patch
meta/recipes-devtools/python/python-smartpm/smart-already-installed-message.patch new file +54 -0
new file mode 100644
index 0000000..9055555
@@ -0,0 +1,54 @@
+From a74a9a9eb9d75964a0e978950e8b191d7a18d763 Mon Sep 17 00:00:00 2001
+From: Paul Eggleton <[email protected]>
+Date: Fri, 5 Jun 2015 17:07:16 +0100
+Subject: [PATCH] smart: change "is already installed" message from warning to
+ info
+
+This doesn't need to be a warning.
+
+Upstream-Status: Pending
+
+Signed-off-by: Paul Eggleton <[email protected]>
+---
+ smart/commands/install.py            | 4 ++--
+ smart/interfaces/text/interactive.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/smart/commands/install.py b/smart/commands/install.py
+index 6ef9682..80d456b 100644
+--- a/smart/commands/install.py
++++ b/smart/commands/install.py
+@@ -152,7 +152,7 @@ def main(ctrl, opts):
+             for obj in results:
+                 for pkg in obj.packages:
+                     if pkg.installed:
+-                        iface.warning(_("%s (for %s) is already installed")
++                        iface.info(_("%s (for %s) is already installed")
+                                       % (pkg, arg))
+                         installed = True
+                         break
+@@ -184,7 +184,7 @@ def main(ctrl, opts):
+         for name in names:
+             pkg = names[name][0]
+             if pkg.installed:
+-                iface.warning(_("%s is already installed") % pkg)
++                iface.info(_("%s is already installed") % pkg)
+             else:
+                 trans.enqueue(pkg, INSTALL)
+ 
+diff --git a/smart/interfaces/text/interactive.py b/smart/interfaces/text/interactive.py
+index 9865584..190867b 100644
+--- a/smart/interfaces/text/interactive.py
++++ b/smart/interfaces/text/interactive.py
+@@ -278,7 +278,7 @@ class Interpreter(Cmd):
+             for name in names:
+                 pkg = names[name][0]
+                 if pkg.installed:
+-                    iface.warning(_("%s is already installed") % pkg)
++                    iface.info(_("%s is already installed") % pkg)
+                 else:
+                     found = True
+                     transaction.enqueue(pkg, INSTALL)
+-- 
+2.1.0
+
meta/recipes-devtools/python/python-smartpm_1.4.1.bb +1 -0
index c75f10f..69b94a2 100644
@@ -34,6 +34,7 @@ SRC_URI = "\
           file://smart-filename-NAME_MAX.patch \
           file://smart-rpm4-fixes.patch \
           file://smart-add-for-rpm-ignoresize-check.patch \
+          file://smart-already-installed-message.patch \
          "
 
 SRC_URI[md5sum] = "573ef32ba177a6b3c4bf7ef04873fcb6"
Signature · 1 line
2.1.0