aboutsummaryrefslogtreecommitdiffstats
path: root/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-02-21 13:24:34 +0000
commite9f7b8f9f830d3123a155ffef76e5a6684958982 (patch)
tree16bd5f14b2469df3d4e8c4cbbf0153b62c99a193 /lib/bb/providers.py
parentf08da7b43513639915723953e957f69434e0cebc (diff)
downloadbitbake-e9f7b8f9f830d3123a155ffef76e5a6684958982.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. (From Poky rev: d4f537965b3a530ca7ed3bce206abbff810031e8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/providers.py')
-rw-r--r--lib/bb/providers.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/bb/providers.py b/lib/bb/providers.py
index d017d6006..dcba9ae25 100644
--- a/lib/bb/providers.py
+++ b/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)