diff options
author | Saul Wold <Saul.Wold@intel.com> | 2010-08-26 19:48:26 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-02 09:38:34 +0100 |
commit | c52fcafe55885dc260f32fa19017e01228cd22a0 (patch) | |
tree | 2a708a13bec066628fe10525c1181a9341ace042 /meta/classes/distrodata.bbclass | |
parent | d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612 (diff) | |
download | openembedded-core-c52fcafe55885dc260f32fa19017e01228cd22a0.tar.gz openembedded-core-c52fcafe55885dc260f32fa19017e01228cd22a0.tar.bz2 openembedded-core-c52fcafe55885dc260f32fa19017e01228cd22a0.zip |
DistroData: add eventhandler to correctly setup log file
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r-- | meta/classes/distrodata.bbclass | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 86a614a01e..72dded6e9e 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass @@ -1,6 +1,27 @@ require conf/distro/include/distro_tracking_fields.inc +addhandler distro_eventhandler +python distro_eventhandler() { + from bb.event import Handled, NotHandled + # if bb.event.getName(e) == "TaskStarted": + + if bb.event.getName(e) == "BuildStarted": + """initialize log files.""" + logpath = bb.data.getVar('LOG_DIR', e.data, 1) + bb.utils.mkdirhier(logpath) + logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', e.data, 1)) + if not os.path.exists(logfile): + slogfile = os.path.join(logpath, "distrodata.csv") + if os.path.exists(slogfile): + os.remove(slogfile) + os.system("touch %s" % logfile) + os.symlink(logfile, slogfile) + bb.data.setVar('LOG_FILE', logfile, e.data) + + return NotHandled +} + addtask distrodata_np do_distrodata_np[nostamp] = "1" python do_distrodata_np() { @@ -71,16 +92,11 @@ python do_distrodata_np() { addtask distrodata do_distrodata[nostamp] = "1" python do_distrodata() { - """initialize log files.""" + logpath = bb.data.getVar('LOG_DIR', d, 1) bb.utils.mkdirhier(logpath) - logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', d, 1)) - if not os.path.exists(logfile): - slogfile = os.path.join(logpath, "distrodata.csv") - if os.path.exists(slogfile): - os.remove(slogfile) - os.system("touch %s" % logfile) - os.symlink(logfile, slogfile) + logfile = os.path.join(logpath, "distrodata.csv") + bb.note("LOG_FILE: %s\n" % logfile) localdata = bb.data.createCopy(d) pn = bb.data.getVar("PN", d, True) |