summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/providers.py62
-rw-r--r--bitbake/lib/bb/ui/knotty.py5
2 files changed, 44 insertions, 23 deletions
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index 8195d62a11..563a091fda 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -317,32 +317,50 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
317 317
318 eligible = _filterProviders(providers, item, cfgData, dataCache) 318 eligible = _filterProviders(providers, item, cfgData, dataCache)
319 319
320 # Should use dataCache.preferred here? 320 # First try and match any PREFERRED_RPROVIDER entry
321 preferred = [] 321 prefervar = cfgData.getVar('PREFERRED_RPROVIDER_%s' % item, True)
322 preferred_vars = [] 322 foundUnique = False
323 pns = {} 323 if prefervar:
324 for p in eligible: 324 for p in eligible:
325 pns[dataCache.pkg_fn[p]] = p 325 pn = dataCache.pkg_fn[p]
326 for p in eligible: 326 if prefervar == pn:
327 pn = dataCache.pkg_fn[p] 327 logger.verbose("selecting %s to satisfy %s due to PREFERRED_RPROVIDER", pn, item)
328 provides = dataCache.pn_provides[pn] 328 eligible.remove(p)
329 for provide in provides: 329 eligible = [p] + eligible
330 prefervar = cfgData.getVar('PREFERRED_PROVIDER_%s' % provide, True) 330 foundUnique = True
331 #logger.debug(1, "checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys()) 331 numberPreferred = 1
332 if prefervar in pns and pns[prefervar] not in preferred:
333 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
334 logger.verbose("selecting %s to satisfy runtime %s due to %s", prefervar, item, var)
335 preferred_vars.append(var)
336 pref = pns[prefervar]
337 eligible.remove(pref)
338 eligible = [pref] + eligible
339 preferred.append(pref)
340 break 332 break
341 333
342 numberPreferred = len(preferred) 334 # If we didn't find an RPROVIDER entry, try and infer the provider from PREFERRED_PROVIDER entries
335 # by looking through the provides of each eligible recipe and seeing if a PREFERRED_PROVIDER was set.
336 # This is most useful for virtual/ entries rather than having a RPROVIDER per entry.
337 if not foundUnique:
338 # Should use dataCache.preferred here?
339 preferred = []
340 preferred_vars = []
341 pns = {}
342 for p in eligible:
343 pns[dataCache.pkg_fn[p]] = p
344 for p in eligible:
345 pn = dataCache.pkg_fn[p]
346 provides = dataCache.pn_provides[pn]
347 for provide in provides:
348 prefervar = cfgData.getVar('PREFERRED_PROVIDER_%s' % provide, True)
349 #logger.debug(1, "checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys())
350 if prefervar in pns and pns[prefervar] not in preferred:
351 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
352 logger.verbose("selecting %s to satisfy runtime %s due to %s", prefervar, item, var)
353 preferred_vars.append(var)
354 pref = pns[prefervar]
355 eligible.remove(pref)
356 eligible = [pref] + eligible
357 preferred.append(pref)
358 break
359
360 numberPreferred = len(preferred)
343 361
344 if numberPreferred > 1: 362 if numberPreferred > 1:
345 logger.error("Trying to resolve runtime dependency %s resulted in conflicting PREFERRED_PROVIDER entries being found.\nThe providers found were: %s\nThe PREFERRED_PROVIDER entries resulting in this conflict were: %s", item, preferred, preferred_vars) 363 logger.error("Trying to resolve runtime dependency %s resulted in conflicting PREFERRED_PROVIDER entries being found.\nThe providers found were: %s\nThe PREFERRED_PROVIDER entries resulting in this conflict were: %s. You could set PREFERRED_RPROVIDER_%s" % (item, preferred, preferred_vars, item))
346 364
347 logger.debug(1, "sorted runtime providers for %s are: %s", item, eligible) 365 logger.debug(1, "sorted runtime providers for %s are: %s", item, eligible)
348 366
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 2fc20cfb53..268562770a 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -453,7 +453,10 @@ def main(server, eventHandler, params, tf = TerminalFilter):
453 logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "", 453 logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "",
454 event._item, 454 event._item,
455 ", ".join(event._candidates)) 455 ", ".join(event._candidates))
456 logger.info("consider defining a PREFERRED_PROVIDER entry to match %s", event._item) 456 rtime = ""
457 if event._is_runtime:
458 rtime = "R"
459 logger.info("consider defining a PREFERRED_%sPROVIDER entry to match %s" % (rtime, event._item))
457 continue 460 continue
458 if isinstance(event, bb.event.NoProvider): 461 if isinstance(event, bb.event.NoProvider):
459 if event._runtime: 462 if event._runtime: