diff options
-rw-r--r-- | meta/classes-global/insane.bbclass | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 2d69bdec8d..36b139a20d 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
@@ -325,32 +325,41 @@ def package_qa_check_arch(path,name,d, elf): | |||
325 | 325 | ||
326 | host_os = d.getVar('HOST_OS') | 326 | host_os = d.getVar('HOST_OS') |
327 | host_arch = d.getVar('HOST_ARCH') | 327 | host_arch = d.getVar('HOST_ARCH') |
328 | provides = d.getVar('PROVIDES') | 328 | provides = d.getVar('PROVIDES') |
329 | bpn = d.getVar('BPN') | ||
330 | 329 | ||
331 | if host_arch == "allarch": | 330 | if host_arch == "allarch": |
332 | pn = d.getVar('PN') | 331 | oe.qa.handle_error("arch", "%s: inherits the allarch class, but has architecture-specific binaries %s" % \ |
333 | oe.qa.handle_error("arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries", d) | 332 | (name, package_qa_clean_path(path, d, name)), d) |
334 | return | 333 | return |
335 | 334 | ||
336 | #if this will throw an exception, then fix the dict above | 335 | # If this throws an exception, the machine_dict needs expanding |
337 | (machine, osabi, abiversion, littleendian, bits) \ | 336 | (expected_machine, expected_osabi, expected_abiversion, expected_littleendian, expected_bits) \ |
338 | = oe.elf.machine_dict(d)[host_os][host_arch] | 337 | = oe.elf.machine_dict(d)[host_os][host_arch] |
339 | 338 | ||
339 | actual_machine = elf.machine() | ||
340 | actual_bits = elf.abiSize() | ||
341 | actual_littleendian = elf.isLittleEndian() | ||
342 | |||
343 | # BPF don't match the target | ||
344 | if oe.qa.elf_machine_to_string(actual_machine) == "BPF": | ||
345 | return | ||
346 | |||
347 | # These targets have 32-bit userspace but 64-bit kernel, so fudge the expected values | ||
348 | if (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and (host_os in ("linux-gnux32", "linux-muslx32", "linux-gnu_ilp32") or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE'))): | ||
349 | expected_bits = 64 | ||
350 | |||
340 | # Check the architecture and endiannes of the binary | 351 | # Check the architecture and endiannes of the binary |
341 | is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \ | 352 | if expected_machine != actual_machine: |
342 | (host_os == "linux-gnux32" or host_os == "linux-muslx32" or \ | ||
343 | host_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE'))) | ||
344 | is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF") | ||
345 | if not ((machine == elf.machine()) or is_32 or is_bpf): | ||
346 | oe.qa.handle_error("arch", "Architecture did not match (%s, expected %s) in %s" % \ | 353 | oe.qa.handle_error("arch", "Architecture did not match (%s, expected %s) in %s" % \ |
347 | (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path, d, name)), d) | 354 | (oe.qa.elf_machine_to_string(actual_machine), oe.qa.elf_machine_to_string(expected_machine), package_qa_clean_path(path, d, name)), d) |
348 | elif not ((bits == elf.abiSize()) or is_32 or is_bpf): | 355 | |
356 | if expected_bits != actual_bits: | ||
349 | oe.qa.handle_error("arch", "Bit size did not match (%d, expected %d) in %s" % \ | 357 | oe.qa.handle_error("arch", "Bit size did not match (%d, expected %d) in %s" % \ |
350 | (elf.abiSize(), bits, package_qa_clean_path(path, d, name)), d) | 358 | (actual_bits, expected_bits, package_qa_clean_path(path, d, name)), d) |
351 | elif not ((littleendian == elf.isLittleEndian()) or is_bpf): | 359 | |
360 | if expected_littleendian != actual_littleendian: | ||
352 | oe.qa.handle_error("arch", "Endiannes did not match (%d, expected %d) in %s" % \ | 361 | oe.qa.handle_error("arch", "Endiannes did not match (%d, expected %d) in %s" % \ |
353 | (elf.isLittleEndian(), littleendian, package_qa_clean_path(path, d, name)), d) | 362 | (actual_littleendian, expected_littleendian, package_qa_clean_path(path, d, name)), d) |
354 | package_qa_check_arch[vardepsexclude] = "DEFAULTTUNE" | 363 | package_qa_check_arch[vardepsexclude] = "DEFAULTTUNE" |
355 | 364 | ||
356 | QAPATHTEST[desktop] = "package_qa_check_desktop" | 365 | QAPATHTEST[desktop] = "package_qa_check_desktop" |