aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Lu <Chong.Lu@windriver.com>2014-07-14 16:31:50 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-16 10:14:33 +0100
commita5ea622a8e012d3263bc36b6239ee43a4d1fb0ee (patch)
tree92004e0c4cec261626150e1a4860f8408b867e0b
parent7472037569b42386592c060d54196f0c8b9e2d5d (diff)
downloadopenembedded-core-contrib-a5ea622a8e012d3263bc36b6239ee43a4d1fb0ee.tar.gz
openembedded-core-contrib-a5ea622a8e012d3263bc36b6239ee43a4d1fb0ee.tar.bz2
openembedded-core-contrib-a5ea622a8e012d3263bc36b6239ee43a4d1fb0ee.zip
classes/insane: Show QA check name
QA errors/warnings would show the name of the QA failure in the error/warning message. The format is listed: <message> [QA check name] 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> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/insane.bbclass66
1 files changed, 32 insertions, 34 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 106ace7651f..c71e8e283e7 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -151,24 +151,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, error, type)
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("QA Issue: %s [%s]" % (error_msg, error_class))
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("QA Issue: %s [%s]" % (error_msg, error_class))
else:
- bb.note("QA Issue: %s" % error_msg)
+ bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
return True
QAPATHTEST[libexec] = "package_qa_check_libexec"
@@ -180,7 +180,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
@@ -208,7 +208,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):
@@ -238,7 +238,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):
@@ -247,8 +247,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):
@@ -260,8 +260,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):
"""
@@ -315,8 +315,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):
@@ -462,15 +462,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):
@@ -482,7 +482,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):
@@ -506,7 +506,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):
@@ -541,7 +541,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"
@@ -561,7 +561,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"
@@ -580,7 +580,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):
@@ -590,7 +590,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):
@@ -603,7 +603,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):
"""
@@ -735,8 +735,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:
@@ -749,11 +749,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