public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Robert Yang <liezhi.yang@windriver.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] insane.bbclass: make package_qa_walk() can print all the messages
Date: Fri, 15 Jan 2016 12:22:52 +0000	[thread overview]
Message-ID: <1452860572.28375.148.camel@linuxfoundation.org> (raw)
In-Reply-To: <542ae24027e42b3a3c037341ecdc99eb77e412d8.1452824092.git.liezhi.yang@windriver.com>

On Thu, 2016-01-14 at 18:15 -0800, Robert Yang wrote:
> * If more than one files have the same QA issue, package_qa_walk()
> can
>   only print the last one, others are overrided, for example:
>   messages["host-user-contaminated"] = "foo1"
>   messages["host-user-contaminated"] = "foo2"
>   Only foo2 will be printed, this patch fixes the issue.
> 
> * Remove unused parameter "path" from package_qa_walk()
>   The path is a useless parameter in package_qa_walk() since it has
> been
>   redined inside.
> 
> [YOCTO #8436]
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes/insane.bbclass |   20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)

Whilst your proposal is self contained, it doesn't really do anything
to help the readability of this code which is pretty horrific already,
if anything it just makes the code even more convoluted. I'd propose
something more radical, like:

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index acf8639..03028f8 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -189,6 +189,12 @@ def package_qa_handle_error(error_class, error_msg, d):
         bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
     return True
 
+def package_qa_add_message(messages, section, message):
+    if section not in messages:
+        messages[section] = message
+    else:
+        messages[section] = messages[section] + "\n" + message
+
 QAPATHTEST[libexec] = "package_qa_check_libexec"
 def package_qa_check_libexec(path,name, d, elf, messages):
 
@@ -198,7 +204,7 @@ def package_qa_check_libexec(path,name, d, elf, messages):
         return True
 
     if 'libexec' in path.split(os.path.sep):
-        messages["libexec"] = "%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec)
+        package_qa_add_message(messages, "libexec", "%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec))
         return False
 
     return True


This will obviously be a bit more work to make the patch but will IMO
result in a cleaner piece of code as an end result.

Cheers,

Richard


      reply	other threads:[~2016-01-15 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15  2:15 [PATCH 0/1] insane.bbclass: make package_qa_walk() can print all the messages Robert Yang
2016-01-15  2:15 ` [PATCH 1/1] " Robert Yang
2016-01-15 12:22   ` Richard Purdie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452860572.28375.148.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox