summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-20 13:00:59 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-20 15:10:32 +0100
commitdb6bd113d0d146c1e9db50dcf12b49ee0c8aaf14 (patch)
tree9bd91ec2c312b14c89533bee28c24844d9cb2071 /bitbake
parent2a4d076bdd1f4bac6a073f3e2f4e289e06f075bb (diff)
downloadpoky-db6bd113d0d146c1e9db50dcf12b49ee0c8aaf14.tar.gz
bitbake: build.py: Cleanup data store references
Clean up a number of old style accesses to the datastore. (Bitbake rev: d872fef2c38749c3c6f5d84344db3ec2f9f134ce) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 70d7165fcf..e28655e4b7 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -34,7 +34,7 @@ import bb
34import bb.msg 34import bb.msg
35import bb.process 35import bb.process
36from contextlib import nested 36from contextlib import nested
37from bb import data, event, utils 37from bb import event, utils
38 38
39bblogger = logging.getLogger('BitBake') 39bblogger = logging.getLogger('BitBake')
40logger = logging.getLogger('BitBake.Build') 40logger = logging.getLogger('BitBake.Build')
@@ -142,50 +142,50 @@ class LogTee(object):
142def exec_func(func, d, dirs = None): 142def exec_func(func, d, dirs = None):
143 """Execute an BB 'function'""" 143 """Execute an BB 'function'"""
144 144
145 body = data.getVar(func, d) 145 body = d.getVar(func)
146 if not body: 146 if not body:
147 if body is None: 147 if body is None:
148 logger.warn("Function %s doesn't exist", func) 148 logger.warn("Function %s doesn't exist", func)
149 return 149 return
150 150
151 flags = data.getVarFlags(func, d) 151 flags = d.getVarFlags(func)
152 cleandirs = flags.get('cleandirs') 152 cleandirs = flags.get('cleandirs')
153 if cleandirs: 153 if cleandirs:
154 for cdir in data.expand(cleandirs, d).split(): 154 for cdir in d.expand(cleandirs).split():
155 bb.utils.remove(cdir, True) 155 bb.utils.remove(cdir, True)
156 156
157 if dirs is None: 157 if dirs is None:
158 dirs = flags.get('dirs') 158 dirs = flags.get('dirs')
159 if dirs: 159 if dirs:
160 dirs = data.expand(dirs, d).split() 160 dirs = d.expand(dirs).split()
161 161
162 if dirs: 162 if dirs:
163 for adir in dirs: 163 for adir in dirs:
164 bb.utils.mkdirhier(adir) 164 bb.utils.mkdirhier(adir)
165 adir = dirs[-1] 165 adir = dirs[-1]
166 else: 166 else:
167 adir = data.getVar('B', d, 1) 167 adir = d.getVar('B', True)
168 bb.utils.mkdirhier(adir) 168 bb.utils.mkdirhier(adir)
169 169
170 ispython = flags.get('python') 170 ispython = flags.get('python')
171 171
172 lockflag = flags.get('lockfiles') 172 lockflag = flags.get('lockfiles')
173 if lockflag: 173 if lockflag:
174 lockfiles = [data.expand(f, d) for f in lockflag.split()] 174 lockfiles = [d.expand(f) for f in lockflag.split()]
175 else: 175 else:
176 lockfiles = None 176 lockfiles = None
177 177
178 tempdir = data.getVar('T', d, 1) 178 tempdir = d.getVar('T', True)
179 179
180 # or func allows items to be executed outside of the normal 180 # or func allows items to be executed outside of the normal
181 # task set, such as buildhistory 181 # task set, such as buildhistory
182 task = data.getVar('BB_RUNTASK', d, 1) or func 182 task = d.getVar('BB_RUNTASK', True) or func
183 if task == func: 183 if task == func:
184 taskfunc = task 184 taskfunc = task
185 else: 185 else:
186 taskfunc = "%s.%s" % (task, func) 186 taskfunc = "%s.%s" % (task, func)
187 187
188 runfmt = data.getVar('BB_RUNFMT', d, 1) or "run.{func}.{pid}" 188 runfmt = d.getVar('BB_RUNFMT', True) or "run.{func}.{pid}"
189 runfn = runfmt.format(taskfunc=taskfunc, task=task, func=func, pid=os.getpid()) 189 runfn = runfmt.format(taskfunc=taskfunc, task=task, func=func, pid=os.getpid())
190 runfile = os.path.join(tempdir, runfn) 190 runfile = os.path.join(tempdir, runfn)
191 bb.utils.mkdirhier(os.path.dirname(runfile)) 191 bb.utils.mkdirhier(os.path.dirname(runfile))
@@ -251,7 +251,7 @@ def exec_func_shell(func, d, runfile, cwd=None):
251 251
252 with open(runfile, 'w') as script: 252 with open(runfile, 'w') as script:
253 script.write('#!/bin/sh -e\n') 253 script.write('#!/bin/sh -e\n')
254 data.emit_func(func, script, d) 254 bb.data.emit_func(func, script, d)
255 255
256 if bb.msg.loggerVerboseLogs: 256 if bb.msg.loggerVerboseLogs:
257 script.write("set -x\n") 257 script.write("set -x\n")
@@ -284,13 +284,13 @@ def exec_func_shell(func, d, runfile, cwd=None):
284 bb.debug(2, "Shell function %s finished" % func) 284 bb.debug(2, "Shell function %s finished" % func)
285 285
286def _task_data(fn, task, d): 286def _task_data(fn, task, d):
287 localdata = data.createCopy(d) 287 localdata = bb.data.createCopy(d)
288 localdata.setVar('BB_FILENAME', fn) 288 localdata.setVar('BB_FILENAME', fn)
289 localdata.setVar('BB_CURRENTTASK', task[3:]) 289 localdata.setVar('BB_CURRENTTASK', task[3:])
290 localdata.setVar('OVERRIDES', 'task-%s:%s' % 290 localdata.setVar('OVERRIDES', 'task-%s:%s' %
291 (task[3:], d.getVar('OVERRIDES', False))) 291 (task[3:], d.getVar('OVERRIDES', False)))
292 localdata.finalize() 292 localdata.finalize()
293 data.expandKeys(localdata) 293 bb.data.expandKeys(localdata)
294 return localdata 294 return localdata
295 295
296def _exec_task(fn, task, d, quieterr): 296def _exec_task(fn, task, d, quieterr):
@@ -299,7 +299,7 @@ def _exec_task(fn, task, d, quieterr):
299 Execution of a task involves a bit more setup than executing a function, 299 Execution of a task involves a bit more setup than executing a function,
300 running it with its own local metadata, and with some useful variables set. 300 running it with its own local metadata, and with some useful variables set.
301 """ 301 """
302 if not data.getVarFlag(task, 'task', d): 302 if not d.getVarFlag(task, 'task'):
303 event.fire(TaskInvalid(task, d), d) 303 event.fire(TaskInvalid(task, d), d)
304 logger.error("No such task: %s" % task) 304 logger.error("No such task: %s" % task)
305 return 1 305 return 1
@@ -575,7 +575,7 @@ def stampfile(taskname, d, file_name = None):
575 return stamp_internal(taskname, d, file_name) 575 return stamp_internal(taskname, d, file_name)
576 576
577def add_tasks(tasklist, d): 577def add_tasks(tasklist, d):
578 task_deps = data.getVar('_task_deps', d) 578 task_deps = d.getVar('_task_deps')
579 if not task_deps: 579 if not task_deps:
580 task_deps = {} 580 task_deps = {}
581 if not 'tasks' in task_deps: 581 if not 'tasks' in task_deps:
@@ -584,18 +584,18 @@ def add_tasks(tasklist, d):
584 task_deps['parents'] = {} 584 task_deps['parents'] = {}
585 585
586 for task in tasklist: 586 for task in tasklist:
587 task = data.expand(task, d) 587 task = d.expand(task)
588 data.setVarFlag(task, 'task', 1, d) 588 d.setVarFlag(task, 'task', 1)
589 589
590 if not task in task_deps['tasks']: 590 if not task in task_deps['tasks']:
591 task_deps['tasks'].append(task) 591 task_deps['tasks'].append(task)
592 592
593 flags = data.getVarFlags(task, d) 593 flags = d.getVarFlags(task)
594 def getTask(name): 594 def getTask(name):
595 if not name in task_deps: 595 if not name in task_deps:
596 task_deps[name] = {} 596 task_deps[name] = {}
597 if name in flags: 597 if name in flags:
598 deptask = data.expand(flags[name], d) 598 deptask = d.expand(flags[name])
599 task_deps[name][task] = deptask 599 task_deps[name][task] = deptask
600 getTask('depends') 600 getTask('depends')
601 getTask('rdepends') 601 getTask('rdepends')
@@ -610,15 +610,15 @@ def add_tasks(tasklist, d):
610 task_deps['parents'][task] = [] 610 task_deps['parents'][task] = []
611 if 'deps' in flags: 611 if 'deps' in flags:
612 for dep in flags['deps']: 612 for dep in flags['deps']:
613 dep = data.expand(dep, d) 613 dep = d.expand(dep)
614 task_deps['parents'][task].append(dep) 614 task_deps['parents'][task].append(dep)
615 615
616 # don't assume holding a reference 616 # don't assume holding a reference
617 data.setVar('_task_deps', task_deps, d) 617 d.setVar('_task_deps', task_deps)
618 618
619def remove_task(task, kill, d): 619def remove_task(task, kill, d):
620 """Remove an BB 'task'. 620 """Remove an BB 'task'.
621 621
622 If kill is 1, also remove tasks that depend on this task.""" 622 If kill is 1, also remove tasks that depend on this task."""
623 623
624 data.delVarFlag(task, 'task', d) 624 d.delVarFlag(task, 'task')