summaryrefslogtreecommitdiff
path: root/bitbake/lib
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
parent1d1f2d36c4a1c503b5fb32c8134edcc8ea5f1915 (diff)
downloadopenembedded-core-d4f537965b3a530ca7ed3bce206abbff810031e8.tar.gz
openembedded-core-d4f537965b3a530ca7ed3bce206abbff810031e8.tar.bz2
openembedded-core-d4f537965b3a530ca7ed3bce206abbff810031e8.zip
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')
-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):
# Should use dataCache.preferred here?
preferred = []
preferred_vars = []
+ pns = {}
+ for p in eligible:
+ pns[dataCache.pkg_fn[p]] = p
for p in eligible:
pn = dataCache.pkg_fn[p]
provides = dataCache.pn_provides[pn]
for provide in provides:
- logger.verbose("checking PREFERRED_PROVIDER_%s", provide)
prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
- if prefervar == pn:
+ logger.verbose("checking PREFERRED_PROVIDER_%s (value %s) against %s", provide, prefervar, pns.keys())
+ if prefervar in pns and pns[prefervar] not in preferred:
var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
- logger.verbose("selecting %s to satisfy runtime %s due to %s", pn, item, var)
+ logger.verbose("selecting %s to satisfy runtime %s due to %s", prefervar, item, var)
preferred_vars.append(var)
- eligible.remove(p)
- eligible = [p] + eligible
- preferred.append(p)
+ pref = pns[prefervar]
+ eligible.remove(pref)
+ eligible = [pref] + eligible
+ preferred.append(pref)
break
numberPreferred = len(preferred)
if numberPreferred > 1:
- 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)
+ 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)
logger.debug(1, "sorted providers for %s are: %s", item, eligible)