summaryrefslogtreecommitdiff
path: root/classes/insane.bbclass
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2008-10-26 20:14:53 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2008-10-28 15:15:17 +0100
commitc00633cd751a2ccc6fcf8d1805a358327ae6d628 (patch)
tree98c2628143325f96a7bdd21050e6516680b5cc30 /classes/insane.bbclass
parent83176ca41497b63eab25babf275eb09b5de55a8d (diff)
insane.bbclass: Detect if someone is not using our LDFLAGS
We started passing --target-style=gnu/both to the linker. If the buildsystem is not picking up our LDFLAGS it will not have this hash in the binary. E.g. this is true for busybox. Add a check to insane.bbclass to check if we have a GNU_HASH in the elf binary. Make this a non fatal QA option until the majority of packages are fixed.
Diffstat (limited to 'classes/insane.bbclass')
-rw-r--r--classes/insane.bbclass40
1 files changed, 38 insertions, 2 deletions
diff --git a/classes/insane.bbclass b/classes/insane.bbclass
index 331fd57109..7c9966f12e 100644
--- a/classes/insane.bbclass
+++ b/classes/insane.bbclass
@@ -183,7 +183,7 @@ def package_qa_make_fatal_error(error_class, name, path,d):
TODO: Load a whitelist of known errors
"""
- return not error_class in [0, 5, 7]
+ return not error_class in [0, 5, 7, 9]
def package_qa_write_error(error_class, name, path, d):
"""
@@ -204,6 +204,7 @@ def package_qa_write_error(error_class, name, path, d):
"evil hides inside the .pc",
"the desktop file is not valid",
".la contains reference to the workdir",
+ "LDFLAGS ignored",
]
log_path = os.path.join( bb.data.getVar('T', d, True), "log.qa_package" )
@@ -325,6 +326,41 @@ def package_qa_check_desktop(path, name, d):
return sane
+def package_qa_hash_style(path, name, d):
+ """
+ Check if the binary has the right hash style...
+ """
+ import bb, os
+
+ if os.path.islink(path):
+ return True
+
+ gnu_hash = "--hash-style=gnu" in bb.data.getVar('LDFLAGS', d, True)
+ if not gnu_hash:
+ gnu_hash = "--hash-style=both" in bb.data.getVar('LDFLAGS', d, True)
+
+ objdump = bb.data.getVar('OBJDUMP', d, True)
+ env_path = bb.data.getVar('PATH', d, True)
+
+ sane = True
+ elf = False
+ # A bit hacky. We do not know if path is an elf binary or not
+ # we will search for 'NEEDED' or 'INIT' as this should be printed...
+ # and come before the HASH section (guess!!!) and works on split out
+ # debug symbols too
+ for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
+ if "NEEDED" in line or "INIT" in line:
+ sane = False
+ elf = True
+ if "GNU_HASH" in line:
+ sane = True
+
+ if elf and not sane:
+ error_msg = "No GNU_HASH in the elf binary: '%s'" % path
+ return package_qa_handle_error(9, error_msg, name, path, d)
+
+ return True
+
def package_qa_check_staged(path,d):
"""
Check staged la and pc files for sanity
@@ -433,7 +469,7 @@ python do_package_qa () {
checks = [package_qa_check_rpath, package_qa_check_devdbg,
package_qa_check_perm, package_qa_check_arch,
- package_qa_check_desktop]
+ package_qa_check_desktop, package_qa_hash_style]
walk_sane = True
rdepends_sane = True
for package in packages.split():