diff options
| -rw-r--r-- | bitbake/ChangeLog | 6 | ||||
| -rw-r--r-- | bitbake/lib/bb/data.py | 33 | ||||
| -rw-r--r-- | bitbake/lib/bb/data_smart.py | 22 | ||||
| -rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 15 | ||||
| -rw-r--r-- | bitbake/lib/bb/runqueue.py | 16 |
5 files changed, 65 insertions, 27 deletions
diff --git a/bitbake/ChangeLog b/bitbake/ChangeLog index 1fbbd710bb..878afadb43 100644 --- a/bitbake/ChangeLog +++ b/bitbake/ChangeLog | |||
| @@ -18,8 +18,14 @@ Changes in Bitbake 1.8.x: | |||
| 18 | - Fix local fetcher's localpath return values | 18 | - Fix local fetcher's localpath return values |
| 19 | - Apply OVERRIDES before performing immediate expansions | 19 | - Apply OVERRIDES before performing immediate expansions |
| 20 | - Allow the -b -e option combination to take regular expressions | 20 | - Allow the -b -e option combination to take regular expressions |
| 21 | - Add plain message function to bb.msg | ||
| 22 | - Sort the list of providers before processing so dependency problems are | ||
| 23 | reproducible rather than effectively random | ||
| 24 | - Add locking for fetchers so only one tries to fetch a given file at a given time | ||
| 25 | - Fix int(0)/None confusion in runqueue.py which causes random gaps in dependency chains | ||
| 21 | - Fix handling of variables with expansion in the name using _append/_prepend | 26 | - Fix handling of variables with expansion in the name using _append/_prepend |
| 22 | e.g. RRECOMMENDS_${PN}_append_xyz = "abc" | 27 | e.g. RRECOMMENDS_${PN}_append_xyz = "abc" |
| 28 | |||
| 23 | 29 | ||
| 24 | Changes in Bitbake 1.8.6: | 30 | Changes in Bitbake 1.8.6: |
| 25 | - Correctly redirect stdin when forking | 31 | - Correctly redirect stdin when forking |
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 | |||
| 100 | def 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 | |||
| 99 | def delVar(var, d): | 112 | def 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 | ||
| 298 | def expandData(alterdata, readdata = None): | 295 | def 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 | ||
| 27 | import os, re | 27 | import os, re, fcntl |
| 28 | import bb | 28 | import bb |
| 29 | from bb import data | 29 | from bb import data |
| 30 | from bb import persist_data | 30 | from 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 | ||
| 147 | def localpaths(d): | 159 | def 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 | ||
| 25 | from bb import msg, data, fetch, event, mkdirhier, utils | 25 | from bb import msg, data, event, mkdirhier, utils |
| 26 | from sets import Set | 26 | from sets import Set |
| 27 | import bb, os, sys | 27 | import bb, os, sys |
| 28 | import signal | 28 | import 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: |
