bitbake: runqueue: report close matches for an invalid task name

Help to pick up mistakes such as "bitbake -c cleanstate xyz" (instead
of "bitbake -c cleansstate xyz".)

(Bitbake rev: 15c3db1cffdffd85641c6b12e77f19ce7a553472)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2013-08-09 13:51:22 +00:00 committed by Richard Purdie
parent 6b01c97c7a
commit baaa7adc16
1 changed files with 7 additions and 1 deletions

View File

@ -601,7 +601,13 @@ class RunQueueData:
continue
if target[1] not in taskData.tasks_lookup[fnid]:
bb.msg.fatal("RunQueue", "Task %s does not exist for target %s" % (target[1], target[0]))
import difflib
close_matches = difflib.get_close_matches(target[1], taskData.tasks_lookup[fnid], cutoff=0.7)
if close_matches:
extra = ". Close matches:\n %s" % "\n ".join(close_matches)
else:
extra = ""
bb.msg.fatal("RunQueue", "Task %s does not exist for target %s%s" % (target[1], target[0], extra))
listid = taskData.tasks_lookup[fnid][target[1]]