diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2012-05-23 10:45:12 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-23 18:15:24 +0100 |
commit | 799e076938b49353d1653e90206701069b8edb0b (patch) | |
tree | 5e824d9c9b13d0262d635c592a8be15b078b79d4 /bitbake/lib/bb/build.py | |
parent | 63aaecb05724942fc254885f6a423974fc217521 (diff) | |
download | poky-799e076938b49353d1653e90206701069b8edb0b.tar.gz |
build.py: Add support for log and run filename changes
The format of the log file and run file are now selectable
using BB_LOGFMT and BB_RUNFMT, respectively.
The following values may be used:
{task} - task name
{taskfunc} - task.func or func, if task==func
{func} - function name, only available in BB_RUNFMT
{pid} - pid
The log/run files may be placed into a subdirectory that
is relative to T.
Default BB_LOGFMT is: log.{task}.{pid}
Default BB_RUNFMT is: run.{func}.{pid}
(Bitbake rev: 588da606eb81c52cb92d29041e1c67897427bfdf)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r-- | bitbake/lib/bb/build.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 363acedb4d..a9ba02d34f 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -174,8 +174,19 @@ def exec_func(func, d, dirs = None): | |||
174 | lockfiles = None | 174 | lockfiles = None |
175 | 175 | ||
176 | tempdir = data.getVar('T', d, 1) | 176 | tempdir = data.getVar('T', d, 1) |
177 | bb.utils.mkdirhier(tempdir) | 177 | |
178 | runfile = os.path.join(tempdir, 'run.{0}.{1}'.format(func, os.getpid())) | 178 | # or func allows items to be executed outside of the normal |
179 | # task set, such as buildhistory | ||
180 | task = data.getVar('BB_RUNTASK', d, 1) or func | ||
181 | if task == func: | ||
182 | taskfunc = task | ||
183 | else: | ||
184 | taskfunc = "%s.%s" % (task, func) | ||
185 | |||
186 | runfmt = data.getVar('BB_RUNFMT', d, 1) or "run.{func}.{pid}" | ||
187 | runfn = runfmt.format(taskfunc=taskfunc, task=task, func=func, pid=os.getpid()) | ||
188 | runfile = os.path.join(tempdir, runfn) | ||
189 | bb.utils.mkdirhier(os.path.dirname(runfile)) | ||
179 | 190 | ||
180 | with bb.utils.fileslocked(lockfiles): | 191 | with bb.utils.fileslocked(lockfiles): |
181 | if ispython: | 192 | if ispython: |
@@ -300,7 +311,8 @@ def _exec_task(fn, task, d, quieterr): | |||
300 | bb.utils.mkdirhier(tempdir) | 311 | bb.utils.mkdirhier(tempdir) |
301 | 312 | ||
302 | # Determine the logfile to generate | 313 | # Determine the logfile to generate |
303 | logbase = 'log.{0}.{1}'.format(task, os.getpid()) | 314 | logfmt = localdata.getVar('BB_LOGFMT', True) or 'log.{task}.{pid}' |
315 | logbase = logfmt.format(task=task, pid=os.getpid()) | ||
304 | 316 | ||
305 | # Document the order of the tasks... | 317 | # Document the order of the tasks... |
306 | logorder = os.path.join(tempdir, 'log.task_order') | 318 | logorder = os.path.join(tempdir, 'log.task_order') |
@@ -336,6 +348,7 @@ def _exec_task(fn, task, d, quieterr): | |||
336 | # Handle logfiles | 348 | # Handle logfiles |
337 | si = file('/dev/null', 'r') | 349 | si = file('/dev/null', 'r') |
338 | try: | 350 | try: |
351 | bb.utils.mkdirhier(os.path.dirname(logfn)) | ||
339 | logfile = file(logfn, 'w') | 352 | logfile = file(logfn, 'w') |
340 | except OSError: | 353 | except OSError: |
341 | logger.exception("Opening log file '%s'", logfn) | 354 | logger.exception("Opening log file '%s'", logfn) |
@@ -362,6 +375,7 @@ def _exec_task(fn, task, d, quieterr): | |||
362 | bblogger.addHandler(errchk) | 375 | bblogger.addHandler(errchk) |
363 | 376 | ||
364 | localdata.setVar('BB_LOGFILE', logfn) | 377 | localdata.setVar('BB_LOGFILE', logfn) |
378 | localdata.setVar('BB_RUNTASK', task) | ||
365 | 379 | ||
366 | event.fire(TaskStarted(task, localdata), localdata) | 380 | event.fire(TaskStarted(task, localdata), localdata) |
367 | try: | 381 | try: |