diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-09 15:00:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-10 11:51:19 +0000 |
commit | c8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch) | |
tree | 5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/buildstats.bbclass | |
parent | 5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff) | |
download | poky-c8dee9b92dfd545852ecac8dc2adfc95ac02e957.tar.gz |
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildstats.bbclass')
-rw-r--r-- | meta/classes/buildstats.bbclass | 36 |
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 | ||
23 | def set_bn(e): | 23 | def 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 | ||
33 | def get_bn(e): | 33 | def 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 | ||
39 | def set_device(e): | 39 | def 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 | ||
73 | def get_device(e): | 73 | def 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 | ||
127 | def write_task_data(status, logfile, dev, e): | 127 | def 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 | ######################################################################## |