aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-05-23 10:45:12 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-23 18:15:11 +0100
commit588da606eb81c52cb92d29041e1c67897427bfdf (patch)
treebe47bfe15fb19ba17f3eac3bb9a8f02164e8a1da /lib
parenta0f554d0e722b6705844c6031fdcafa5d1a1c8a7 (diff)
downloadbitbake-588da606eb81c52cb92d29041e1c67897427bfdf.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} Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/build.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 363acedb4..a9ba02d34 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -174,8 +174,19 @@ def exec_func(func, d, dirs = None):
lockfiles = None
tempdir = data.getVar('T', d, 1)
- bb.utils.mkdirhier(tempdir)
- runfile = os.path.join(tempdir, 'run.{0}.{1}'.format(func, os.getpid()))
+
+ # or func allows items to be executed outside of the normal
+ # task set, such as buildhistory
+ task = data.getVar('BB_RUNTASK', d, 1) or func
+ if task == func:
+ taskfunc = task
+ else:
+ taskfunc = "%s.%s" % (task, func)
+
+ runfmt = data.getVar('BB_RUNFMT', d, 1) or "run.{func}.{pid}"
+ runfn = runfmt.format(taskfunc=taskfunc, task=task, func=func, pid=os.getpid())
+ runfile = os.path.join(tempdir, runfn)
+ bb.utils.mkdirhier(os.path.dirname(runfile))
with bb.utils.fileslocked(lockfiles):
if ispython:
@@ -300,7 +311,8 @@ def _exec_task(fn, task, d, quieterr):
bb.utils.mkdirhier(tempdir)
# Determine the logfile to generate
- logbase = 'log.{0}.{1}'.format(task, os.getpid())
+ logfmt = localdata.getVar('BB_LOGFMT', True) or 'log.{task}.{pid}'
+ logbase = logfmt.format(task=task, pid=os.getpid())
# Document the order of the tasks...
logorder = os.path.join(tempdir, 'log.task_order')
@@ -336,6 +348,7 @@ def _exec_task(fn, task, d, quieterr):
# Handle logfiles
si = file('/dev/null', 'r')
try:
+ bb.utils.mkdirhier(os.path.dirname(logfn))
logfile = file(logfn, 'w')
except OSError:
logger.exception("Opening log file '%s'", logfn)
@@ -362,6 +375,7 @@ def _exec_task(fn, task, d, quieterr):
bblogger.addHandler(errchk)
localdata.setVar('BB_LOGFILE', logfn)
+ localdata.setVar('BB_RUNTASK', task)
event.fire(TaskStarted(task, localdata), localdata)
try: