All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chong Lu <Chong.Lu@windriver.com>
To: Chong Lu <Chong.Lu@windriver.com>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] classes/insane: Show QA check name
Date: Fri, 11 Jul 2014 09:25:07 +0800	[thread overview]
Message-ID: <53BF3CF3.609@windriver.com> (raw)
In-Reply-To: <b7aeaae2912f4cbaf11091a64c8c620574ec4e2d.1404869333.git.Chong.Lu@windriver.com>

ping

On 07/09/2014 09:39 AM, Chong Lu wrote:
> QA errors/warnings would show the name of the QA failure in the error/warning message.
> The format is listed:
>
> 	[The name of QA] QA Issue: messages
>
> You can see which QA check you need to disable if you want to disable it.
>
> [YOCTO #6160]
>
> Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
> ---
>   meta/classes/insane.bbclass | 66 ++++++++++++++++++++++-----------------------
>   1 file changed, 32 insertions(+), 34 deletions(-)
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index c8fa711..5bb8115 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -154,24 +154,24 @@ def package_qa_clean_path(path,d):
>       """ Remove the common prefix from the path. In this case it is the TMPDIR"""
>       return path.replace(d.getVar('TMPDIR',True),"")
>   
> -def package_qa_write_error(error, d):
> +def package_qa_write_error(type, error, d):
>       logfile = d.getVar('QA_LOGFILE', True)
>       if logfile:
>           p = d.getVar('P', True)
>           f = file( logfile, "a+")
> -        print >> f, "%s: %s" % (p, error)
> +        print >> f, "%s: [%s] %s" % (p, type, error)
>           f.close()
>   
>   def package_qa_handle_error(error_class, error_msg, d):
> -    package_qa_write_error(error_msg, d)
> +    package_qa_write_error(error_class, error_msg, d)
>       if error_class in (d.getVar("ERROR_QA", True) or "").split():
> -        bb.error("QA Issue: %s" % error_msg)
> +        bb.error("[%s] QA Issue: %s" % (error_class, error_msg))
>           d.setVar("QA_SANE", False)
>           return False
>       elif error_class in (d.getVar("WARN_QA", True) or "").split():
> -        bb.warn("QA Issue: %s" % error_msg)
> +        bb.warn("[%s] QA Issue: %s" % (error_class, error_msg))
>       else:
> -        bb.note("QA Issue: %s" % error_msg)
> +        bb.note("[%s] QA Issue: %s" % (error_class, error_msg))
>       return True
>   
>   QAPATHTEST[libexec] = "package_qa_check_libexec"
> @@ -183,7 +183,7 @@ def package_qa_check_libexec(path,name, d, elf, messages):
>           return True
>   
>       if 'libexec' in path.split(os.path.sep):
> -        messages.append("%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec))
> +        messages["libexec"] = "%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec)
>           return False
>   
>       return True
> @@ -211,7 +211,7 @@ def package_qa_check_rpath(file,name, d, elf, messages):
>               rpath = m.group(1)
>               for dir in bad_dirs:
>                   if dir in rpath:
> -                    messages.append("package %s contains bad RPATH %s in file %s" % (name, rpath, file))
> +                    messages["rpaths"] = "package %s contains bad RPATH %s in file %s" % (name, rpath, file)
>   
>   QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
>   def package_qa_check_useless_rpaths(file, name, d, elf, messages):
> @@ -241,7 +241,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages):
>               if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
>                   # The dynamic linker searches both these places anyway.  There is no point in
>                   # looking there again.
> -                messages.append("%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
> +                messages["useless-rpaths"] = "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath)
>   
>   QAPATHTEST[dev-so] = "package_qa_check_dev"
>   def package_qa_check_dev(path, name, d, elf, messages):
> @@ -250,8 +250,8 @@ def package_qa_check_dev(path, name, d, elf, messages):
>       """
>   
>       if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path):
> -        messages.append("non -dev/-dbg/-nativesdk package contains symlink .so: %s path '%s'" % \
> -                 (name, package_qa_clean_path(path,d)))
> +        messages["dev-so"] = "non -dev/-dbg/-nativesdk package contains symlink .so: %s path '%s'" % \
> +                 (name, package_qa_clean_path(path,d))
>   
>   QAPATHTEST[staticdev] = "package_qa_check_staticdev"
>   def package_qa_check_staticdev(path, name, d, elf, messages):
> @@ -263,8 +263,8 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
>       """
>   
>       if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a"):
> -        messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
> -                 (name, package_qa_clean_path(path,d)))
> +        messages["staticdev"] = "non -staticdev package contains static .a library: %s path '%s'" % \
> +                 (name, package_qa_clean_path(path,d))
>   
>   def package_qa_check_libdir(d):
>       """
> @@ -318,8 +318,8 @@ def package_qa_check_dbg(path, name, d, elf, messages):
>   
>       if not "-dbg" in name and not "-ptest" in name:
>           if '.debug' in path.split(os.path.sep):
> -            messages.append("non debug package contains .debug directory: %s path %s" % \
> -                     (name, package_qa_clean_path(path,d)))
> +            messages["debug-files"] = "non debug package contains .debug directory: %s path %s" % \
> +                     (name, package_qa_clean_path(path,d))
>   
>   QAPATHTEST[perms] = "package_qa_check_perm"
>   def package_qa_check_perm(path,name,d, elf, messages):
> @@ -465,15 +465,15 @@ def package_qa_check_arch(path,name,d, elf, messages):
>       # Check the architecture and endiannes of the binary
>       if not ((machine == elf.machine()) or \
>           ((("virtual/kernel" in provides) or bb.data.inherits_class("module", d) ) and (target_os == "linux-gnux32"))):
> -        messages.append("Architecture did not match (%d to %d) on %s" % \
> -                 (machine, elf.machine(), package_qa_clean_path(path,d)))
> +        messages["arch"] = "Architecture did not match (%d to %d) on %s" % \
> +                 (machine, elf.machine(), package_qa_clean_path(path,d))
>       elif not ((bits == elf.abiSize()) or  \
>           ((("virtual/kernel" in provides) or bb.data.inherits_class("module", d) ) and (target_os == "linux-gnux32"))):
> -        messages.append("Bit size did not match (%d to %d) %s on %s" % \
> -                 (bits, elf.abiSize(), bpn, package_qa_clean_path(path,d)))
> +        messages["arch"] = "Bit size did not match (%d to %d) %s on %s" % \
> +                 (bits, elf.abiSize(), bpn, package_qa_clean_path(path,d))
>       elif not littleendian == elf.isLittleEndian():
> -        messages.append("Endiannes did not match (%d to %d) on %s" % \
> -                 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d)))
> +        messages["arch"] = "Endiannes did not match (%d to %d) on %s" % \
> +                 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d))
>   
>   QAPATHTEST[desktop] = "package_qa_check_desktop"
>   def package_qa_check_desktop(path, name, d, elf, messages):
> @@ -485,7 +485,7 @@ def package_qa_check_desktop(path, name, d, elf, messages):
>           output = os.popen("%s %s" % (desktop_file_validate, path))
>           # This only produces output on errors
>           for l in output:
> -            messages.append("Desktop file issue: " + l.strip())
> +            messages["desktop"] = "Desktop file issue: " + l.strip()
>   
>   QAPATHTEST[textrel] = "package_qa_textrel"
>   def package_qa_textrel(path, name, d, elf, messages):
> @@ -509,7 +509,7 @@ def package_qa_textrel(path, name, d, elf, messages):
>               sane = False
>   
>       if not sane:
> -        messages.append("ELF binary '%s' has relocations in .text" % path)
> +        messages["textrel"] = "ELF binary '%s' has relocations in .text" % path
>   
>   QAPATHTEST[ldflags] = "package_qa_hash_style"
>   def package_qa_hash_style(path, name, d, elf, messages):
> @@ -544,7 +544,7 @@ def package_qa_hash_style(path, name, d, elf, messages):
>               sane = True
>   
>       if has_syms and not sane:
> -        messages.append("No GNU_HASH in the elf binary: '%s'" % path)
> +        messages["ldflags"] = "No GNU_HASH in the elf binary: '%s'" % path
>   
>   
>   QAPATHTEST[buildpaths] = "package_qa_check_buildpaths"
> @@ -564,7 +564,7 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
>       with open(path) as f:
>           file_content = f.read()
>           if tmpdir in file_content:
> -            messages.append("File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d))
> +            messages["buildpaths"] = "File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d)
>   
>   
>   QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
> @@ -583,7 +583,7 @@ def package_qa_check_xorg_driver_abi(path, name, d, elf, messages):
>           for rdep in bb.utils.explode_deps(d.getVar('RDEPENDS_' + name, True) or ""):
>               if rdep.startswith("%sxorg-abi-" % mlprefix):
>                   return
> -        messages.append("Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path)))
> +        messages["xorg-driver-abi"] = "Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path))
>   
>   QAPATHTEST[infodir] = "package_qa_check_infodir"
>   def package_qa_check_infodir(path, name, d, elf, messages):
> @@ -593,7 +593,7 @@ def package_qa_check_infodir(path, name, d, elf, messages):
>       infodir = d.expand("${infodir}/dir")
>   
>       if infodir in path:
> -        messages.append("The /usr/share/info/dir file is not meant to be shipped in a particular package.")
> +        messages["infodir"] = "The /usr/share/info/dir file is not meant to be shipped in a particular package."
>   
>   QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot"
>   def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
> @@ -606,7 +606,7 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
>               tmpdir = d.getVar('TMPDIR', True)
>               if target.startswith(tmpdir):
>                   trimmed = path.replace(os.path.join (d.getVar("PKGDEST", True), name), "")
> -                messages.append("Symlink %s in %s points to TMPDIR" % (trimmed, name))
> +                messages["symlink-to-sysroot"] = "Symlink %s in %s points to TMPDIR" % (trimmed, name)
>   
>   def package_qa_check_license(workdir, d):
>       """
> @@ -738,8 +738,8 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
>       target_os   = d.getVar('TARGET_OS', True)
>       target_arch = d.getVar('TARGET_ARCH', True)
>   
> -    warnings = []
> -    errors = []
> +    warnings = {}
> +    errors = {}
>       for path in pkgfiles[package]:
>               elf = oe.qa.ELFFile(path)
>               try:
> @@ -752,11 +752,9 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
>                   func(path, package, d, elf, errors)
>   
>       for w in warnings:
> -        bb.warn("QA Issue: %s" % w)
> -        package_qa_write_error(w, d)
> +        package_qa_handle_error(w, warnings[w], d)
>       for e in errors:
> -        bb.error("QA Issue: %s" % e)
> -        package_qa_write_error(e, d)
> +        package_qa_handle_error(e, errors[e], d)
>   
>       return len(errors) == 0
>   



  reply	other threads:[~2014-07-11  1:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09  1:39 [PATCH 0/1] classes/insane: Show QA check name Chong Lu
2014-07-09  1:39 ` [PATCH 1/1] " Chong Lu
2014-07-11  1:25   ` Chong Lu [this message]
2014-07-11  5:45     ` Paul Eggleton
2014-07-11  8:02       ` Chong Lu

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=53BF3CF3.609@windriver.com \
    --to=chong.lu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.