summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2024-10-10 17:06:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-11 12:17:03 +0100
commita475c8ab38bc56c0a5d68a44f99f0005058f6b75 (patch)
tree2e922fc717faf03983e0d5c94bd752674917ccd6
parentfe5cf7dc8113916389a1d9c8fe8050ce86f294af (diff)
downloadpoky-a475c8ab38bc56c0a5d68a44f99f0005058f6b75.tar.gz
insane: rewrite package_qa_check_arch
Reorder and comment the architecture checks to make it clearer what they are actually checking. (From OE-Core rev: 78db9e79e1a307ffb8436e26656bfb98efb513bc) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/insane.bbclass41
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)
354package_qa_check_arch[vardepsexclude] = "DEFAULTTUNE" 363package_qa_check_arch[vardepsexclude] = "DEFAULTTUNE"
355 364
356QAPATHTEST[desktop] = "package_qa_check_desktop" 365QAPATHTEST[desktop] = "package_qa_check_desktop"