diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-06-10 10:35:31 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:33 +0000 |
| commit | ecc68fa4fbb579e97ea45156e79a293b073697a0 (patch) | |
| tree | 6d08682e43476e37ccf48ee14c8d81e208d1c897 /bitbake/lib/bb/parse | |
| parent | d3a45c7d41a88d79389fc40eb68816e4939fb6f9 (diff) | |
| download | poky-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/parse')
| -rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 9 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/ast.py | 12 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 9 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 5 |
4 files changed, 23 insertions, 12 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index da160ceb27..f9517f03f2 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py | |||
| @@ -26,9 +26,14 @@ File parsers for the BitBake build tools. | |||
| 26 | 26 | ||
| 27 | handlers = [] | 27 | handlers = [] |
| 28 | 28 | ||
| 29 | import bb, os | 29 | import os |
| 30 | import logging | ||
| 31 | import bb | ||
| 30 | import bb.utils | 32 | import bb.utils |
| 31 | import bb.siggen | 33 | import bb.siggen |
| 34 | import bb.utils | ||
| 35 | |||
| 36 | logger = logging.getLogger("BitBake.Parsing") | ||
| 32 | 37 | ||
| 33 | class ParseError(Exception): | 38 | class ParseError(Exception): |
| 34 | """Exception raised when parsing fails""" | 39 | """Exception raised when parsing fails""" |
| @@ -91,7 +96,7 @@ def resolve_file(fn, d): | |||
| 91 | raise IOError("file %s not found in %s" % (fn, bbpath)) | 96 | raise IOError("file %s not found in %s" % (fn, bbpath)) |
| 92 | fn = newfn | 97 | fn = newfn |
| 93 | 98 | ||
| 94 | bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % fn) | 99 | logger.debug(2, "LOAD %s", fn) |
| 95 | return fn | 100 | return fn |
| 96 | 101 | ||
| 97 | # Used by OpenEmbedded metadata | 102 | # Used by OpenEmbedded metadata |
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 870ae65b0e..55ab485990 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
| @@ -23,9 +23,13 @@ | |||
| 23 | 23 | ||
| 24 | from __future__ import absolute_import | 24 | from __future__ import absolute_import |
| 25 | from future_builtins import filter | 25 | from future_builtins import filter |
| 26 | import bb, re, string | 26 | import re |
| 27 | from bb import methodpool | 27 | import string |
| 28 | import logging | ||
| 29 | import bb | ||
| 28 | import itertools | 30 | import itertools |
| 31 | from bb import methodpool | ||
| 32 | from bb.parse import logger | ||
| 29 | 33 | ||
| 30 | __word__ = re.compile(r"\S+") | 34 | __word__ = re.compile(r"\S+") |
| 31 | __parsed_methods__ = bb.methodpool.get_parsed_dict() | 35 | __parsed_methods__ = bb.methodpool.get_parsed_dict() |
| @@ -51,7 +55,7 @@ class IncludeNode(AstNode): | |||
| 51 | Include the file and evaluate the statements | 55 | Include the file and evaluate the statements |
| 52 | """ | 56 | """ |
| 53 | s = bb.data.expand(self.what_file, data) | 57 | s = bb.data.expand(self.what_file, data) |
| 54 | bb.msg.debug(3, bb.msg.domain.Parsing, "CONF %s:%d: including %s" % (self.from_fn, self.from_lineno, s)) | 58 | logger.debug(2, "CONF %s:%s: including %s", self.from_fn, self.from_lineno, s) |
| 55 | 59 | ||
| 56 | # TODO: Cache those includes... maybe not here though | 60 | # TODO: Cache those includes... maybe not here though |
| 57 | if self.force: | 61 | if self.force: |
| @@ -365,7 +369,7 @@ def _expand_versions(versions): | |||
| 365 | def multi_finalize(fn, d): | 369 | def multi_finalize(fn, d): |
| 366 | appends = (d.getVar("__BBAPPEND", True) or "").split() | 370 | appends = (d.getVar("__BBAPPEND", True) or "").split() |
| 367 | for append in appends: | 371 | for append in appends: |
| 368 | bb.msg.debug(2, bb.msg.domain.Parsing, "Appending .bbappend file " + append + " to " + fn) | 372 | logger.debug(2, "Appending .bbappend file %s to %s", append, fn) |
| 369 | bb.parse.BBHandler.handle(append, d, True) | 373 | bb.parse.BBHandler.handle(append, d, True) |
| 370 | 374 | ||
| 371 | safe_d = d | 375 | safe_d = d |
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 51ad10fb92..31f44f7df3 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
| @@ -27,11 +27,12 @@ | |||
| 27 | 27 | ||
| 28 | from __future__ import absolute_import | 28 | from __future__ import absolute_import |
| 29 | import re, bb, os | 29 | import re, bb, os |
| 30 | import logging | ||
| 30 | import bb.fetch, bb.build, bb.utils | 31 | import bb.fetch, bb.build, bb.utils |
| 31 | from bb import data | 32 | from bb import data |
| 32 | 33 | ||
| 33 | from . import ConfHandler | 34 | from . import ConfHandler |
| 34 | from .. import resolve_file, ast | 35 | from .. import resolve_file, ast, logger |
| 35 | from .ConfHandler import include, init | 36 | from .ConfHandler import include, init |
| 36 | 37 | ||
| 37 | # For compatibility | 38 | # For compatibility |
| @@ -76,7 +77,7 @@ def inherit(files, d): | |||
| 76 | file = os.path.join('classes', '%s.bbclass' % file) | 77 | file = os.path.join('classes', '%s.bbclass' % file) |
| 77 | 78 | ||
| 78 | if not file in __inherit_cache: | 79 | if not file in __inherit_cache: |
| 79 | bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file)) | 80 | logger.log(logging.DEBUG -1, "BB %s:%d: inheriting %s", fn, lineno, file) |
| 80 | __inherit_cache.append( file ) | 81 | __inherit_cache.append( file ) |
| 81 | data.setVar('__inherit_cache', __inherit_cache, d) | 82 | data.setVar('__inherit_cache', __inherit_cache, d) |
| 82 | include(fn, file, d, "inherit") | 83 | include(fn, file, d, "inherit") |
| @@ -115,9 +116,9 @@ def handle(fn, d, include): | |||
| 115 | 116 | ||
| 116 | 117 | ||
| 117 | if include == 0: | 118 | if include == 0: |
| 118 | bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data)") | 119 | logger.debug(2, "BB %s: handle(data)", fn) |
| 119 | else: | 120 | else: |
| 120 | bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data, include)") | 121 | logger.debug(2, "BB %s: handle(data, include)", fn) |
| 121 | 122 | ||
| 122 | (root, ext) = os.path.splitext(os.path.basename(fn)) | 123 | (root, ext) = os.path.splitext(os.path.basename(fn)) |
| 123 | base_name = "%s%s" % (root, ext) | 124 | base_name = "%s%s" % (root, ext) |
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 9128a2ef8f..2abd2fdc25 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
| @@ -25,8 +25,9 @@ | |||
| 25 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 25 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 26 | 26 | ||
| 27 | import re, bb.data, os | 27 | import re, bb.data, os |
| 28 | import logging | ||
| 28 | import bb.utils | 29 | import bb.utils |
| 29 | from bb.parse import ParseError, resolve_file, ast | 30 | from bb.parse import ParseError, resolve_file, ast, logger |
| 30 | 31 | ||
| 31 | #__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") | 32 | #__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") |
| 32 | __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") | 33 | __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<lazyques>\?\?=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") |
| @@ -68,7 +69,7 @@ def include(oldfn, fn, data, error_out): | |||
| 68 | except IOError: | 69 | except IOError: |
| 69 | if error_out: | 70 | if error_out: |
| 70 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) | 71 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) |
| 71 | bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) | 72 | logger.debug(2, "CONF file '%s' not found", fn) |
| 72 | 73 | ||
| 73 | def handle(fn, data, include): | 74 | def handle(fn, data, include): |
| 74 | init(data) | 75 | init(data) |
