summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildstats.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/buildstats.bbclass')
-rw-r--r--meta/classes/buildstats.bbclass36
1 files changed, 18 insertions, 18 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 96c98d409f..4cd8fe6936 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -21,25 +21,25 @@ def get_cputime():
21 return sum(int(field) for field in fields) 21 return sum(int(field) for field in fields)
22 22
23def set_bn(e): 23def set_bn(e):
24 bn = e.getPkgs()[0] + "-" + bb.data.getVar('MACHINE',e.data, True) 24 bn = e.getPkgs()[0] + "-" + e.data.getVar('MACHINE', True)
25 try: 25 try:
26 os.remove(bb.data.getVar('BNFILE', e.data, True)) 26 os.remove(e.data.getVar('BNFILE', True))
27 except: 27 except:
28 pass 28 pass
29 file = open(bb.data.getVar('BNFILE', e.data, True), "w") 29 file = open(e.data.getVar('BNFILE', True), "w")
30 file.write(os.path.join(bn, bb.data.getVar('BUILDNAME', e.data, True))) 30 file.write(os.path.join(bn, e.data.getVar('BUILDNAME', True)))
31 file.close() 31 file.close()
32 32
33def get_bn(e): 33def get_bn(e):
34 file = open(bb.data.getVar('BNFILE', e.data, True)) 34 file = open(e.data.getVar('BNFILE', True))
35 bn = file.readline() 35 bn = file.readline()
36 file.close() 36 file.close()
37 return bn 37 return bn
38 38
39def set_device(e): 39def set_device(e):
40 tmpdir = bb.data.getVar('TMPDIR', e.data, True) 40 tmpdir = e.data.getVar('TMPDIR', True)
41 try: 41 try:
42 os.remove(bb.data.getVar('DEVFILE', e.data, True)) 42 os.remove(e.data.getVar('DEVFILE', True))
43 except: 43 except:
44 pass 44 pass
45 ############################################################################ 45 ############################################################################
@@ -66,12 +66,12 @@ def set_device(e):
66 rdev=line.split()[2] 66 rdev=line.split()[2]
67 else: 67 else:
68 rdev="NoLogicalDevice" 68 rdev="NoLogicalDevice"
69 file = open(bb.data.getVar('DEVFILE', e.data, True), "w") 69 file = open(e.data.getVar('DEVFILE', True), "w")
70 file.write(rdev) 70 file.write(rdev)
71 file.close() 71 file.close()
72 72
73def get_device(e): 73def get_device(e):
74 file = open(bb.data.getVar('DEVFILE', e.data, True)) 74 file = open(e.data.getVar('DEVFILE', True))
75 device = file.readline() 75 device = file.readline()
76 file.close() 76 file.close()
77 return device 77 return device
@@ -126,7 +126,7 @@ def get_timedata(var, data):
126 126
127def write_task_data(status, logfile, dev, e): 127def write_task_data(status, logfile, dev, e):
128 bn = get_bn(e) 128 bn = get_bn(e)
129 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 129 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
130 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data)) 130 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
131 file = open(os.path.join(logfile), "a") 131 file = open(os.path.join(logfile), "a")
132 timedata = get_timedata("__timedata_task", e.data) 132 timedata = get_timedata("__timedata_task", e.data)
@@ -168,7 +168,7 @@ python run_buildstats () {
168 # set the buildname 168 # set the buildname
169 ######################################################################## 169 ########################################################################
170 try: 170 try:
171 bb.mkdirhier(bb.data.getVar('BUILDSTATS_BASE', e.data, True)) 171 bb.mkdirhier(e.data.getVar('BUILDSTATS_BASE', True))
172 except: 172 except:
173 pass 173 pass
174 set_bn(e) 174 set_bn(e)
@@ -176,7 +176,7 @@ python run_buildstats () {
176 set_device(e) 176 set_device(e)
177 device = get_device(e) 177 device = get_device(e)
178 178
179 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 179 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
180 try: 180 try:
181 bb.mkdirhier(bsdir) 181 bb.mkdirhier(bsdir)
182 except: 182 except:
@@ -199,7 +199,7 @@ python run_buildstats () {
199 elif isinstance(e, bb.event.BuildCompleted): 199 elif isinstance(e, bb.event.BuildCompleted):
200 bn = get_bn(e) 200 bn = get_bn(e)
201 device = get_device(e) 201 device = get_device(e)
202 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 202 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
203 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data)) 203 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
204 build_time = os.path.join(bsdir, "build_stats") 204 build_time = os.path.join(bsdir, "build_stats")
205 file = open(build_time, "a") 205 file = open(build_time, "a")
@@ -224,7 +224,7 @@ python run_buildstats () {
224 if isinstance(e, bb.build.TaskStarted): 224 if isinstance(e, bb.build.TaskStarted):
225 bn = get_bn(e) 225 bn = get_bn(e)
226 device = get_device(e) 226 device = get_device(e)
227 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 227 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
228 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data)) 228 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
229 if device != "NoLogicalDevice": 229 if device != "NoLogicalDevice":
230 set_diskdata("__diskdata_task", device, e.data) 230 set_diskdata("__diskdata_task", device, e.data)
@@ -242,14 +242,14 @@ python run_buildstats () {
242 elif isinstance(e, bb.build.TaskSucceeded): 242 elif isinstance(e, bb.build.TaskSucceeded):
243 bn = get_bn(e) 243 bn = get_bn(e)
244 device = get_device(e) 244 device = get_device(e)
245 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 245 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
246 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data)) 246 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
247 write_task_data("passed", os.path.join(taskdir, e.task), device, e) 247 write_task_data("passed", os.path.join(taskdir, e.task), device, e)
248 if e.task == "do_rootfs": 248 if e.task == "do_rootfs":
249 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 249 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
250 bs=os.path.join(bsdir, "build_stats") 250 bs=os.path.join(bsdir, "build_stats")
251 file = open(bs,"a") 251 file = open(bs,"a")
252 rootfs = bb.data.getVar('IMAGE_ROOTFS', e.data, True) 252 rootfs = e.data.getVar('IMAGE_ROOTFS', True)
253 rootfs_size = subprocess.Popen(["du", "-sh", rootfs], stdout=subprocess.PIPE).stdout.read() 253 rootfs_size = subprocess.Popen(["du", "-sh", rootfs], stdout=subprocess.PIPE).stdout.read()
254 file.write("Uncompressed Rootfs size: %s" % rootfs_size) 254 file.write("Uncompressed Rootfs size: %s" % rootfs_size)
255 file.close() 255 file.close()
@@ -257,7 +257,7 @@ python run_buildstats () {
257 elif isinstance(e, bb.build.TaskFailed): 257 elif isinstance(e, bb.build.TaskFailed):
258 bn = get_bn(e) 258 bn = get_bn(e)
259 device = get_device(e) 259 device = get_device(e)
260 bsdir = os.path.join(bb.data.getVar('BUILDSTATS_BASE', e.data, True), bn) 260 bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
261 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data)) 261 taskdir = os.path.join(bsdir, bb.data.expand("${PF}", e.data))
262 write_task_data("failed", os.path.join(taskdir, e.task), device, e) 262 write_task_data("failed", os.path.join(taskdir, e.task), device, e)
263 ######################################################################## 263 ########################################################################