diff options
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r-- | meta/classes/insane.bbclass | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 4d139e813f..fa7b5f0bc2 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -154,14 +154,29 @@ def package_qa_check_rpath(file,name, d, elf, messages): | |||
154 | if not bad_dirs[0] in d.getVar('WORKDIR', True): | 154 | if not bad_dirs[0] in d.getVar('WORKDIR', True): |
155 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") | 155 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") |
156 | 156 | ||
157 | output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file)) | 157 | output, errors = bb.process.run("%s -B -F%%r#F '%s'" % (scanelf,file)) |
158 | txt = output.readline().split() | 158 | txt = output.split() |
159 | for line in txt: | 159 | for line in txt: |
160 | for dir in bad_dirs: | 160 | for dir in bad_dirs: |
161 | if dir in line: | 161 | if dir in line: |
162 | messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) | 162 | messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) |
163 | 163 | ||
164 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" | 164 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" |
165 | |||
166 | def package_qa_get_objdump(d, path): | ||
167 | """ | ||
168 | Get the result of objdump, ignore the errors since not all files can be objdumped | ||
169 | """ | ||
170 | env_path = d.getVar('PATH', True) | ||
171 | objdump = d.getVar('OBJDUMP', True) | ||
172 | |||
173 | try: | ||
174 | lines = "" | ||
175 | lines = bb.process.run("LC_ALL=C PATH=%s %s -p '%s'" % (env_path, objdump, path))[0] | ||
176 | except Exception: | ||
177 | sys.exc_clear() | ||
178 | return lines | ||
179 | |||
165 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): | 180 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): |
166 | """ | 181 | """ |
167 | Check for RPATHs that are useless but not dangerous | 182 | Check for RPATHs that are useless but not dangerous |
@@ -169,15 +184,12 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): | |||
169 | if not elf: | 184 | if not elf: |
170 | return | 185 | return |
171 | 186 | ||
172 | objdump = d.getVar('OBJDUMP', True) | ||
173 | env_path = d.getVar('PATH', True) | ||
174 | |||
175 | libdir = d.getVar("libdir", True) | 187 | libdir = d.getVar("libdir", True) |
176 | base_libdir = d.getVar("base_libdir", True) | 188 | base_libdir = d.getVar("base_libdir", True) |
177 | 189 | ||
178 | import re | 190 | import re |
179 | rpath_re = re.compile("\s+RPATH\s+(.*)") | 191 | rpath_re = re.compile("\s+RPATH\s+(.*)") |
180 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"): | 192 | for line in package_qa_get_objdump(d, file): |
181 | m = rpath_re.match(line) | 193 | m = rpath_re.match(line) |
182 | if m: | 194 | if m: |
183 | rpath = m.group(1) | 195 | rpath = m.group(1) |
@@ -369,7 +381,7 @@ def package_qa_check_desktop(path, name, d, elf, messages): | |||
369 | """ | 381 | """ |
370 | if path.endswith(".desktop"): | 382 | if path.endswith(".desktop"): |
371 | desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate') | 383 | desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate') |
372 | output = os.popen("%s %s" % (desktop_file_validate, path)) | 384 | output, errors = bb.process.run("%s %s" % (desktop_file_validate, path)) |
373 | # This only produces output on errors | 385 | # This only produces output on errors |
374 | for l in output: | 386 | for l in output: |
375 | messages.append("Desktop file issue: " + l.strip()) | 387 | messages.append("Desktop file issue: " + l.strip()) |
@@ -392,14 +404,11 @@ def package_qa_hash_style(path, name, d, elf, messages): | |||
392 | if not gnu_hash: | 404 | if not gnu_hash: |
393 | return | 405 | return |
394 | 406 | ||
395 | objdump = d.getVar('OBJDUMP', True) | ||
396 | env_path = d.getVar('PATH', True) | ||
397 | |||
398 | sane = False | 407 | sane = False |
399 | has_syms = False | 408 | has_syms = False |
400 | 409 | ||
401 | # If this binary has symbols, we expect it to have GNU_HASH too. | 410 | # If this binary has symbols, we expect it to have GNU_HASH too. |
402 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"): | 411 | for line in package_qa_get_objdump(d, path): |
403 | if "SYMTAB" in line: | 412 | if "SYMTAB" in line: |
404 | has_syms = True | 413 | has_syms = True |
405 | if "GNU_HASH" in line: | 414 | if "GNU_HASH" in line: |