summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-08-09 13:52:05 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-16 10:21:02 (GMT)
commit840a427ed2943136fba60c721d19870c79dabe23 (patch)
tree95dd4603f8ebe514e8331704bb7fa5511c7acd95
parentbaaa7adc168999bfe09e1f287608cc92f86ec0c0 (diff)
downloadpoky-840a427ed2943136fba60c721d19870c79dabe23.tar.gz
bitbake: taskdata: report close matches with NoProvider errors
Assuming there is no known reason why an item is not provided, show close matches on the assumption that it might have been a typo or other mistake. (Bitbake rev: ed81b0856b4a3892b53d39871eaaa6273390ea75) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/event.py3
-rw-r--r--bitbake/lib/bb/taskdata.py13
-rw-r--r--bitbake/lib/bb/ui/crumbs/runningbuild.py10
-rw-r--r--bitbake/lib/bb/ui/knotty.py9
4 files changed, 29 insertions, 6 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 9c134ee..ba25d38 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -341,12 +341,13 @@ class DiskFull(Event):
341class NoProvider(Event): 341class NoProvider(Event):
342 """No Provider for an Event""" 342 """No Provider for an Event"""
343 343
344 def __init__(self, item, runtime=False, dependees=None, reasons=[]): 344 def __init__(self, item, runtime=False, dependees=None, reasons=[], close_matches=[]):
345 Event.__init__(self) 345 Event.__init__(self)
346 self._item = item 346 self._item = item
347 self._runtime = runtime 347 self._runtime = runtime
348 self._dependees = dependees 348 self._dependees = dependees
349 self._reasons = reasons 349 self._reasons = reasons
350 self._close_matches = close_matches
350 351
351 def getItem(self): 352 def getItem(self):
352 return self._item 353 return self._item
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index c08186a..58fe199 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -390,6 +390,17 @@ class TaskData:
390 reasons.append("%s PROVIDES %s but was skipped: %s" % (skipitem.pn, item, skipitem.skipreason)) 390 reasons.append("%s PROVIDES %s but was skipped: %s" % (skipitem.pn, item, skipitem.skipreason))
391 return reasons 391 return reasons
392 392
393 def get_close_matches(self, item, provider_list):
394 import difflib
395 if self.skiplist:
396 skipped = []
397 for fn in self.skiplist:
398 skipped.append(self.skiplist[fn].pn)
399 full_list = provider_list + skipped
400 else:
401 full_list = provider_list
402 return difflib.get_close_matches(item, full_list, cutoff=0.7)
403
393 def add_provider(self, cfgData, dataCache, item): 404 def add_provider(self, cfgData, dataCache, item):
394 try: 405 try:
395 self.add_provider_internal(cfgData, dataCache, item) 406 self.add_provider_internal(cfgData, dataCache, item)
@@ -411,7 +422,7 @@ class TaskData:
411 return 422 return
412 423
413 if not item in dataCache.providers: 424 if not item in dataCache.providers:
414 bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees_str(item), reasons=self.get_reasons(item)), cfgData) 425 bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees_str(item), reasons=self.get_reasons(item), close_matches=self.get_close_matches(item, dataCache.providers.keys())), cfgData)
415 raise bb.providers.NoProvider(item) 426 raise bb.providers.NoProvider(item)
416 427
417 if self.have_build_target(item): 428 if self.have_build_target(item):
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
index 78fa141..abd3300 100644
--- a/bitbake/lib/bb/ui/crumbs/runningbuild.py
+++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py
@@ -375,10 +375,16 @@ class RunningBuild (gobject.GObject):
375 r = "R" 375 r = "R"
376 else: 376 else:
377 r = "" 377 r = ""
378
379 extra = ''
380 if not event._reasons:
381 if event._close_matches:
382 extra = ". Close matches:\n %s" % '\n '.join(event._close_matches)
383
378 if event._dependees: 384 if event._dependees:
379 msg = "Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)\n" % (r, event._item, ", ".join(event._dependees), r) 385 msg = "Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)%s\n" % (r, event._item, ", ".join(event._dependees), r, extra)
380 else: 386 else:
381 msg = "Nothing %sPROVIDES '%s'\n" % (r, event._item) 387 msg = "Nothing %sPROVIDES '%s'%s\n" % (r, event._item, extra)
382 if event._reasons: 388 if event._reasons:
383 for reason in event._reasons: 389 for reason in event._reasons:
384 msg += ("%s\n" % reason) 390 msg += ("%s\n" % reason)
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 2c8293d..09ad99e 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -416,10 +416,15 @@ def main(server, eventHandler, params, tf = TerminalFilter):
416 else: 416 else:
417 r = "" 417 r = ""
418 418
419 extra = ''
420 if not event._reasons:
421 if event._close_matches:
422 extra = ". Close matches:\n %s" % '\n '.join(event._close_matches)
423
419 if event._dependees: 424 if event._dependees:
420 logger.error("Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)", r, event._item, ", ".join(event._dependees), r) 425 logger.error("Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)%s", r, event._item, ", ".join(event._dependees), r, extra)
421 else: 426 else:
422 logger.error("Nothing %sPROVIDES '%s'", r, event._item) 427 logger.error("Nothing %sPROVIDES '%s'%s", r, event._item, extra)
423 if event._reasons: 428 if event._reasons:
424 for reason in event._reasons: 429 for reason in event._reasons:
425 logger.error("%s", reason) 430 logger.error("%s", reason)