diff options
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/insane.bbclass | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 5757ed398b..2b4841933c 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -17,13 +17,8 @@ | |||
| 17 | # files under exec_prefix | 17 | # files under exec_prefix |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | # | ||
| 21 | # We need to have the scanelf utility as soon as | ||
| 22 | # possible and this is contained within the pax-utils-native. | ||
| 23 | # The package.bbclass can help us here. | ||
| 24 | # | ||
| 25 | inherit package | 20 | inherit package |
| 26 | PACKAGE_DEPENDS += "pax-utils-native ${QADEPENDS}" | 21 | PACKAGE_DEPENDS += "${QADEPENDS}" |
| 27 | PACKAGEFUNCS += " do_package_qa " | 22 | PACKAGEFUNCS += " do_package_qa " |
| 28 | 23 | ||
| 29 | # unsafe-references-in-binaries requires prelink-rtld from | 24 | # unsafe-references-in-binaries requires prelink-rtld from |
| @@ -162,21 +157,23 @@ def package_qa_check_rpath(file,name, d, elf, messages): | |||
| 162 | if not elf: | 157 | if not elf: |
| 163 | return | 158 | return |
| 164 | 159 | ||
| 165 | scanelf = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'scanelf') | ||
| 166 | bad_dirs = [d.getVar('TMPDIR', True) + "/work", d.getVar('STAGING_DIR_TARGET', True)] | 160 | bad_dirs = [d.getVar('TMPDIR', True) + "/work", d.getVar('STAGING_DIR_TARGET', True)] |
| 167 | bad_dir_test = d.getVar('TMPDIR', True) | 161 | bad_dir_test = d.getVar('TMPDIR', True) |
| 168 | if not os.path.exists(scanelf): | ||
| 169 | bb.fatal("Can not check RPATH, scanelf (part of pax-utils-native) not found") | ||
| 170 | 162 | ||
| 171 | if not bad_dirs[0] in d.getVar('WORKDIR', True): | 163 | if not bad_dirs[0] in d.getVar('WORKDIR', True): |
| 172 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") | 164 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") |
| 173 | 165 | ||
| 174 | output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file)) | 166 | phdrs = elf.run_objdump("-p", d) |
| 175 | txt = output.readline().split() | 167 | |
| 176 | for line in txt: | 168 | import re |
| 177 | for dir in bad_dirs: | 169 | rpath_re = re.compile("\s+RPATH\s+(.*)") |
| 178 | if dir in line: | 170 | for line in phdrs.split("\n"): |
| 179 | messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) | 171 | m = rpath_re.match(line) |
| 172 | if m: | ||
| 173 | rpath = m.group(1) | ||
| 174 | for dir in bad_dirs: | ||
| 175 | if dir in rpath: | ||
| 176 | messages.append("package %s contains bad RPATH %s in file %s" % (name, rpath, file)) | ||
| 180 | 177 | ||
| 181 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" | 178 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" |
| 182 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): | 179 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): |
| @@ -189,15 +186,14 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): | |||
| 189 | if not elf: | 186 | if not elf: |
| 190 | return | 187 | return |
| 191 | 188 | ||
| 192 | objdump = d.getVar('OBJDUMP', True) | ||
| 193 | env_path = d.getVar('PATH', True) | ||
| 194 | |||
| 195 | libdir = d.getVar("libdir", True) | 189 | libdir = d.getVar("libdir", True) |
| 196 | base_libdir = d.getVar("base_libdir", True) | 190 | base_libdir = d.getVar("base_libdir", True) |
| 197 | 191 | ||
| 192 | phdrs = elf.run_objdump("-p", d) | ||
| 193 | |||
| 198 | import re | 194 | import re |
| 199 | rpath_re = re.compile("\s+RPATH\s+(.*)") | 195 | rpath_re = re.compile("\s+RPATH\s+(.*)") |
| 200 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"): | 196 | for line in phdrs.split("\n"): |
| 201 | m = rpath_re.match(line) | 197 | m = rpath_re.match(line) |
| 202 | if m: | 198 | if m: |
| 203 | rpath = m.group(1) | 199 | rpath = m.group(1) |
| @@ -458,14 +454,13 @@ def package_qa_hash_style(path, name, d, elf, messages): | |||
| 458 | if not gnu_hash: | 454 | if not gnu_hash: |
| 459 | return | 455 | return |
| 460 | 456 | ||
| 461 | objdump = d.getVar('OBJDUMP', True) | ||
| 462 | env_path = d.getVar('PATH', True) | ||
| 463 | |||
| 464 | sane = False | 457 | sane = False |
| 465 | has_syms = False | 458 | has_syms = False |
| 466 | 459 | ||
| 460 | phdrs = elf.run_objdump("-p", d) | ||
| 461 | |||
| 467 | # If this binary has symbols, we expect it to have GNU_HASH too. | 462 | # If this binary has symbols, we expect it to have GNU_HASH too. |
| 468 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"): | 463 | for line in phdrs.split("\n"): |
| 469 | if "SYMTAB" in line: | 464 | if "SYMTAB" in line: |
| 470 | has_syms = True | 465 | has_syms = True |
| 471 | if "GNU_HASH" in line: | 466 | if "GNU_HASH" in line: |
