Patchwork [Consolidated,Pull,14/22] insane.bbclass: Make ldd exec_prefix error reporting easier to read

login
register
mail settings
Submitter Elizabeth Flanagan
Date June 7, 2012, 11:37 p.m.
Message ID <28e560ed1a066a82794474f393bffce2668dfee3.1339111944.git.elizabeth.flanagan@intel.com>
Download mbox | patch
Permalink /patch/29423/
State New
Headers show

Comments

Elizabeth Flanagan - June 7, 2012, 11:37 p.m.
From: Mark Hatle <mark.hatle@windriver.com>

Remove the long obtuse sysroot path from the ldd output.

Make the error message significantly easier to read and understand.

Old Style:
WARNING: QA Issue: keyutils: /home/mhatle/git/oss/oe-core/build-i386/tmp-eglibc/work/i586-oe-linux/keyutils-1.5.5-r1/packages-split/keyutils/sbin/request-key links to something under exec_prefix
WARNING: QA Issue: ldd reports:         libkeyutils.so.1 => /home/mhatle/git/oss/oe-core/build-i386/tmp-eglibc/sysroots/qemux86/usr/lib/libkeyutils.so.1 (0xdead1000)
        libc.so.6 => /home/mhatle/git/oss/oe-core/build-i386/tmp-eglibc/sysroots/qemux86/lib/libc.so.6 (0xdead2000)
        /lib/ld-linux.so.2 => /home/mhatle/git/oss/oe-core/build-i386/tmp-eglibc/sysroots/qemux86/lib/ld-linux.so.2 (0xdead3000)

New style:
WARNING: QA Issue: keyutils: /sbin/request-key, installed in the base_prefix, requires a shared library under exec_prefix (/usr): libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0xdead1000)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
---
 meta/classes/insane.bbclass |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 4d139e8..556a176 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -251,10 +251,22 @@  def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages)
 			return False
 
 		if sysroot_path_usr in ldd_output:
-			error_msg = pn + ": %s links to something under exec_prefix" % path
-			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
-			error_msg = "ldd reports: %s" % ldd_output
-			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
+			ldd_output = ldd_output.replace(sysroot_path, "")
+
+			pkgdest = d.getVar('PKGDEST', True)
+			packages = d.getVar('PACKAGES', True)
+
+			for package in packages.split():
+				short_path = path.replace('%s/%s' % (pkgdest, package), "", 1)
+				if (short_path != path):
+					break
+
+			base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix)
+			for line in ldd_output.split('\n'):
+				if exec_prefix in line:
+					error_msg = "%s: %s" % (base_err, line.strip())
+					package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
+
 			return False
 
 QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts"