summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-08-15 08:39:19 +0000
committerRichard Purdie <richard@openedhand.com>2007-08-15 08:39:19 +0000
commit75306742144eb1bd2d57c986d1f836a59a1f0e8b (patch)
treed1a15e84c1ae3c5c2dff906bbdba3d12bf5186e3 /bitbake/lib
parentd7892c265b0e820a28e62a4aa0819d90ea354a5b (diff)
downloadopenembedded-core-75306742144eb1bd2d57c986d1f836a59a1f0e8b.tar.gz
openembedded-core-75306742144eb1bd2d57c986d1f836a59a1f0e8b.tar.bz2
openembedded-core-75306742144eb1bd2d57c986d1f836a59a1f0e8b.zip
bitbake: Sync with upstream 1.8 branch
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2497 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/__init__.py14
-rw-r--r--bitbake/lib/bb/msg.py44
-rw-r--r--bitbake/lib/bb/providers.py63
-rw-r--r--bitbake/lib/bb/taskdata.py46
4 files changed, 98 insertions, 69 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 1bfecc49ec..585eec8875 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -97,17 +97,23 @@ class MalformedUrl(Exception):
#######################################################################
#######################################################################
+def plain(*args):
+ bb.msg.warn(''.join(args))
+
def debug(lvl, *args):
- bb.msg.std_debug(lvl, ''.join(args))
+ bb.msg.debug(lvl, None, ''.join(args))
def note(*args):
- bb.msg.std_note(''.join(args))
+ bb.msg.note(1, None, ''.join(args))
+
+def warn(*args):
+ bb.msg.warn(1, None, ''.join(args))
def error(*args):
- bb.msg.std_error(''.join(args))
+ bb.msg.error(None, ''.join(args))
def fatal(*args):
- bb.msg.std_fatal(''.join(args))
+ bb.msg.fatal(None, ''.join(args))
#######################################################################
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 98cb6e6bf3..a1b31e5d60 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -66,6 +66,9 @@ class MsgError(MsgBase):
class MsgFatal(MsgBase):
"""Fatal Message"""
+class MsgPlain(MsgBase):
+ """General output"""
+
#
# Message control functions
#
@@ -87,51 +90,40 @@ def set_debug_domains(domains):
bb.msg.debug_level[ddomain] = bb.msg.debug_level[ddomain] + 1
found = True
if not found:
- std_warn("Logging domain %s is not valid, ignoring" % domain)
+ bb.msg.warn(None, "Logging domain %s is not valid, ignoring" % domain)
#
# Message handling functions
#
def debug(level, domain, msg, fn = None):
+ bb.event.fire(MsgDebug(msg, None))
+ if not domain:
+ domain = 'default'
if debug_level[domain] >= level:
- bb.event.fire(MsgDebug(msg, None))
print 'DEBUG: ' + msg
def note(level, domain, msg, fn = None):
+ bb.event.fire(MsgNote(msg, None))
+ if not domain:
+ domain = 'default'
if level == 1 or verbose or debug_level[domain] >= 1:
- std_note(msg)
+ print 'NOTE: ' + msg
def warn(domain, msg, fn = None):
- std_warn(msg)
-
-def error(domain, msg, fn = None):
- std_error(msg)
-
-def fatal(domain, msg, fn = None):
- std_fatal(msg)
-
-#
-# Compatibility functions for the original message interface
-#
-def std_debug(lvl, msg):
- if debug_level['default'] >= lvl:
- bb.event.fire(MsgDebug(msg, None))
- print 'DEBUG: ' + msg
-
-def std_note(msg):
- bb.event.fire(MsgNote(msg, None))
- print 'NOTE: ' + msg
-
-def std_warn(msg):
bb.event.fire(MsgWarn(msg, None))
print 'WARNING: ' + msg
-def std_error(msg):
+def error(domain, msg, fn = None):
bb.event.fire(MsgError(msg, None))
print 'ERROR: ' + msg
-def std_fatal(msg):
+def fatal(domain, msg, fn = None):
bb.event.fire(MsgFatal(msg, None))
print 'ERROR: ' + msg
sys.exit(1)
+
+def plain(msg, fn = None):
+ bb.event.fire(MsgPlain(msg, None))
+ print msg
+
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index 81de85e760..e6f08fb4bd 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -120,7 +120,7 @@ def findBestProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
return (latest,latest_f,preferred_ver, preferred_file)
-def filterProviders(providers, item, cfgData, dataCache):
+def _filterProviders(providers, item, cfgData, dataCache):
"""
Take a list of providers and filter/reorder according to the
environment variables and previous build results
@@ -128,6 +128,11 @@ def filterProviders(providers, item, cfgData, dataCache):
eligible = []
preferred_versions = {}
+ # The order of providers depends on the order of the files on the disk
+ # up to here. Sort pkg_pn to make dependency issues reproducible rather
+ # than effectively random.
+ providers.sort()
+
# Collate providers by PN
pkg_pn = {}
for p in providers:
@@ -187,7 +192,61 @@ def filterProviders(providers, item, cfgData, dataCache):
eligible = [fn] + eligible
break
- return eligible
+ return eligible, preferred_versions
+
+
+def filterProviders(providers, item, cfgData, dataCache):
+ """
+ Take a list of providers and filter/reorder according to the
+ environment variables and previous build results
+ Takes a "normal" target item
+ """
+
+ eligible, pref_vers = _filterProviders(providers, item, cfgData, dataCache)
+
+ prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, cfgData, 1)
+ if prefervar:
+ dataCache.preferred[item] = prefervar
+
+ foundUnique = False
+ if item in dataCache.preferred:
+ for p in eligible:
+ pn = dataCache.pkg_fn[p]
+ if dataCache.preferred[item] == pn:
+ bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
+ eligible.remove(p)
+ eligible = [p] + eligible
+ foundUnique = True
+ break
+
+ return eligible, foundUnique
+
+def filterProvidersRunTime(providers, item, cfgData, dataCache):
+ """
+ Take a list of providers and filter/reorder according to the
+ environment variables and previous build results
+ Takes a "runtime" target item
+ """
+
+ eligible, pref_vers = _filterProviders(providers, item, cfgData, dataCache)
+
+ # Should use dataCache.preferred here?
+ preferred = []
+ for p in eligible:
+ pn = dataCache.pkg_fn[p]
+ provides = dataCache.pn_provides[pn]
+ for provide in provides:
+ prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
+ if prefervar == pn:
+ bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy runtime %s due to PREFERRED_PROVIDERS" % (pn, item))
+ eligible.remove(p)
+ eligible = [p] + eligible
+ preferred.append(p)
+ break
+
+ numberPreferred = len(preferred)
+
+ return eligible, numberPreferred
def getRuntimeProviders(dataCache, rdepend):
"""
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 632a842763..f448b5b666 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -23,7 +23,7 @@ Task data collection and handling
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from bb import data, fetch, event, mkdirhier, utils
+from bb import data, event, mkdirhier, utils
import bb, os
class TaskData:
@@ -357,7 +357,7 @@ class TaskData:
all_p = dataCache.providers[item]
- eligible = bb.providers.filterProviders(all_p, item, cfgData, dataCache)
+ eligible, foundUnique = bb.providers.filterProviders(all_p, item, cfgData, dataCache)
for p in eligible:
fnid = self.getfn_id(p)
@@ -369,22 +369,7 @@ class TaskData:
bb.event.fire(bb.event.NoProvider(item, cfgData))
raise bb.providers.NoProvider(item)
- prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, cfgData, 1)
- if prefervar:
- dataCache.preferred[item] = prefervar
-
- discriminated = False
- if item in dataCache.preferred:
- for p in eligible:
- pn = dataCache.pkg_fn[p]
- if dataCache.preferred[item] == pn:
- bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
- eligible.remove(p)
- eligible = [p] + eligible
- discriminated = True
- break
-
- if len(eligible) > 1 and discriminated == False:
+ if len(eligible) > 1 and foundUnique == False:
if item not in self.consider_msgs_cache:
providers_list = []
for fn in eligible:
@@ -424,7 +409,7 @@ class TaskData:
bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True))
raise bb.providers.NoRProvider(item)
- eligible = bb.providers.filterProviders(all_p, item, cfgData, dataCache)
+ eligible, numberPreferred = bb.providers.filterProvidersRunTime(all_p, item, cfgData, dataCache)
for p in eligible:
fnid = self.getfn_id(p)
@@ -436,21 +421,7 @@ class TaskData:
bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True))
raise bb.providers.NoRProvider(item)
- # Should use dataCache.preferred here?
- preferred = []
- for p in eligible:
- pn = dataCache.pkg_fn[p]
- provides = dataCache.pn_provides[pn]
- for provide in provides:
- prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1)
- if prefervar == pn:
- bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy runtime %s due to PREFERRED_PROVIDERS" % (pn, item))
- eligible.remove(p)
- eligible = [p] + eligible
- preferred.append(p)
- break
-
- if len(eligible) > 1 and len(preferred) == 0:
+ if len(eligible) > 1 and numberPreferred == 0:
if item not in self.consider_msgs_cache:
providers_list = []
for fn in eligible:
@@ -460,12 +431,12 @@ class TaskData:
bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True))
self.consider_msgs_cache.append(item)
- if len(preferred) > 1:
+ if numberPreferred > 1:
if item not in self.consider_msgs_cache:
providers_list = []
- for fn in preferred:
+ for fn in eligible:
providers_list.append(dataCache.pkg_fn[fn])
- bb.msg.note(2, bb.msg.domain.Provider, "multiple preferred providers are available for runtime %s (%s);" % (item, ", ".join(providers_list)))
+ bb.msg.note(2, bb.msg.domain.Provider, "multiple providers are available for runtime %s (top %s entries preferred) (%s);" % (item, numberPreferred, ", ".join(providers_list)))
bb.msg.note(2, bb.msg.domain.Provider, "consider defining only one PREFERRED_PROVIDER entry to match runtime %s" % item)
bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True))
self.consider_msgs_cache.append(item)
@@ -538,6 +509,7 @@ class TaskData:
except bb.providers.NoProvider:
targetid = self.getbuild_id(target)
if self.abort and targetid in self.external_targets:
+ bb.msg.error(bb.msg.domain.Provider, "No providers of build target %s (for %s)" % (target, self.get_dependees_str(target)))
raise
self.remove_buildtarget(targetid)
for target in self.get_unresolved_run_targets(dataCache):