summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
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
parentd3a45c7d41a88d79389fc40eb68816e4939fb6f9 (diff)
downloadopenembedded-core-ecc68fa4fbb579e97ea45156e79a293b073697a0.tar.gz
openembedded-core-ecc68fa4fbb579e97ea45156e79a293b073697a0.tar.bz2
openembedded-core-ecc68fa4fbb579e97ea45156e79a293b073697a0.zip
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')
-rw-r--r--bitbake/lib/bb/__init__.py31
-rw-r--r--bitbake/lib/bb/build.py26
-rw-r--r--bitbake/lib/bb/cache.py53
-rw-r--r--bitbake/lib/bb/cooker.py126
-rw-r--r--bitbake/lib/bb/data_smart.py10
-rw-r--r--bitbake/lib/bb/fetch/__init__.py35
-rw-r--r--bitbake/lib/bb/fetch/bzr.py13
-rw-r--r--bitbake/lib/bb/fetch/cvs.py13
-rw-r--r--bitbake/lib/bb/fetch/git.py9
-rw-r--r--bitbake/lib/bb/fetch/hg.py14
-rw-r--r--bitbake/lib/bb/fetch/local.py2
-rw-r--r--bitbake/lib/bb/fetch/osc.py11
-rw-r--r--bitbake/lib/bb/fetch/perforce.py18
-rw-r--r--bitbake/lib/bb/fetch/repo.py2
-rw-r--r--bitbake/lib/bb/fetch/svk.py10
-rw-r--r--bitbake/lib/bb/fetch/svn.py14
-rw-r--r--bitbake/lib/bb/fetch/wget.py13
-rw-r--r--bitbake/lib/bb/msg.py18
-rw-r--r--bitbake/lib/bb/parse/__init__.py9
-rw-r--r--bitbake/lib/bb/parse/ast.py12
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py9
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py5
-rw-r--r--bitbake/lib/bb/persist_data.py8
-rw-r--r--bitbake/lib/bb/providers.py25
-rw-r--r--bitbake/lib/bb/runqueue.py90
-rw-r--r--bitbake/lib/bb/taskdata.py61
-rw-r--r--bitbake/lib/bb/utils.py47
27 files changed, 368 insertions, 316 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 8cda4255bc..11983f0e0e 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -35,7 +35,25 @@ class NullHandler(logging.Handler):
def emit(self, record):
pass
+Logger = logging.getLoggerClass()
+class BBLogger(Logger):
+ def __init__(self, name):
+ if name.split(".")[0] == "BitBake":
+ self.debug = self.bbdebug
+ Logger.__init__(self, name)
+
+ def bbdebug(self, level, msg, *args, **kwargs):
+ return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs)
+
+ def plain(self, msg, *args, **kwargs):
+ return self.log(logging.INFO + 1, msg, *args, **kwargs)
+
+ def verbose(self, msg, *args, **kwargs):
+ return self.log(logging.INFO - 1, msg, *args, **kwargs)
+
logging.raiseExceptions = False
+logging.setLoggerClass(BBLogger)
+
logger = logging.getLogger("BitBake")
logger.addHandler(NullHandler())
logger.setLevel(logging.INFO)
@@ -48,22 +66,23 @@ if "BBDEBUG" in os.environ:
# Messaging convenience functions
def plain(*args):
- bb.msg.plain(''.join(args))
+ logger.plain(''.join(args))
def debug(lvl, *args):
- bb.msg.debug(lvl, None, ''.join(args))
+ logger.debug(lvl, ''.join(args))
def note(*args):
- bb.msg.note(1, None, ''.join(args))
+ logger.info(''.join(args))
def warn(*args):
- bb.msg.warn(None, ''.join(args))
+ logger.warn(''.join(args))
def error(*args):
- bb.msg.error(None, ''.join(args))
+ logger.error(''.join(args))
def fatal(*args):
- bb.msg.fatal(None, ''.join(args))
+ logger.critical(''.join(args))
+ sys.exit(1)
def deprecated(func, name = None, advice = ""):
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 18a75edca3..9589313238 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -26,9 +26,14 @@
#Based on functions from the base bb module, Copyright 2003 Holger Schurig
from bb import data, event, mkdirhier, utils
-import bb, os, sys
+import os
+import sys
+import logging
+import bb
import bb.utils
+logger = logging.getLogger("BitBake.Build")
+
# When we execute a python function we'd like certain things
# in all namespaces, hence we add them to __builtins__
# If we do not do this and use the exec globals, they will
@@ -193,7 +198,8 @@ def exec_func_shell(func, d, runfile, logfile, flags):
f = open(runfile, "w")
f.write("#!/bin/sh -e\n")
- if bb.msg.debug_level['default'] > 0: f.write("set -x\n")
+ if logger.getEffectiveLevel() <= logging.DEBUG:
+ f.write("set -x\n")
data.emit_func(func, f, d)
f.write("cd %s\n" % os.getcwd())
@@ -226,7 +232,7 @@ def exec_task(fn, task, d):
# Check whther this is a valid task
if not data.getVarFlag(task, 'task', d):
event.fire(TaskInvalid(task, d), d)
- bb.msg.error(bb.msg.domain.Build, "No such task: %s" % task)
+ logger.error("No such task: %s" % task)
return 1
quieterr = False
@@ -234,7 +240,7 @@ def exec_task(fn, task, d):
quieterr = True
try:
- bb.msg.debug(1, bb.msg.domain.Build, "Executing task %s" % task)
+ logger.debug(1, "Executing task %s", task)
old_overrides = data.getVar('OVERRIDES', d, 0)
localdata = data.createCopy(d)
data.setVar('OVERRIDES', 'task-%s:%s' % (task[3:], old_overrides), localdata)
@@ -269,8 +275,8 @@ def exec_task(fn, task, d):
si = file('/dev/null', 'r')
try:
so = file(logfile, 'w')
- except OSError as e:
- bb.msg.error(bb.msg.domain.Build, "opening log file: %s" % e)
+ except OSError:
+ logger.exception("Opening log file '%s'", logfile)
pass
se = so
@@ -312,7 +318,7 @@ def exec_task(fn, task, d):
logfile = None
msg = message
if not quieterr:
- bb.msg.error(bb.msg.domain.Build, "Task failed: %s" % message )
+ logger.error("Task failed: %s" % message )
failedevent = TaskFailed(msg, logfile, task, d)
event.fire(failedevent, d)
return 1
@@ -320,8 +326,8 @@ def exec_task(fn, task, d):
except Exception:
from traceback import format_exc
if not quieterr:
- bb.msg.error(bb.msg.domain.Build, "Build of %s failed" % (task))
- bb.msg.error(bb.msg.domain.Build, format_exc())
+ logger.error("Build of %s failed" % (task))
+ logger.error(format_exc())
failedevent = TaskFailed("Task Failed", None, task, d)
event.fire(failedevent, d)
return 1
@@ -342,7 +348,7 @@ def exec_task(fn, task, d):
se.close()
if logfile and os.path.exists(logfile) and os.path.getsize(logfile) == 0:
- bb.msg.debug(2, bb.msg.domain.Build, "Zero size logfile %s, removing" % logfile)
+ logger.debug(2, "Zero size logfile %s, removing", logfile)
os.remove(logfile)
try:
os.remove(loglink)
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index c6f3794d5e..255c6168dd 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -29,14 +29,17 @@
import os
+import logging
import bb.data
import bb.utils
+logger = logging.getLogger("BitBake.Cache")
+
try:
import cPickle as pickle
except ImportError:
import pickle
- bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.")
+ logger.info("Importing cPickle failed. Falling back to a very slow implementation.")
__cache_version__ = "132"
@@ -57,13 +60,13 @@ class Cache:
if self.cachedir in [None, '']:
self.has_cache = False
- bb.msg.note(1, bb.msg.domain.Cache, "Not using a cache. Set CACHE = <directory> to enable.")
+ logger.info("Not using a cache. Set CACHE = <directory> to enable.")
return
self.has_cache = True
self.cachefile = os.path.join(self.cachedir, "bb_cache.dat")
- bb.msg.debug(1, bb.msg.domain.Cache, "Using cache in '%s'" % self.cachedir)
+ logger.debug(1, "Using cache in '%s'", self.cachedir)
bb.utils.mkdirhier(self.cachedir)
# If any of configuration.data's dependencies are newer than the
@@ -84,14 +87,14 @@ class Cache:
if version_data['BITBAKE_VER'] != bb.__version__:
raise ValueError('Bitbake Version Mismatch')
except EOFError:
- bb.msg.note(1, bb.msg.domain.Cache, "Truncated cache found, rebuilding...")
+ logger.info("Truncated cache found, rebuilding...")
self.depends_cache = {}
except:
- bb.msg.note(1, bb.msg.domain.Cache, "Invalid cache found, rebuilding...")
+ logger.info("Invalid cache found, rebuilding...")
self.depends_cache = {}
else:
if os.path.isfile(self.cachefile):
- bb.msg.note(1, bb.msg.domain.Cache, "Out of date cache found, rebuilding...")
+ logger.info("Out of date cache found, rebuilding...")
def getVar(self, var, fn, exp = 0):
"""
@@ -111,7 +114,7 @@ class Cache:
if fn != self.data_fn:
# We're trying to access data in the cache which doesn't exist
# yet setData hasn't been called to setup the right access. Very bad.
- bb.msg.error(bb.msg.domain.Cache, "Parsing error data_fn %s and fn %s don't match" % (self.data_fn, fn))
+ logger.error("data_fn %s and fn %s don't match", self.data_fn, fn)
self.cacheclean = False
result = bb.data.getVar(var, self.data, exp)
@@ -152,7 +155,6 @@ class Cache:
if virtualfn.startswith('virtual:'):
cls = virtualfn.split(':', 2)[1]
fn = virtualfn.replace('virtual:' + cls + ':', '')
- #bb.msg.debug(2, bb.msg.domain.Cache, "virtualfn2realfn %s to %s %s" % (virtualfn, fn, cls))
return (fn, cls)
def realfn2virtual(self, realfn, cls):
@@ -160,9 +162,7 @@ class Cache:
Convert a real filename + the associated subclass keyword to a virtual filename
"""
if cls == "":
- #bb.msg.debug(2, bb.msg.domain.Cache, "realfn2virtual %s and '%s' to %s" % (realfn, cls, realfn))
return realfn
- #bb.msg.debug(2, bb.msg.domain.Cache, "realfn2virtual %s and %s to %s" % (realfn, cls, "virtual:" + cls + ":" + realfn))
return "virtual:" + cls + ":" + realfn
def loadDataFull(self, virtualfn, appends, cfgData):
@@ -173,7 +173,7 @@ class Cache:
(fn, cls) = self.virtualfn2realfn(virtualfn)
- bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s (full)" % fn)
+ logger.debug(1, "Parsing %s (full)", fn)
bb_data = self.load_bbfile(fn, appends, cfgData)
return bb_data[cls]
@@ -198,13 +198,13 @@ class Cache:
virtualfn = self.realfn2virtual(fn, cls)
if self.depends_cache[virtualfn]["__SKIPPED"]:
skipped += 1
- bb.msg.debug(1, bb.msg.domain.Cache, "Skipping %s" % virtualfn)
+ logger.debug(1, "Skipping %s", virtualfn)
continue
self.handle_data(virtualfn, cacheData)
virtuals += 1
return True, skipped, virtuals
- bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s" % fn)
+ logger.debug(1, "Parsing %s", fn)
bb_data = self.load_bbfile(fn, appends, cfgData)
@@ -213,7 +213,7 @@ class Cache:
self.setData(virtualfn, fn, bb_data[data])
if self.getVar("__SKIPPED", virtualfn):
skipped += 1
- bb.msg.debug(1, bb.msg.domain.Cache, "Skipping %s" % virtualfn)
+ logger.debug(1, "Skipping %s", virtualfn)
else:
self.handle_data(virtualfn, cacheData)
virtuals += 1
@@ -248,7 +248,7 @@ class Cache:
# File isn't in depends_cache
if not fn in self.depends_cache:
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: %s is not cached" % fn)
+ logger.debug(2, "Cache: %s is not cached", fn)
self.remove(fn)
return False
@@ -256,13 +256,13 @@ class Cache:
# Check file still exists
if mtime == 0:
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: %s no longer exists" % fn)
+ logger.debug(2, "Cache: %s no longer exists", fn)
self.remove(fn)
return False
# Check the file's timestamp
if mtime != self.getVar("CACHETIMESTAMP", fn, True):
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: %s changed" % fn)
+ logger.debug(2, "Cache: %s changed", fn)
self.remove(fn)
return False
@@ -277,11 +277,10 @@ class Cache:
return False
if (fmtime != old_mtime):
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: %s's dependency %s changed" % (fn, f))
+ logger.debug(2, "Cache: %s's dependency %s changed", fn, f)
self.remove(fn)
return False
- #bb.msg.debug(2, bb.msg.domain.Cache, "Depends Cache: %s is clean" % fn)
if not fn in self.clean:
self.clean[fn] = ""
@@ -292,16 +291,16 @@ class Cache:
virtualfn = self.realfn2virtual(fn, cls)
self.clean[virtualfn] = ""
if not virtualfn in self.depends_cache:
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: %s is not cached" % virtualfn)
+ logger.debug(2, "Cache: %s is not cached", virtualfn)
invalid = True
# If any one of the varients is not present, mark cache as invalid for all
if invalid:
for cls in (multi or "").split():
virtualfn = self.realfn2virtual(fn, cls)
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: Removing %s from cache" % virtualfn)
+ logger.debug(2, "Cache: Removing %s from cache", virtualfn)
del self.clean[virtualfn]
- bb.msg.debug(2, bb.msg.domain.Cache, "Cache: Removing %s from cache" % fn)
+ logger.debug(2, "Cache: removing %s from cache", fn)
del self.clean[fn]
return False
@@ -312,7 +311,7 @@ class Cache:
Remove a fn from the cache
Called from the parser in error cases
"""
- bb.msg.debug(1, bb.msg.domain.Cache, "Removing %s from cache" % fn)
+ logger.debug(1, "Removing %s from cache", fn)
if fn in self.depends_cache:
del self.depends_cache[fn]
if fn in self.clean:
@@ -329,7 +328,7 @@ class Cache:
return
if self.cacheclean:
- bb.msg.note(1, bb.msg.domain.Cache, "Cache is clean, not saving.")
+ logger.info("Cache is clean, not saving.")
return
version_data = {}
@@ -339,10 +338,10 @@ class Cache:
cache_data = copy.copy(self.depends_cache)
for fn in self.depends_cache:
if '__BB_DONT_CACHE' in self.depends_cache[fn] and self.depends_cache[fn]['__BB_DONT_CACHE']:
- bb.msg.debug(2, bb.msg.domain.Cache, "Not caching %s, marked as not cacheable" % fn)
+ logger.debug(2, "Not caching %s, marked as not cacheable", fn)
del cache_data[fn]
elif 'PV' in self.depends_cache[fn] and 'SRCREVINACTION' in self.depends_cache[fn]['PV']:
- bb.msg.error(bb.msg.domain.Cache, "Not caching %s as it had SRCREVINACTION in PV. Please report this bug" % fn)
+ logger.error("Not caching %s as it had SRCREVINACTION in PV. Please report this bug", fn)
del cache_data[fn]
p = pickle.Pickler(file(self.cachefile, "wb" ), -1 )
@@ -360,7 +359,7 @@ class Cache:
pe = self.getVar('PE', file_name, True) or "0"
pv = self.getVar('PV', file_name, True)
if 'SRCREVINACTION' in pv:
- bb.msg.note(1, bb.msg.domain.Cache, "Found SRCREVINACTION in PV (%s) or %s. Please report this bug." % (pv, file_name))
+ logger.info("Found SRCREVINACTION in PV (%s) or %s. Please report this bug.", pv, file_name)
pr = self.getVar('PR', file_name, True)
dp = int(self.getVar('DEFAULT_PREFERENCE', file_name, True) or "0")
depends = bb.utils.explode_deps(self.getVar("DEPENDS", file_name, True) or "")
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 95f38f6236..de213f03f4 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -23,12 +23,19 @@
from __future__ import print_function
import sys, os, glob, os.path, re, time
+import logging
import sre_constants
from cStringIO import StringIO
from contextlib import closing
import bb
from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
+logger = logging.getLogger("BitBake")
+collectlog = logging.getLogger("BitBake.Collection")
+buildlog = logging.getLogger("BitBake.Build")
+parselog = logging.getLogger("BitBake.Parsing")
+providerlog = logging.getLogger("BitBake.Provider")
+
class MultipleMatches(Exception):
"""
Exception raised when multiple file matches are found
@@ -102,7 +109,7 @@ class BBCooker:
import termios
tcattr = termios.tcgetattr(fd)
if tcattr[3] & termios.TOSTOP:
- bb.msg.note(1, bb.msg.domain.Build, "The terminal had the TOSTOP bit set, clearing...")
+ buildlog.info("The terminal had the TOSTOP bit set, clearing...")
tcattr[3] = tcattr[3] & ~termios.TOSTOP
termios.tcsetattr(fd, termios.TCSANOW, tcattr)
@@ -118,7 +125,7 @@ class BBCooker:
if nice:
curnice = os.nice(0)
nice = int(nice) - curnice
- bb.msg.note(2, bb.msg.domain.Build, "Renice to %s " % os.nice(nice))
+ buildlog.verbose("Renice to %s " % os.nice(nice))
def parseCommandLine(self):
# Parse any commandline into actions
@@ -126,11 +133,11 @@ class BBCooker:
self.commandlineAction = None
if 'world' in self.configuration.pkgs_to_build:
- bb.msg.error(bb.msg.domain.Build, "'world' is not a valid target for --environment.")
+ buildlog.error("'world' is not a valid target for --environment.")
elif len(self.configuration.pkgs_to_build) > 1:
- bb.msg.error(bb.msg.domain.Build, "Only one target can be used with the --environment option.")
+ buildlog.error("Only one target can be used with the --environment option.")
elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0:
- bb.msg.error(bb.msg.domain.Build, "No target should be used with the --environment and --buildfile options.")
+ buildlog.error("No target should be used with the --environment and --buildfile options.")
elif len(self.configuration.pkgs_to_build) > 0:
self.commandlineAction = ["showEnvironmentTarget", self.configuration.pkgs_to_build]
else:
@@ -148,13 +155,13 @@ class BBCooker:
self.commandlineAction = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd]
else:
self.commandlineAction = None
- bb.msg.error(bb.msg.domain.Build, "Please specify a package name for dependency graph generation.")
+ buildlog.error("Please specify a package name for dependency graph generation.")
else:
if self.configuration.pkgs_to_build:
self.commandlineAction = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd]
else:
self.commandlineAction = None
- bb.msg.error(bb.msg.domain.Build, "Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
+ buildlog.error("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
def runCommands(self, server, data, abort):
"""
@@ -180,8 +187,8 @@ class BBCooker:
preferred_versions[pn] = (pref_ver, pref_file)
latest_versions[pn] = (last_ver, last_file)
- bb.msg.plain("%-35s %25s %25s" % ("Package Name", "Latest Version", "Preferred Version"))
- bb.msg.plain("%-35s %25s %25s\n" % ("============", "==============", "================="))
+ logger.plain("%-35s %25s %25s", "Package Name", "Latest Version", "Preferred Version")
+ logger.plain("%-35s %25s %25s\n", "============", "==============", "=================")
for p in sorted(pkg_pn):
pref = preferred_versions[p]
@@ -193,7 +200,7 @@ class BBCooker:
if pref == latest:
prefstr = ""
- bb.msg.plain("%-35s %25s %25s" % (p, lateststr, prefstr))
+ logger.plain("%-35s %25s %25s", p, lateststr, prefstr)
def compareRevisions(self):
ret = bb.fetch.fetcher_compare_revisons(self.configuration.data)
@@ -230,27 +237,21 @@ class BBCooker:
if fn:
try:
envdata = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
- except IOError as e:
- bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e))
- raise
- except Exception as e:
- bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
+ except Exception, e:
+ parselog.exception("Unable to read %s", fn)
raise
# emit variables and shell functions
- try:
- data.update_data(envdata)
- with closing(StringIO()) as env:
- data.emit_env(env, envdata, True)
- bb.msg.plain(env.getvalue())
- except Exception as e:
- bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
+ data.update_data(envdata)
+ with closing(StringIO()) as env:
+ data.emit_env(env, envdata, True)
+ logger.plain(env.getvalue())
# emit the metadata which isnt valid shell
data.expandKeys(envdata)
for e in envdata.keys():
if data.getVarFlag( e, 'python', envdata ):
- bb.msg.plain("\npython %s () {\n%s}\n" % (e, data.getVar(e, envdata, 1)))
+ logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1))
def generateDepTreeData(self, pkgs_to_build, task):
"""
@@ -374,7 +375,7 @@ class BBCooker:
for rdepend in depgraph["rdepends-pn"][pn]:
print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file)
print("}", file=depends_file)
- bb.msg.plain("PN dependencies saved to 'pn-depends.dot'")
+ logger.info("PN dependencies saved to 'pn-depends.dot'")
depends_file = file('package-depends.dot', 'w' )
print("digraph depends {", file=depends_file)
@@ -395,7 +396,7 @@ class BBCooker:
for rdepend in depgraph["rrecs-pkg"][package]:
print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file)
print("}", file=depends_file)
- bb.msg.plain("Package dependencies saved to 'package-depends.dot'")
+ logger.info("Package dependencies saved to 'package-depends.dot'")
tdepends_file = file('task-depends.dot', 'w' )
print("digraph depends {", file=tdepends_file)
@@ -407,7 +408,7 @@ class BBCooker:
for dep in depgraph["tdepends"][task]:
print('"%s" -> "%s"' % (task, dep), file=tdepends_file)
print("}", file=tdepends_file)
- bb.msg.plain("Task dependencies saved to 'task-depends.dot'")
+ logger.info("Task dependencies saved to 'task-depends.dot'")
def buildDepgraph( self ):
all_depends = self.status.all_depends
@@ -431,10 +432,10 @@ class BBCooker:
try:
(providee, provider) = p.split(':')
except:
- bb.msg.fatal(bb.msg.domain.Provider, "Malformed option in PREFERRED_PROVIDERS variable: %s" % p)
+ providerlog.critical("Malformed option in PREFERRED_PROVIDERS variable: %s" % p)
continue
if providee in self.status.preferred and self.status.preferred[providee] != provider:
- bb.msg.error(bb.msg.domain.Provider, "conflicting preferences for %s: both %s and %s specified" % (providee, provider, self.status.preferred[providee]))
+ providerlog.error("conflicting preferences for %s: both %s and %s specified", providee, provider, self.status.preferred[providee])
self.status.preferred[providee] = provider
# Calculate priorities for each file
@@ -443,8 +444,7 @@ class BBCooker:
for collection, pattern, regex, _ in self.status.bbfile_config_priorities:
if not regex in matched:
- bb.msg.warn(bb.msg.domain.Provider, "No bb files matched BBFILE_PATTERN_%s '%s'" %
- (collection, pattern))
+ collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
def buildWorldTargetList(self):
"""
@@ -452,19 +452,19 @@ class BBCooker:
"""
all_depends = self.status.all_depends
pn_provides = self.status.pn_provides
- bb.msg.debug(1, bb.msg.domain.Parsing, "collating packages for \"world\"")
+ parselog.debug(1, "collating packages for \"world\"")
for f in self.status.possible_world:
terminal = True
pn = self.status.pkg_fn[f]
for p in pn_provides[pn]:
if p.startswith('virtual/'):
- bb.msg.debug(2, bb.msg.domain.Parsing, "World build skipping %s due to %s provider starting with virtual/" % (f, p))
+ parselog.debug(2, "World build skipping %s due to %s provider starting with virtual/", f, p)
terminal = False
break
for pf in self.status.providers[p]:
if self.status.pkg_fn[pf] != pn:
- bb.msg.debug(2, bb.msg.domain.Parsing, "World build skipping %s due to both us and %s providing %s" % (f, pf, p))
+ parselog.debug(2, "World build skipping %s due to both us and %s providing %s", f, pf, p)
terminal = False
break
if terminal:
@@ -478,8 +478,9 @@ class BBCooker:
"""Drop off into a shell"""
try:
from bb import shell
- except ImportError as details:
- bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details )
+ except ImportError:
+ parselog.exception("Interactive mode not available")
+ sys.exit(1)
else:
shell.start( self )
@@ -502,14 +503,14 @@ class BBCooker:
layerconf = self._findLayerConf()
if layerconf:
- bb.msg.debug(2, bb.msg.domain.Parsing, "Found bblayers.conf (%s)" % layerconf)
+ parselog.debug(2, "Found bblayers.conf (%s)", layerconf)
data = bb.parse.handle(layerconf, data)
layers = (bb.data.getVar('BBLAYERS', data, True) or "").split()
data = bb.data.createCopy(data)
for layer in layers:
- bb.msg.debug(2, bb.msg.domain.Parsing, "Adding layer %s" % layer)
+ parselog.debug(2, "Adding layer %s", layer)
bb.data.setVar('LAYERDIR', layer, data)
data = bb.parse.handle(os.path.join(layer, "conf", "layer.conf"), data)
@@ -529,7 +530,7 @@ class BBCooker:
bb.data.delVar('LAYERDIR', data)
if not data.getVar("BBPATH", True):
- bb.fatal("The BBPATH variable is not set")
+ raise SystemExit("The BBPATH variable is not set")
data = bb.parse.handle(os.path.join("conf", "bitbake.conf"), data)
@@ -553,10 +554,9 @@ class BBCooker:
bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
- except IOError as e:
- bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e)))
- except bb.parse.ParseError as details:
- bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) )
+ except (IOError, bb.parse.ParseError):
+ parselog.exception("Error when parsing %s", files)
+ sys.exit(1)
def handleCollections( self, collections ):
"""Handle collections"""
@@ -565,22 +565,22 @@ class BBCooker:
for c in collection_list:
regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1)
if regex == None:
- bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s not defined" % c)
+ parselog.error("BBFILE_PATTERN_%s not defined" % c)
continue
priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1)
if priority == None:
- bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PRIORITY_%s not defined" % c)
+ parselog.error("BBFILE_PRIORITY_%s not defined" % c)
continue
try:
cre = re.compile(regex)
except re.error:
- bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s \"%s\" is not a valid regular expression" % (c, regex))
+ parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
continue
try:
pri = int(priority)
self.status.bbfile_config_priorities.append((c, regex, cre, pri))
except ValueError:
- bb.msg.error(bb.msg.domain.Parsing, "invalid value for BBFILE_PRIORITY_%s: \"%s\"" % (c, priority))
+ parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
def buildSetVars(self):
"""
@@ -616,9 +616,9 @@ class BBCooker:
"""
matches = self.matchFiles(buildfile)
if len(matches) != 1:
- bb.msg.error(bb.msg.domain.Parsing, "Unable to match %s (%s matches found):" % (buildfile, len(matches)))
+ parselog.error("Unable to match %s (%s matches found):" % (buildfile, len(matches)))
for f in matches:
- bb.msg.error(bb.msg.domain.Parsing, " %s" % f)
+ parselog.error(" %s" % f)
raise MultipleMatches
return matches[0]
@@ -662,7 +662,7 @@ class BBCooker:
# Remove stamp for target if force mode active
if self.configuration.force:
- bb.msg.note(2, bb.msg.domain.RunQueue, "Remove stamp %s, %s" % (task, fn))
+ logger.verbose("Remove stamp %s, %s", task, fn)
bb.build.del_stamp('do_%s' % task, self.status, fn)
# Setup taskdata structure
@@ -691,7 +691,7 @@ class BBCooker:
retval = rq.execute_runqueue()
except runqueue.TaskFailure as exc:
for fnid in exc.args:
- bb.msg.error(bb.msg.domain.Build, "'%s' failed" % taskdata.fn_index[fnid])
+ buildlog.error("'%s' failed" % taskdata.fn_index[fnid])
failures = failures + 1
retval = False
if not retval:
@@ -728,7 +728,7 @@ class BBCooker:
retval = rq.ex