parse/ast: improve error handling for invalid task dependencies
PATCH 1/1 parse/ast: improve error handling for invalid task dependencies
The per-recipe providers handling that went int with commit fb119c7888ae8a749aa824f8c51780176af077f9 throws a ValueError exception if an entry in a task's [depends] list is malformed.
This results in a traceback of the form:
ERROR: Unable to parse <recipe-name>
Traceback (most recent call last):
File "<top>/bitbake/lib/bb/cooker.py", line 2334, in parse_next
raise resultValueError: not enough values to unpack (expected 2, got 1)
ERROR: Parsing halted due to errors, see error messages above
which makes it difficult to find the source of the parsing problem, particularly if the invalid dependency is added in a bbclass that is shared across many recipes.
Fix this by catching the ValueError and issuing a fatal error message with more information about the problem.
--- lib/bb/parse/ast.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/parse/ast.py +4 -1
@@ -507,7 +507,10 @@ def handleVirtRecipeProviders(tasklist, d): taskdeps = (d.getVarFlag(task, "depends") or "").split() remapped = [] for entry in taskdeps: - r, t = entry.split(":") + try: + r, t = entry.split(":") + except ValueError: + bb.fatal("Error, incorrect format for task dependency (task '%s'): %s" % (task, entry)) if r in virtprovs: r = d.getVar("PREFERRED_PROVIDER_" + r) remapped.append("%s:%s" % (r, t))
Signature · 1 line
2.43.0