summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-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():