* [PATCH 2/4] insane: factor out the test matrix processing
2016-11-24 23:44 [PATCH 1/4] insane: fix expanded-d test Ross Burton
@ 2016-11-24 23:44 ` Ross Burton
2016-11-24 23:44 ` [PATCH 3/4] insane: add QAPKGTEST, a package-wide equivilant to QAPATHTEST Ross Burton
2016-11-24 23:44 ` [PATCH 4/4] insane: rewrite the expanded-d test as a QAPKGTEST Ross Burton
2 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2016-11-24 23:44 UTC (permalink / raw)
To: openembedded-core
Pull the test matrix processing out as a function so it can be reused.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/classes/insane.bbclass | 46 ++++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 9f3065f..0ba4cae 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1116,7 +1116,6 @@ python do_package_qa () {
if not packages:
return
- testmatrix = d.getVarFlags("QAPATHTEST")
import re
# The package name matches the [a-z0-9.+-]+ regular expression
pkgname_pattern = re.compile("^[a-z0-9.+-]+$")
@@ -1126,28 +1125,33 @@ python do_package_qa () {
for dep in taskdepdata:
taskdeps.add(taskdepdata[dep][0])
- g = globals()
for package in packages:
+ def parse_test_matrix(matrix_name):
+ testmatrix = d.getVarFlags(matrix_name) or {}
+ g = globals()
+ warnchecks = []
+ for w in (d.getVar("WARN_QA", True) or "").split():
+ if w in skip:
+ continue
+ if w in testmatrix and testmatrix[w] in g:
+ warnchecks.append(g[testmatrix[w]])
+ if w == 'unsafe-references-in-binaries':
+ oe.utils.write_ld_so_conf(d)
+
+ errorchecks = []
+ for e in (d.getVar("ERROR_QA", True) or "").split():
+ if e in skip:
+ continue
+ if e in testmatrix and testmatrix[e] in g:
+ errorchecks.append(g[testmatrix[e]])
+ if e == 'unsafe-references-in-binaries':
+ oe.utils.write_ld_so_conf(d)
+ return warnchecks, errorchecks
+
skip = (d.getVar('INSANE_SKIP_' + package, True) or "").split()
if skip:
bb.note("Package %s skipping QA tests: %s" % (package, str(skip)))
- warnchecks = []
- for w in (d.getVar("WARN_QA", True) or "").split():
- if w in skip:
- continue
- if w in testmatrix and testmatrix[w] in g:
- warnchecks.append(g[testmatrix[w]])
- if w == 'unsafe-references-in-binaries':
- oe.utils.write_ld_so_conf(d)
-
- errorchecks = []
- for e in (d.getVar("ERROR_QA", True) or "").split():
- if e in skip:
- continue
- if e in testmatrix and testmatrix[e] in g:
- errorchecks.append(g[testmatrix[e]])
- if e == 'unsafe-references-in-binaries':
- oe.utils.write_ld_so_conf(d)
+
bb.note("Checking Package: %s" % package)
# Check package name
@@ -1155,8 +1159,8 @@ python do_package_qa () {
package_qa_handle_error("pkgname",
"%s doesn't match the [a-z0-9.+-]+ regex" % package, d)
- path = "%s/%s" % (pkgdest, package)
- package_qa_walk(warnchecks, errorchecks, skip, package, d)
+ warn_checks, error_checks = parse_test_matrix("QAPATHTEST")
+ package_qa_walk(warn_checks, error_checks, skip, package, d)
package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
package_qa_check_deps(package, pkgdest, skip, d)
--
2.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/4] insane: add QAPKGTEST, a package-wide equivilant to QAPATHTEST
2016-11-24 23:44 [PATCH 1/4] insane: fix expanded-d test Ross Burton
2016-11-24 23:44 ` [PATCH 2/4] insane: factor out the test matrix processing Ross Burton
@ 2016-11-24 23:44 ` Ross Burton
2016-11-24 23:44 ` [PATCH 4/4] insane: rewrite the expanded-d test as a QAPKGTEST Ross Burton
2 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2016-11-24 23:44 UTC (permalink / raw)
To: openembedded-core
QAPATHTEST defines a function that is executed for every file in every package.
For tests which just need to look at the datastore this is massive overkill.
Add QAPKGTEST, which is invoked for each package in the recipe.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/classes/insane.bbclass | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 0ba4cae..407ccee 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -822,6 +822,23 @@ def package_qa_check_staged(path,d):
return sane
+# Run all package-wide warnfuncs and errorfuncs
+def package_qa_package(warnfuncs, errorfuncs, skip, package, d):
+ warnings = {}
+ errors = {}
+
+ for func in warnfuncs:
+ func(package, d, warnings)
+ for func in errorfuncs:
+ func(package, d, errors)
+
+ for w in warnings:
+ package_qa_handle_error(w, warnings[w], d)
+ for e in errors:
+ package_qa_handle_error(e, errors[e], d)
+
+ return len(errors) == 0
+
# Walk over all files in a directory and call func
def package_qa_walk(warnfuncs, errorfuncs, skip, package, d):
import oe.qa
@@ -1162,6 +1179,9 @@ python do_package_qa () {
warn_checks, error_checks = parse_test_matrix("QAPATHTEST")
package_qa_walk(warn_checks, error_checks, skip, package, d)
+ warn_checks, error_checks = parse_test_matrix("QAPKGTEST")
+ package_qa_package(warn_checks, error_checks, skip, package, d)
+
package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
package_qa_check_deps(package, pkgdest, skip, d)
--
2.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 4/4] insane: rewrite the expanded-d test as a QAPKGTEST
2016-11-24 23:44 [PATCH 1/4] insane: fix expanded-d test Ross Burton
2016-11-24 23:44 ` [PATCH 2/4] insane: factor out the test matrix processing Ross Burton
2016-11-24 23:44 ` [PATCH 3/4] insane: add QAPKGTEST, a package-wide equivilant to QAPATHTEST Ross Burton
@ 2016-11-24 23:44 ` Ross Burton
2 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2016-11-24 23:44 UTC (permalink / raw)
To: openembedded-core
Instead of being executed for every file in every package, this is now just
called for each package. It is also now correctly called for packages which
don't have any content but do have postinst scripts.
[ YOCTO #10711 ]
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/classes/insane.bbclass | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 407ccee..5ddb87b 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1002,30 +1002,24 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
check_valid_deps('RREPLACES')
check_valid_deps('RCONFLICTS')
-QAPATHTEST[expanded-d] = "package_qa_check_expanded_d"
-def package_qa_check_expanded_d(path,name,d,elf,messages):
+QAPKGTEST[expanded-d] = "package_qa_check_expanded_d"
+def package_qa_check_expanded_d(package, d, messages):
"""
Check for the expanded D (${D}) value in pkg_* and FILES
variables, warn the user to use it correctly.
"""
-
sane = True
- expanded_d = d.getVar('D',True)
-
- # Get packages for current recipe and iterate
- packages = d.getVar('PACKAGES', True).split(" ")
- for pak in packages:
- # Go through all variables and check if expanded D is found, warn the user accordingly
- for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
- bbvar = d.getVar(var + "_" + pak, True)
- if bbvar:
- if expanded_d in bbvar:
- if var == 'FILES':
- package_qa_add_message(messages, "expanded-d", "FILES in %s recipe should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference" % pak)
- sane = False
- else:
- package_qa_add_message(messages, "expanded-d", "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, pak))
- sane = False
+ expanded_d = d.getVar('D', True)
+
+ for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
+ bbvar = d.getVar(var + "_" + package, True) or ""
+ if expanded_d in bbvar:
+ if var == 'FILES':
+ package_qa_add_message(messages, "expanded-d", "FILES in %s recipe should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference" % package)
+ sane = False
+ else:
+ package_qa_add_message(messages, "expanded-d", "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, package))
+ sane = False
return sane
def package_qa_check_encoding(keys, encode, d):
--
2.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread