diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-12-09 23:38:35 -0500 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:48 +0000 |
| commit | aaa55880ac79f470e613130baefdf317a764cbf2 (patch) | |
| tree | 9ce5da72131cd6087afad976f51ab73457d201e4 /bitbake/lib/bb/build.py | |
| parent | 25e519a80fc453de1468823b2bf26ab053aa0dca (diff) | |
| download | poky-aaa55880ac79f470e613130baefdf317a764cbf2.tar.gz | |
build: send logging messages to the log file for python functions
(Bitbake rev: ee1cce6ab21ddda60a7a070d03e98ff8485a5e71)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/build.py')
| -rw-r--r-- | bitbake/lib/bb/build.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 5d07b06640..e4e767ebc1 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
| @@ -29,12 +29,14 @@ import os | |||
| 29 | import sys | 29 | import sys |
| 30 | import logging | 30 | import logging |
| 31 | import bb | 31 | import bb |
| 32 | import bb.msg | ||
| 32 | import bb.utils | 33 | import bb.utils |
| 33 | import bb.process | 34 | import bb.process |
| 34 | from contextlib import nested | 35 | from contextlib import nested |
| 35 | from bb import data, event, mkdirhier, utils | 36 | from bb import data, event, mkdirhier, utils |
| 36 | 37 | ||
| 37 | logger = logging.getLogger("BitBake.Build") | 38 | bblogger = logging.getLogger('BitBake') |
| 39 | logger = logging.getLogger('BitBake.Build') | ||
| 38 | 40 | ||
| 39 | NULL = open('/dev/null', 'r') | 41 | NULL = open('/dev/null', 'r') |
| 40 | 42 | ||
| @@ -164,7 +166,7 @@ def {function}(d): | |||
| 164 | 166 | ||
| 165 | {function}(d) | 167 | {function}(d) |
| 166 | """ | 168 | """ |
| 167 | #logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | 169 | logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") |
| 168 | def exec_func_python(func, d, runfile, logfile, cwd=None): | 170 | def exec_func_python(func, d, runfile, logfile, cwd=None): |
| 169 | """Execute a python BB 'function'""" | 171 | """Execute a python BB 'function'""" |
| 170 | 172 | ||
| @@ -181,9 +183,9 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): | |||
| 181 | if cwd: | 183 | if cwd: |
| 182 | os.chdir(cwd) | 184 | os.chdir(cwd) |
| 183 | 185 | ||
| 184 | #handler = logging.StreamHandler(logfile) | 186 | handler = logging.StreamHandler(logfile) |
| 185 | #handler.setFormatter(logformatter) | 187 | handler.setFormatter(logformatter) |
| 186 | #bblogger.addHandler(handler) | 188 | bblogger.addHandler(handler) |
| 187 | 189 | ||
| 188 | try: | 190 | try: |
| 189 | comp = utils.better_compile(code, func, bbfile) | 191 | comp = utils.better_compile(code, func, bbfile) |
| @@ -194,7 +196,7 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): | |||
| 194 | 196 | ||
| 195 | raise FuncFailed(func, None) | 197 | raise FuncFailed(func, None) |
| 196 | finally: | 198 | finally: |
| 197 | #bblogger.removeHandler(handler) | 199 | bblogger.removeHandler(handler) |
| 198 | if olddir: | 200 | if olddir: |
| 199 | os.chdir(olddir) | 201 | os.chdir(olddir) |
| 200 | 202 | ||
