From: Mark Hatle <mark.hatle@windriver.com>
To: <bitbake-devel@lists.openembedded.org>
Subject: [PATCH 3/3] build.py: Add support for log and run filename changes
Date: Tue, 22 May 2012 20:46:32 -0500 [thread overview]
Message-ID: <1337737597-5964-3-git-send-email-mark.hatle@windriver.com> (raw)
In-Reply-To: <cover.1337714416.git.mark.hatle@windriver.com>
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>
---
lib/bb/build.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 2fbe120..e867894 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:
@@ -302,7 +313,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')
@@ -338,6 +350,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)
@@ -364,6 +377,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:
--
1.7.3.4
next prev parent reply other threads:[~2012-05-23 1:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 1:46 [PATCH 0/3] RFC: Refactor/cleanup logging/run file generation Mark Hatle
2012-05-23 0:06 ` [PATCH 1/3] build.py: Add a log to capture task execution order Mark Hatle
2012-05-23 0:06 ` [PATCH 2/3] build.py: Add additional debug messages Mark Hatle
2012-05-23 0:06 ` [PATCH 3/3] build.py: Add support for log and run filename changes Mark Hatle
2012-05-23 1:46 ` [PATCH 1/3] build.py: Add a log to capture task execution order Mark Hatle
2012-05-23 1:46 ` [PATCH 2/3] build.py: Add additional debug messages Mark Hatle
2012-05-23 13:50 ` Richard Purdie
2012-05-23 1:46 ` Mark Hatle [this message]
2012-05-23 15:45 ` [PATCH 1/4] build.py: Add a log to capture task execution order Mark Hatle
2012-05-23 17:15 ` Richard Purdie
2012-05-23 15:45 ` [PATCH 2/4] build.py: Cleanup exec_func_shell Mark Hatle
2012-05-23 15:45 ` [PATCH 3/4] build.py: Add additional debug messages Mark Hatle
2012-05-23 15:45 ` [PATCH 4/4] build.py: Add support for log and run filename changes Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337737597-5964-3-git-send-email-mark.hatle@windriver.com \
--to=mark.hatle@windriver.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox