summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@intel.com>2010-08-26 19:48:26 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-02 09:38:34 +0100
commitc52fcafe55885dc260f32fa19017e01228cd22a0 (patch)
tree2a708a13bec066628fe10525c1181a9341ace042 /meta
parentd62ee7eaf2ba025c3f64b2d4e10dc7cec4637612 (diff)
downloadpoky-c52fcafe55885dc260f32fa19017e01228cd22a0.tar.gz
DistroData: add eventhandler to correctly setup log file
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/distrodata.bbclass32
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
2require conf/distro/include/distro_tracking_fields.inc 2require conf/distro/include/distro_tracking_fields.inc
3 3
4addhandler distro_eventhandler
5python 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
4addtask distrodata_np 25addtask distrodata_np
5do_distrodata_np[nostamp] = "1" 26do_distrodata_np[nostamp] = "1"
6python do_distrodata_np() { 27python do_distrodata_np() {
@@ -71,16 +92,11 @@ python do_distrodata_np() {
71addtask distrodata 92addtask distrodata
72do_distrodata[nostamp] = "1" 93do_distrodata[nostamp] = "1"
73python do_distrodata() { 94python 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)