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 | |
parent | d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612 (diff) | |
download | poky-c52fcafe55885dc260f32fa19017e01228cd22a0.tar.gz |
DistroData: add eventhandler to correctly setup log file
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/classes')
-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 @@ | |||
1 | 1 | ||
2 | require conf/distro/include/distro_tracking_fields.inc | 2 | require conf/distro/include/distro_tracking_fields.inc |
3 | 3 | ||
4 | addhandler distro_eventhandler | ||
5 | python distro_eventhandler() { | ||
6 | from bb.event import Handled, NotHandled | ||
7 | # if bb.event.getName(e) == "TaskStarted": | ||
8 | |||
9 | if bb.event.getName(e) == "BuildStarted": | ||
10 | """initialize log files.""" | ||
11 | logpath = bb.data.getVar('LOG_DIR', e.data, 1) | ||
12 | bb.utils.mkdirhier(logpath) | ||
13 | logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', e.data, 1)) | ||
14 | if not os.path.exists(logfile): | ||
15 | slogfile = os.path.join(logpath, "distrodata.csv") | ||
16 | if os.path.exists(slogfile): | ||
17 | os.remove(slogfile) | ||
18 | os.system("touch %s" % logfile) | ||
19 | os.symlink(logfile, slogfile) | ||
20 | bb.data.setVar('LOG_FILE', logfile, e.data) | ||
21 | |||
22 | return NotHandled | ||
23 | } | ||
24 | |||
4 | addtask distrodata_np | 25 | addtask distrodata_np |
5 | do_distrodata_np[nostamp] = "1" | 26 | do_distrodata_np[nostamp] = "1" |
6 | python do_distrodata_np() { | 27 | python do_distrodata_np() { |
@@ -71,16 +92,11 @@ python do_distrodata_np() { | |||
71 | addtask distrodata | 92 | addtask distrodata |
72 | do_distrodata[nostamp] = "1" | 93 | do_distrodata[nostamp] = "1" |
73 | python do_distrodata() { | 94 | python do_distrodata() { |
74 | """initialize log files.""" | 95 | |
75 | logpath = bb.data.getVar('LOG_DIR', d, 1) | 96 | logpath = bb.data.getVar('LOG_DIR', d, 1) |
76 | bb.utils.mkdirhier(logpath) | 97 | bb.utils.mkdirhier(logpath) |
77 | logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', d, 1)) | 98 | logfile = os.path.join(logpath, "distrodata.csv") |
78 | if not os.path.exists(logfile): | 99 | bb.note("LOG_FILE: %s\n" % logfile) |
79 | slogfile = os.path.join(logpath, "distrodata.csv") | ||
80 | if os.path.exists(slogfile): | ||
81 | os.remove(slogfile) | ||
82 | os.system("touch %s" % logfile) | ||
83 | os.symlink(logfile, slogfile) | ||
84 | 100 | ||
85 | localdata = bb.data.createCopy(d) | 101 | localdata = bb.data.createCopy(d) |
86 | pn = bb.data.getVar("PN", d, True) | 102 | pn = bb.data.getVar("PN", d, True) |