summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/data.py33
-rw-r--r--bitbake/lib/bb/data_smart.py22
-rw-r--r--bitbake/lib/bb/fetch/__init__.py15
-rw-r--r--bitbake/lib/bb/runqueue.py16
4 files changed, 59 insertions, 27 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index b2025f0694..21cdde04a8 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -96,6 +96,19 @@ def getVar(var, d, exp = 0):
96 """ 96 """
97 return d.getVar(var,exp) 97 return d.getVar(var,exp)
98 98
99
100def renameVar(key, newkey, d):
101 """Renames a variable from key to newkey
102
103 Example:
104 >>> d = init()
105 >>> setVar('TEST', 'testcontents', d)
106 >>> renameVar('TEST', 'TEST2', d)
107 >>> print getVar('TEST2', d)
108 testcontents
109 """
110 d.renameVar(key, newkey)
111
99def delVar(var, d): 112def delVar(var, d):
100 """Removes a variable from the data set 113 """Removes a variable from the data set
101 114
@@ -276,24 +289,8 @@ def expandKeys(alterdata, readdata = None):
276 ekey = expand(key, readdata) 289 ekey = expand(key, readdata)
277 if key == ekey: 290 if key == ekey:
278 continue 291 continue
279 val = getVar(key, alterdata) 292
280 if val is None: 293 renameVar(key, ekey, alterdata)
281 continue
282# import copy
283# setVarFlags(ekey, copy.copy(getVarFlags(key, readdata)), alterdata)
284 setVar(ekey, val, alterdata)
285
286 for i in ('_append', '_prepend'):
287 dest = getVarFlag(ekey, i, alterdata) or []
288 src = getVarFlag(key, i, readdata) or []
289 dest.extend(src)
290 setVarFlag(ekey, i, dest, alterdata)
291
292 if key in alterdata._special_values[i]:
293 alterdata._special_values[i].remove(key)
294 alterdata._special_values[i].add(ekey)
295
296 delVar(key, alterdata)
297 294
298def expandData(alterdata, readdata = None): 295def expandData(alterdata, readdata = None):
299 """For each variable in alterdata, expand it, and update the var contents. 296 """For each variable in alterdata, expand it, and update the var contents.
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index ef1e9dda07..e879343f5d 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -170,6 +170,28 @@ class DataSmart:
170 return self.expand(value,var) 170 return self.expand(value,var)
171 return value 171 return value
172 172
173 def renameVar(self, key, newkey):
174 """
175 Rename the variable key to newkey
176 """
177 val = self.getVar(key, 0)
178 if val is None:
179 return
180
181 self.setVar(newkey, val)
182
183 for i in ('_append', '_prepend'):
184 dest = self.getVarFlag(newkey, i) or []
185 src = self.getVarFlag(key, i) or []
186 dest.extend(src)
187 self.setVarFlag(newkey, i, dest)
188
189 if self._special_values.has_key(i) and key in self._special_values[i]:
190 self._special_values[i].remove(key)
191 self._special_values[i].add(newkey)
192
193 self.delVar(key)
194
173 def delVar(self,var): 195 def delVar(self,var):
174 self.expand_cache = {} 196 self.expand_cache = {}
175 self.dict[var] = {} 197 self.dict[var] = {}
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 229b28c19d..bbff516ffc 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -24,7 +24,7 @@ BitBake build tools.
24# 24#
25# Based on functions from the base bb module, Copyright 2003 Holger Schurig 25# Based on functions from the base bb module, Copyright 2003 Holger Schurig
26 26
27import os, re 27import os, re, fcntl
28import bb 28import bb
29from bb import data 29from bb import data
30from bb import persist_data 30from bb import persist_data
@@ -140,9 +140,21 @@ def go(d):
140 # Touch md5 file to show activity 140 # Touch md5 file to show activity
141 os.utime(ud.md5, None) 141 os.utime(ud.md5, None)
142 continue 142 continue
143 lf = open(ud.lockfile, "a+")
144 fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
145 if ud.localfile and not m.forcefetch(u, ud, d) and os.path.exists(ud.md5):
146 # If someone else fetched this before we got the lock,
147 # notice and don't try again
148 os.utime(ud.md5, None)
149 fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
150 lf.close
151 continue
143 m.go(u, ud, d) 152 m.go(u, ud, d)
144 if ud.localfile and not m.forcefetch(u, ud, d): 153 if ud.localfile and not m.forcefetch(u, ud, d):
145 Fetch.write_md5sum(u, ud, d) 154 Fetch.write_md5sum(u, ud, d)
155 fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
156 lf.close
157
146 158
147def localpaths(d): 159def localpaths(d):
148 """ 160 """
@@ -264,6 +276,7 @@ class FetchData(object):
264 else: 276 else:
265 self.localpath = self.method.localpath(self.url, self, d) 277 self.localpath = self.method.localpath(self.url, self, d)
266 self.md5 = self.localpath + '.md5' 278 self.md5 = self.localpath + '.md5'
279 self.lockfile = self.localpath + '.lock'
267 # if user sets localpath for file, use it instead. 280 # if user sets localpath for file, use it instead.
268 281
269 282
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 21383f4206..c55a58da2b 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -22,7 +22,7 @@ Handles preparation and execution of a queue of tasks
22# with this program; if not, write to the Free Software Foundation, Inc., 22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
25from bb import msg, data, fetch, event, mkdirhier, utils 25from bb import msg, data, event, mkdirhier, utils
26from sets import Set 26from sets import Set
27import bb, os, sys 27import bb, os, sys
28import signal 28import signal
@@ -113,7 +113,7 @@ class RunQueue:
113 # Won't be in build_targets if ASSUME_PROVIDED 113 # Won't be in build_targets if ASSUME_PROVIDED
114 if depid in taskData.build_targets: 114 if depid in taskData.build_targets:
115 depdata = taskData.build_targets[depid][0] 115 depdata = taskData.build_targets[depid][0]
116 if depdata: 116 if depdata is not None:
117 dep = taskData.fn_index[depdata] 117 dep = taskData.fn_index[depdata]
118 depends.append(taskData.gettask_id(dep, taskname)) 118 depends.append(taskData.gettask_id(dep, taskname))
119 119
@@ -123,7 +123,7 @@ class RunQueue:
123 for depid in taskData.rdepids[fnid]: 123 for depid in taskData.rdepids[fnid]:
124 if depid in taskData.run_targets: 124 if depid in taskData.run_targets:
125 depdata = taskData.run_targets[depid][0] 125 depdata = taskData.run_targets[depid][0]
126 if depdata: 126 if depdata is not None:
127 dep = taskData.fn_index[depdata] 127 dep = taskData.fn_index[depdata]
128 depends.append(taskData.gettask_id(dep, taskname)) 128 depends.append(taskData.gettask_id(dep, taskname))
129 129
@@ -133,7 +133,7 @@ class RunQueue:
133 if depid in taskData.build_targets: 133 if depid in taskData.build_targets:
134 # Won't be in build_targets if ASSUME_PROVIDED 134 # Won't be in build_targets if ASSUME_PROVIDED
135 depdata = taskData.build_targets[depid][0] 135 depdata = taskData.build_targets[depid][0]
136 if depdata: 136 if depdata is not None:
137 dep = taskData.fn_index[depdata] 137 dep = taskData.fn_index[depdata]
138 depends.append(taskData.gettask_id(dep, idepend.split(":")[1])) 138 depends.append(taskData.gettask_id(dep, idepend.split(":")[1]))
139 139
@@ -148,11 +148,11 @@ class RunQueue:
148 dep_seen.append(depid) 148 dep_seen.append(depid)
149 if depid in taskData.build_targets: 149 if depid in taskData.build_targets:
150 depdata = taskData.build_targets[depid][0] 150 depdata = taskData.build_targets[depid][0]
151 if depdata: 151 if depdata is not None:
152 dep = taskData.fn_index[depdata] 152 dep = taskData.fn_index[depdata]
153 # Need to avoid creating new tasks here 153 # Need to avoid creating new tasks here
154 taskid = taskData.gettask_id(dep, taskname, False) 154 taskid = taskData.gettask_id(dep, taskname, False)
155 if taskid: 155 if taskid is not None:
156 depends.append(taskid) 156 depends.append(taskid)
157 fnid = taskData.tasks_fnid[taskid] 157 fnid = taskData.tasks_fnid[taskid]
158 else: 158 else:
@@ -180,11 +180,11 @@ class RunQueue:
180 rdep_seen.append(rdepid) 180 rdep_seen.append(rdepid)
181 if rdepid in taskData.run_targets: 181 if rdepid in taskData.run_targets:
182 depdata = taskData.run_targets[rdepid][0] 182 depdata = taskData.run_targets[rdepid][0]
183 if depdata: 183 if depdata is not None:
184 dep = taskData.fn_index[depdata] 184 dep = taskData.fn_index[depdata]
185 # Need to avoid creating new tasks here 185 # Need to avoid creating new tasks here
186 taskid = taskData.gettask_id(dep, taskname, False) 186 taskid = taskData.gettask_id(dep, taskname, False)
187 if taskid: 187 if taskid is not None:
188 depends.append(taskid) 188 depends.append(taskid)
189 fnid = taskData.tasks_fnid[taskid] 189 fnid = taskData.tasks_fnid[taskid]
190 else: 190 else: