summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/providers.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-20 22:44:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-20 22:44:33 +0000
commitd4f537965b3a530ca7ed3bce206abbff810031e8 (patch)
treee97a327c1f484ac0d8f7eaef4b1d51489d38a65d /bitbake/lib/bb/providers.py
parent1d1f2d36c4a1c503b5fb32c8134edcc8ea5f1915 (diff)
downloadpoky-d4f537965b3a530ca7ed3bce206abbff810031e8.tar.gz
bitbake/providers.py: Fix runtime providers problems
Take a real world testcase where you have two recipes, each of which contains PACKAGES_DYNAMIC = "gdk-pixbuf-loaders-*" and recipes which RDEPEND on some gdk-pixbuf-loaders-xxx package. To select between these you need to set a PREFERRED_PROVIDER. These are specified in the PN namespace so the locgical conclusion is that setting PREFERRED_PROVIDER_gdk-pixbuf = "gtk+" should work. It doesn't and instead checks crazy things. The code was correctly finding the two possible providers, gtk+ and gdk-pixbuf. It was however only accepting PREFERRED_PROVIDER_gtk+ = "gdk-pixbuf" to resolve this problem which reads as the exact opposite to what was wanted. This patch changes the code to do something that makes sense. I suspect that before these changes it was pretty much a null operation rubber stamping the single provider case. For Poky at least it exposes a few cases where -nativesdk recipes were providing the same things as their normal counterparts but these are genuine bugs in the metadata. I've also attempted to make the multiple provider error message human readable as I counldn't understand it and I doubt anyone else could either. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/providers.py')
-rw-r--r--bitbake/lib/bb/providers.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index d017d6006f..dcba9ae255 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -267,25 +267,29 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
267 # Should use dataCache.preferred here? 267 # Should use dataCache.preferred here?
268 preferred = [] 268 preferred = []
269 preferred_vars = [] 269 preferred_vars = []
270 pns = {}
271 for p in eligible:
272 pns[dataCache.pkg_fn[p]] = p
270 for p in eligible: 273 for p in eligible:
271 pn = dataCache.pkg_fn[p] 274 pn = dataCache.pkg_fn[p]
272 provides = dataCache.pn_provides[pn] 275 provides = dataCache.pn_provides[pn]
273 for provide in provides: 276 for provide in provides:
274 logger.verbose("checking PREFERRED_PROVIDER_%s", provide)
275 prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1) 277 prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
276 if prefervar == pn: 278 logger.verbose("checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys())
279 if prefervar in pns and pns[prefervar] not in preferred:
277 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar) 280 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
278 logger.verbose("selecting %s to satisfy runtime %s due to %s", pn, item, var) 281 logger.verbose("selecting %s to satisfy runtime %s due to %s", prefervar, item, var)
279 preferred_vars.append(var) 282 preferred_vars.append(var)
280 eligible.remove(p) 283 pref = pns[prefervar]
281 eligible = [p] + eligible 284 eligible.remove(pref)
282 preferred.append(p) 285 eligible = [pref] + eligible
286 preferred.append(pref)
283 break 287 break
284 288
285 numberPreferred = len(preferred) 289 numberPreferred = len(preferred)
286 290
287 if numberPreferred > 1: 291 if numberPreferred > 1:
288 logger.error("Conflicting PREFERRED_PROVIDER entries were found which resulted in an attempt to select multiple providers (%s) for runtime dependecy %s\nThe entries resulting in this conflict were: %s", preferred, item, preferred_vars) 292 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)
289 293
290 logger.debug(1, "sorted providers for %s are: %s", item, eligible) 294 logger.debug(1, "sorted providers for %s are: %s", item, eligible)
291 295