diff options
Diffstat (limited to 'bitbake/lib/bb/data.py')
| -rw-r--r-- | bitbake/lib/bb/data.py | 33 |
1 files changed, 15 insertions, 18 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 | |||
| 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. |
