summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass31
1 files changed, 11 insertions, 20 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index fa7b5f0bc2..4d139e813f 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -154,29 +154,14 @@ 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, errors = bb.process.run("%s -B -F%%r#F '%s'" % (scanelf,file)) 157 output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file))
158 txt = output.split() 158 txt = output.readline().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
164QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" 164QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
165
166def 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
180def package_qa_check_useless_rpaths(file, name, d, elf, messages): 165def package_qa_check_useless_rpaths(file, name, d, elf, messages):
181 """ 166 """
182 Check for RPATHs that are useless but not dangerous 167 Check for RPATHs that are useless but not dangerous
@@ -184,12 +169,15 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages):
184 if not elf: 169 if not elf:
185 return 170 return
186 171
172 objdump = d.getVar('OBJDUMP', True)
173 env_path = d.getVar('PATH', True)
174
187 libdir = d.getVar("libdir", True) 175 libdir = d.getVar("libdir", True)
188 base_libdir = d.getVar("base_libdir", True) 176 base_libdir = d.getVar("base_libdir", True)
189 177
190 import re 178 import re
191 rpath_re = re.compile("\s+RPATH\s+(.*)") 179 rpath_re = re.compile("\s+RPATH\s+(.*)")
192 for line in package_qa_get_objdump(d, file): 180 for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"):
193 m = rpath_re.match(line) 181 m = rpath_re.match(line)
194 if m: 182 if m:
195 rpath = m.group(1) 183 rpath = m.group(1)
@@ -381,7 +369,7 @@ def package_qa_check_desktop(path, name, d, elf, messages):
381 """ 369 """
382 if path.endswith(".desktop"): 370 if path.endswith(".desktop"):
383 desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate') 371 desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate')
384 output, errors = bb.process.run("%s %s" % (desktop_file_validate, path)) 372 output = os.popen("%s %s" % (desktop_file_validate, path))
385 # This only produces output on errors 373 # This only produces output on errors
386 for l in output: 374 for l in output:
387 messages.append("Desktop file issue: " + l.strip()) 375 messages.append("Desktop file issue: " + l.strip())
@@ -404,11 +392,14 @@ def package_qa_hash_style(path, name, d, elf, messages):
404 if not gnu_hash: 392 if not gnu_hash:
405 return 393 return
406 394
395 objdump = d.getVar('OBJDUMP', True)
396 env_path = d.getVar('PATH', True)
397
407 sane = False 398 sane = False
408 has_syms = False 399 has_syms = False
409 400
410 # If this binary has symbols, we expect it to have GNU_HASH too. 401 # If this binary has symbols, we expect it to have GNU_HASH too.
411 for line in package_qa_get_objdump(d, path): 402 for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
412 if "SYMTAB" in line: 403 if "SYMTAB" in line:
413 has_syms = True 404 has_syms = True
414 if "GNU_HASH" in line: 405 if "GNU_HASH" in line: