summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/providers.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-10 10:35:31 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:33 +0000
commitecc68fa4fbb579e97ea45156e79a293b073697a0 (patch)
tree6d08682e43476e37ccf48ee14c8d81e208d1c897 /bitbake/lib/bb/providers.py
parentd3a45c7d41a88d79389fc40eb68816e4939fb6f9 (diff)
downloadpoky-ecc68fa4fbb579e97ea45156e79a293b073697a0.tar.gz
Switch bitbake internals to use logging directly rather than bb.msg
We use a custom Logger subclass for our loggers This logger provides: - 'debug' method which accepts a debug level - 'plain' method which bypasses log formatting - 'verbose' method which is more detail than info, but less than debug (Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/providers.py')
-rw-r--r--bitbake/lib/bb/providers.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index 58326f0398..d017d6006f 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -22,9 +22,12 @@
22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 23
24import re 24import re
25import logging
25from bb import data, utils 26from bb import data, utils
26import bb 27import bb
27 28
29logger = logging.getLogger("BitBake.Provider")
30
28class NoProvider(Exception): 31class NoProvider(Exception):
29 """Exception raised when no provider of a build dependency can be found""" 32 """Exception raised when no provider of a build dependency can be found"""
30 33
@@ -120,9 +123,9 @@ def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
120 if item: 123 if item:
121 itemstr = " (for item %s)" % item 124 itemstr = " (for item %s)" % item
122 if preferred_file is None: 125 if preferred_file is None:
123 bb.msg.note(1, bb.msg.domain.Provider, "preferred version %s of %s not available%s" % (pv_str, pn, itemstr)) 126 logger.info("preferred version %s of %s not available%s", pv_str, pn, itemstr)
124 else: 127 else:
125 bb.msg.debug(1, bb.msg.domain.Provider, "selecting %s as PREFERRED_VERSION %s of package %s%s" % (preferred_file, pv_str, pn, itemstr)) 128 logger.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s%s", preferred_file, pv_str, pn, itemstr)
126 129
127 return (preferred_ver, preferred_file) 130 return (preferred_ver, preferred_file)
128 131
@@ -189,7 +192,7 @@ def _filterProviders(providers, item, cfgData, dataCache):
189 pkg_pn[pn] = [] 192 pkg_pn[pn] = []
190 pkg_pn[pn].append(p) 193 pkg_pn[pn].append(p)
191 194
192 bb.msg.debug(1, bb.msg.domain.Provider, "providers for %s are: %s" % (item, pkg_pn.keys())) 195 logger.debug(1, "providers for %s are: %s", item, pkg_pn.keys())
193 196
194 # First add PREFERRED_VERSIONS 197 # First add PREFERRED_VERSIONS
195 for pn in pkg_pn: 198 for pn in pkg_pn:
@@ -206,7 +209,7 @@ def _filterProviders(providers, item, cfgData, dataCache):
206 eligible.append(preferred_versions[pn][1]) 209 eligible.append(preferred_versions[pn][1])
207 210
208 if len(eligible) == 0: 211 if len(eligible) == 0:
209 bb.msg.error(bb.msg.domain.Provider, "no eligible providers for %s" % item) 212 logger.error("no eligible providers for %s", item)
210 return 0 213 return 0
211 214
212 # If pn == item, give it a slight default preference 215 # If pn == item, give it a slight default preference
@@ -242,13 +245,13 @@ def filterProviders(providers, item, cfgData, dataCache):
242 for p in eligible: 245 for p in eligible:
243 pn = dataCache.pkg_fn[p] 246 pn = dataCache.pkg_fn[p]
244 if dataCache.preferred[item] == pn: 247 if dataCache.preferred[item] == pn:
245 bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item)) 248 logger.verbose("selecting %s to satisfy %s due to PREFERRED_PROVIDERS", pn, item)
246 eligible.remove(p) 249 eligible.remove(p)
247 eligible = [p] + eligible 250 eligible = [p] + eligible
248 foundUnique = True 251 foundUnique = True
249 break 252 break
250 253
251 bb.msg.debug(1, bb.msg.domain.Provider, "sorted providers for %s are: %s" % (item, eligible)) 254 logger.debug(1, "sorted providers for %s are: %s", item, eligible)
252 255
253 return eligible, foundUnique 256 return eligible, foundUnique
254 257
@@ -268,11 +271,11 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
268 pn = dataCache.pkg_fn[p] 271 pn = dataCache.pkg_fn[p]
269 provides = dataCache.pn_provides[pn] 272 provides = dataCache.pn_provides[pn]
270 for provide in provides: 273 for provide in provides:
271 bb.msg.note(2, bb.msg.domain.Provider, "checking PREFERRED_PROVIDER_%s" % (provide)) 274 logger.verbose("checking PREFERRED_PROVIDER_%s", provide)
272 prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1) 275 prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
273 if prefervar == pn: 276 if prefervar == pn:
274 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar) 277 var = "PREFERRED_PROVIDER_%s = %s" % (provide, prefervar)
275 bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy runtime %s due to %s" % (pn, item, var)) 278 logger.verbose("selecting %s to satisfy runtime %s due to %s", pn, item, var)
276 preferred_vars.append(var) 279 preferred_vars.append(var)
277 eligible.remove(p) 280 eligible.remove(p)
278 eligible = [p] + eligible 281 eligible = [p] + eligible
@@ -282,9 +285,9 @@ def filterProvidersRunTime(providers, item, cfgData, dataCache):
282 numberPreferred = len(preferred) 285 numberPreferred = len(preferred)
283 286
284 if numberPreferred > 1: 287 if numberPreferred > 1:
285 bb.msg.error(bb.msg.domain.Provider, "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)) 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)
286 289
287 bb.msg.debug(1, bb.msg.domain.Provider, "sorted providers for %s are: %s" % (item, eligible)) 290 logger.debug(1, "sorted providers for %s are: %s", item, eligible)
288 291
289 return eligible, numberPreferred 292 return eligible, numberPreferred
290 293
@@ -314,7 +317,7 @@ def getRuntimeProviders(dataCache, rdepend):
314 try: 317 try:
315 regexp = re.compile(pattern) 318 regexp = re.compile(pattern)
316 except: 319 except:
317 bb.msg.error(bb.msg.domain.Provider, "Error parsing re expression: %s" % pattern) 320 logger.error("Error parsing regular expression '%s'", pattern)
318 raise 321 raise
319 regexp_cache[pattern] = regexp 322 regexp_cache[pattern] = regexp
320 if regexp.match(rdepend): 323 if regexp.match(rdepend):