summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-28 18:37:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-29 21:58:19 +0100
commite7e2019180b5c78defaa72c924d2bd5fd2a0d61c (patch)
treef668d0f3d77e09434a8e9517f0a84f0a1b488c82
parent94ca45972781610cb8f6ee70e7da7632e0cb55a9 (diff)
downloadpoky-e7e2019180b5c78defaa72c924d2bd5fd2a0d61c.tar.gz
insane: Further simplify code
Now handle_error is used, we can further simplify the QA test execution as we don't need seperate function lists for warnings and errors. (From OE-Core rev: 6896c9fcfc57f007c0ce15f7804e79b6b88f5ded) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/insane.bbclass41
1 files changed, 14 insertions, 27 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index bdc7f2b703..73fd2951f4 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -782,21 +782,12 @@ def qa_check_staged(path,d):
782 if not skip_shebang_size: 782 if not skip_shebang_size:
783 package_qa_check_shebang_size(path, "", d, None) 783 package_qa_check_shebang_size(path, "", d, None)
784 784
785
786
787# Run all recipe-wide warnfuncs and errorfuncs
788def package_qa_recipe(warnfuncs, errorfuncs, pn, d):
789 for func in warnfuncs:
790 func(pn, d)
791 for func in errorfuncs:
792 func(pn, d)
793
794def prepopulate_objdump_p(elf, d): 785def prepopulate_objdump_p(elf, d):
795 output = elf.run_objdump("-p", d) 786 output = elf.run_objdump("-p", d)
796 return (elf.name, output) 787 return (elf.name, output)
797 788
798# Walk over all files in a directory and call func 789# Walk over all files in a directory and call func
799def package_qa_walk(warnfuncs, errorfuncs, package, d): 790def package_qa_walk(checkfuncs, package, d):
800 elves = {} 791 elves = {}
801 for path in pkgfiles[package]: 792 for path in pkgfiles[package]:
802 elf = None 793 elf = None
@@ -817,9 +808,7 @@ def package_qa_walk(warnfuncs, errorfuncs, package, d):
817 for path in pkgfiles[package]: 808 for path in pkgfiles[package]:
818 if path in elves: 809 if path in elves:
819 elves[path].open() 810 elves[path].open()
820 for func in warnfuncs: 811 for func in checkfuncs:
821 func(path, package, d, elves.get(path))
822 for func in errorfuncs:
823 func(path, package, d, elves.get(path)) 812 func(path, package, d, elves.get(path))
824 if path in elves: 813 if path in elves:
825 elves[path].close() 814 elves[path].close()
@@ -1007,7 +996,7 @@ def package_qa_check_unlisted_pkg_lics(package, d):
1007 "listed in LICENSE" % (package, ' '.join(unlisted)), d) 996 "listed in LICENSE" % (package, ' '.join(unlisted)), d)
1008 obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set 997 obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set
1009 if obsolete: 998 if obsolete:
1010 oe.qa.handle_error(messages, "obsolete-license", 999 oe.qa.handle_error("obsolete-license",
1011 "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete)), d) 1000 "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete)), d)
1012 1001
1013QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs" 1002QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
@@ -1152,20 +1141,19 @@ python do_package_qa () {
1152 def parse_test_matrix(matrix_name): 1141 def parse_test_matrix(matrix_name):
1153 testmatrix = d.getVarFlags(matrix_name) or {} 1142 testmatrix = d.getVarFlags(matrix_name) or {}
1154 g = globals() 1143 g = globals()
1155 warnchecks = [] 1144 checks = []
1156 for w in (d.getVar("WARN_QA") or "").split(): 1145 for w in (d.getVar("WARN_QA") or "").split():
1157 if w in skip: 1146 if w in skip:
1158 continue 1147 continue
1159 if w in testmatrix and testmatrix[w] in g: 1148 if w in testmatrix and testmatrix[w] in g:
1160 warnchecks.append(g[testmatrix[w]]) 1149 checks.append(g[testmatrix[w]])
1161 1150
1162 errorchecks = []
1163 for e in (d.getVar("ERROR_QA") or "").split(): 1151 for e in (d.getVar("ERROR_QA") or "").split():
1164 if e in skip: 1152 if e in skip:
1165 continue 1153 continue
1166 if e in testmatrix and testmatrix[e] in g: 1154 if e in testmatrix and testmatrix[e] in g:
1167 errorchecks.append(g[testmatrix[e]]) 1155 checks.append(g[testmatrix[e]])
1168 return warnchecks, errorchecks 1156 return checks
1169 1157
1170 for package in packages: 1158 for package in packages:
1171 skip = set((d.getVar('INSANE_SKIP') or "").split() + 1159 skip = set((d.getVar('INSANE_SKIP') or "").split() +
@@ -1179,20 +1167,19 @@ python do_package_qa () {
1179 oe.qa.handle_error("pkgname", 1167 oe.qa.handle_error("pkgname",
1180 "%s doesn't match the [a-z0-9.+-]+ regex" % package, d) 1168 "%s doesn't match the [a-z0-9.+-]+ regex" % package, d)
1181 1169
1182 warn_checks, error_checks = parse_test_matrix("QAPATHTEST") 1170 checks = parse_test_matrix("QAPATHTEST")
1183 package_qa_walk(warn_checks, error_checks, package, d) 1171 package_qa_walk(checks, package, d)
1184 1172
1185 warn_checks, error_checks = parse_test_matrix("QAPKGTEST") 1173 checks = parse_test_matrix("QAPKGTEST")
1186 for func in warn_checks: 1174 for func in checks:
1187 func(package, d)
1188 for func in error_checks:
1189 func(package, d) 1175 func(package, d)
1190 1176
1191 package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d) 1177 package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
1192 package_qa_check_deps(package, pkgdest, d) 1178 package_qa_check_deps(package, pkgdest, d)
1193 1179
1194 warn_checks, error_checks = parse_test_matrix("QARECIPETEST") 1180 checks = parse_test_matrix("QARECIPETEST")
1195 package_qa_recipe(warn_checks, error_checks, pn, d) 1181 for func in checks:
1182 func(pn, d)
1196 1183
1197 if 'libdir' in d.getVar("ALL_QA").split(): 1184 if 'libdir' in d.getVar("ALL_QA").split():
1198 package_qa_check_libdir(d) 1185 package_qa_check_libdir(d)