diff options
author | Phil Blundell <philb@gnu.org> | 2012-10-01 18:29:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-18 12:03:29 +0100 |
commit | bf19eeb9f65e91bf2b5d89e7c0b099c55d7c15ff (patch) | |
tree | 97d0b0ae29fa4da0d306dc72c7771c541cc6016b /meta/lib/oe/qa.py | |
parent | d05e63c6c936a9ff209efd1341401ef7cd2ec0c1 (diff) | |
download | openembedded-core-bf19eeb9f65e91bf2b5d89e7c0b099c55d7c15ff.tar.gz openembedded-core-bf19eeb9f65e91bf2b5d89e7c0b099c55d7c15ff.tar.bz2 openembedded-core-bf19eeb9f65e91bf2b5d89e7c0b099c55d7c15ff.zip |
insane: Rationalise phdrs-based QA checks
Various different QA checks are based on essentially the same data from
the ELF program headers. Calling objdump to extract it repeatedly is
inefficient, particularly if the shell is involved. Instead, let's
cache the output from objdump inside the qa.elf object and allow it to
be reused by multiple tests.
Also, using objdump instead of scanelf to check for bad RPATHs (in the
same way that the useless-rpaths check was doing already) allows the
dependency on pax-utils-native to be dropped.
Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r-- | meta/lib/oe/qa.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index d3800128ed..9e5ab587b7 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -28,6 +28,7 @@ class ELFFile: def __init__(self, name, bits = 0): self.name = name self.bits = bits + self.objdump_output = {} def open(self): self.file = file(self.name, "r") @@ -87,3 +88,19 @@ class ELFFile: import struct (a,) = struct.unpack(self.sex+"H", self.data[18:20]) return a + + def run_objdump(self, cmd, d): + import bb.process + import sys + + if self.objdump_output.has_key(cmd): + return self.objdump_output[cmd] + + objdump = d.getVar('OBJDUMP', True) + staging_dir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True) + + env = os.environ + env["LC_ALL"] = "C" + + self.objdump_output[cmd] = bb.process.run([ os.path.join(staging_dir, objdump), cmd, self.name ], env=env, shell=False)[0] + return self.objdump_output[cmd] |