summaryrefslogtreecommitdiffstats
path: root/meta/classes-global/insane.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-global/insane.bbclass')
-rw-r--r--meta/classes-global/insane.bbclass57
1 files changed, 31 insertions, 26 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index e963001d09..6888fa06f0 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -45,11 +45,10 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
45 already-stripped installed-vs-shipped ldflags compile-host-path \ 45 already-stripped installed-vs-shipped ldflags compile-host-path \
46 install-host-path pn-overrides unknown-configure-option \ 46 install-host-path pn-overrides unknown-configure-option \
47 useless-rpaths rpaths staticdev empty-dirs \ 47 useless-rpaths rpaths staticdev empty-dirs \
48 patch-fuzz \ 48 patch-fuzz patch-status \
49 " 49 "
50# Add usrmerge QA check based on distro feature 50# Add usrmerge QA check based on distro feature
51ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" 51ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
52ERROR_QA:append:layer-core = " patch-status"
53WARN_QA:append:layer-core = " missing-metadata missing-maintainer" 52WARN_QA:append:layer-core = " missing-metadata missing-maintainer"
54 53
55FAKEROOT_QA = "host-user-contaminated" 54FAKEROOT_QA = "host-user-contaminated"
@@ -58,7 +57,7 @@ enabled tests are listed here, the do_package_qa task will run under fakeroot."
58 57
59ALL_QA = "${WARN_QA} ${ERROR_QA}" 58ALL_QA = "${WARN_QA} ${ERROR_QA}"
60 59
61UNKNOWN_CONFIGURE_OPT_IGNORE ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static" 60UNKNOWN_CONFIGURE_OPT_IGNORE ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --disable-static"
62 61
63# This is a list of directories that are expected to be empty. 62# This is a list of directories that are expected to be empty.
64QA_EMPTY_DIRS ?= " \ 63QA_EMPTY_DIRS ?= " \
@@ -298,7 +297,7 @@ def package_qa_check_libdir(d):
298 try: 297 try:
299 elf.open() 298 elf.open()
300 messages.append("%s: found library in wrong location: %s" % (package, rel_path)) 299 messages.append("%s: found library in wrong location: %s" % (package, rel_path))
301 except (oe.qa.NotELFFileError): 300 except (oe.qa.NotELFFileError, FileNotFoundError):
302 pass 301 pass
303 if exec_re.match(rel_path): 302 if exec_re.match(rel_path):
304 if libdir not in rel_path and libexecdir not in rel_path: 303 if libdir not in rel_path and libexecdir not in rel_path:
@@ -307,7 +306,7 @@ def package_qa_check_libdir(d):
307 try: 306 try:
308 elf.open() 307 elf.open()
309 messages.append("%s: found library in wrong location: %s" % (package, rel_path)) 308 messages.append("%s: found library in wrong location: %s" % (package, rel_path))
310 except (oe.qa.NotELFFileError): 309 except (oe.qa.NotELFFileError, FileNotFoundError):
311 pass 310 pass
312 311
313 if messages: 312 if messages:
@@ -334,21 +333,16 @@ def package_qa_check_arch(path,name,d, elf, messages):
334 if not elf: 333 if not elf:
335 return 334 return
336 335
337 target_os = d.getVar('HOST_OS') 336 host_os = d.getVar('HOST_OS')
338 target_arch = d.getVar('HOST_ARCH') 337 host_arch = d.getVar('HOST_ARCH')
339 provides = d.getVar('PROVIDES') 338 provides = d.getVar('PROVIDES')
340 bpn = d.getVar('BPN') 339 bpn = d.getVar('BPN')
341 340
342 if target_arch == "allarch": 341 if host_arch == "allarch":
343 pn = d.getVar('PN') 342 pn = d.getVar('PN')
344 oe.qa.add_message(messages, "arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries") 343 oe.qa.add_message(messages, "arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries")
345 return 344 return
346 345
347 # FIXME: Cross package confuse this check, so just skip them
348 for s in ['cross', 'nativesdk', 'cross-canadian']:
349 if bb.data.inherits_class(s, d):
350 return
351
352 # avoid following links to /usr/bin (e.g. on udev builds) 346 # avoid following links to /usr/bin (e.g. on udev builds)
353 # we will check the files pointed to anyway... 347 # we will check the files pointed to anyway...
354 if os.path.islink(path): 348 if os.path.islink(path):
@@ -356,12 +350,12 @@ def package_qa_check_arch(path,name,d, elf, messages):
356 350
357 #if this will throw an exception, then fix the dict above 351 #if this will throw an exception, then fix the dict above
358 (machine, osabi, abiversion, littleendian, bits) \ 352 (machine, osabi, abiversion, littleendian, bits) \
359 = oe.elf.machine_dict(d)[target_os][target_arch] 353 = oe.elf.machine_dict(d)[host_os][host_arch]
360 354
361 # Check the architecture and endiannes of the binary 355 # Check the architecture and endiannes of the binary
362 is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \ 356 is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \
363 (target_os == "linux-gnux32" or target_os == "linux-muslx32" or \ 357 (host_os == "linux-gnux32" or host_os == "linux-muslx32" or \
364 target_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE'))) 358 host_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE')))
365 is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF") 359 is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF")
366 if not ((machine == elf.machine()) or is_32 or is_bpf): 360 if not ((machine == elf.machine()) or is_32 or is_bpf):
367 oe.qa.add_message(messages, "arch", "Architecture did not match (%s, expected %s) in %s" % \ 361 oe.qa.add_message(messages, "arch", "Architecture did not match (%s, expected %s) in %s" % \
@@ -464,8 +458,8 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
464 with open(path, 'rb') as f: 458 with open(path, 'rb') as f:
465 file_content = f.read() 459 file_content = f.read()
466 if tmpdir in file_content: 460 if tmpdir in file_content:
467 trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "") 461 path = package_qa_clean_path(path, d, name)
468 oe.qa.add_message(messages, "buildpaths", "File %s in package %s contains reference to TMPDIR" % (trimmed, name)) 462 oe.qa.add_message(messages, "buildpaths", "File %s in package %s contains reference to TMPDIR" % (path, name))
469 463
470 464
471QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi" 465QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
@@ -494,7 +488,7 @@ def package_qa_check_infodir(path, name, d, elf, messages):
494 infodir = d.expand("${infodir}/dir") 488 infodir = d.expand("${infodir}/dir")
495 489
496 if infodir in path: 490 if infodir in path:
497 oe.qa.add_message(messages, "infodir", "The /usr/share/info/dir file is not meant to be shipped in a particular package.") 491 oe.qa.add_message(messages, "infodir", "The %s file is not meant to be shipped in a particular package." % infodir)
498 492
499QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot" 493QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot"
500def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages): 494def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
@@ -506,8 +500,8 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
506 if os.path.isabs(target): 500 if os.path.isabs(target):
507 tmpdir = d.getVar('TMPDIR') 501 tmpdir = d.getVar('TMPDIR')
508 if target.startswith(tmpdir): 502 if target.startswith(tmpdir):
509 trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "") 503 path = package_qa_clean_path(path, d, name)
510 oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name)) 504 oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (path, name))
511 505
512QAPATHTEST[32bit-time] = "check_32bit_symbols" 506QAPATHTEST[32bit-time] = "check_32bit_symbols"
513def check_32bit_symbols(path, packagename, d, elf, messages): 507def check_32bit_symbols(path, packagename, d, elf, messages):
@@ -840,10 +834,6 @@ def prepopulate_objdump_p(elf, d):
840 834
841# Walk over all files in a directory and call func 835# Walk over all files in a directory and call func
842def package_qa_walk(warnfuncs, errorfuncs, package, d): 836def package_qa_walk(warnfuncs, errorfuncs, package, d):
843 #if this will throw an exception, then fix the dict above
844 target_os = d.getVar('HOST_OS')
845 target_arch = d.getVar('HOST_ARCH')
846
847 warnings = {} 837 warnings = {}
848 errors = {} 838 errors = {}
849 elves = {} 839 elves = {}
@@ -1399,7 +1389,7 @@ python do_qa_patch() {
1399 oe.qa.handle_error("unimplemented-ptest", "%s: autotools-based tests detected" % d.getVar('PN'), d) 1389 oe.qa.handle_error("unimplemented-ptest", "%s: autotools-based tests detected" % d.getVar('PN'), d)
1400 1390
1401 # Last resort, detect a test directory in sources 1391 # Last resort, detect a test directory in sources
1402 elif any(filename.lower() in ["test", "tests"] for filename in os.listdir(srcdir)): 1392 elif os.path.exists(srcdir) and any(filename.lower() in ["test", "tests"] for filename in os.listdir(srcdir)):
1403 oe.qa.handle_error("unimplemented-ptest", "%s: test subdirectory detected" % d.getVar('PN'), d) 1393 oe.qa.handle_error("unimplemented-ptest", "%s: test subdirectory detected" % d.getVar('PN'), d)
1404 1394
1405 oe.qa.exit_if_errors(d) 1395 oe.qa.exit_if_errors(d)
@@ -1602,6 +1592,21 @@ python () {
1602 if prog.search(pn): 1592 if prog.search(pn):
1603 oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d) 1593 oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d)
1604 1594
1595 sourcedir = d.getVar("S")
1596 builddir = d.getVar("B")
1597 workdir = d.getVar("WORKDIR")
1598 unpackdir = d.getVar("UNPACKDIR")
1599 if sourcedir == workdir:
1600 bb.fatal("Using S = ${WORKDIR} is no longer supported")
1601 if builddir == workdir:
1602 bb.fatal("Using B = ${WORKDIR} is no longer supported")
1603 if unpackdir == workdir:
1604 bb.fatal("Using UNPACKDIR = ${WORKDIR} is not supported")
1605 if sourcedir[-1] == '/':
1606 bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
1607 if builddir[-1] == '/':
1608 bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
1609
1605 # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder 1610 # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder
1606 # why it doesn't work. 1611 # why it doesn't work.
1607 if (d.getVar(d.expand('DEPENDS:${PN}'))): 1612 if (d.getVar(d.expand('DEPENDS:${PN}'))):