diff options
author | Cristiana Voicu <cristiana.voicu@intel.com> | 2013-01-25 16:10:12 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-31 12:46:19 +0000 |
commit | f0aef9953d3504e673c8572f1ae64cefdf678b0f (patch) | |
tree | 51ff6cfd3d4d307074eb5ffd9956ee177c75717c /bitbake/lib/bb/data_smart.py | |
parent | 33c6c411ea7ada066122b758b05abf7472ca0a16 (diff) | |
download | poky-f0aef9953d3504e673c8572f1ae64cefdf678b0f.tar.gz |
bitbake: bitbake & hob: implement functions to assure consistency for configuration files
Added a new command in bitbake to save a variable in a file; added a function
in cooker which is called by this command.
Added new command in bitbake to enable/disable data tracking.
The function saveConfigurationVar from cooker.py saves a variable in the file that
is received by argument. It checks all the operations made on that variable, using the history.
If it's the first time when it does some changes on a variable,it comments the lines where
an operation is made on it, and it sets it in a line to the end of file. If it's not
the first time(it has a comment before), it replaces the line.
Made some changes in hob to save the variables from bblayers.conf and local.conf
using the bitbake command.
[YOCTO #2934]
(Bitbake rev: 55b814ccfa413d461d12956896364ab63eed70a8)
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index ddf98e6a2e..5bf11e5e0d 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -259,6 +259,27 @@ class VariableHistory(object): | |||
259 | o.write("#\n# $%s\n# [no history recorded]\n#\n" % var) | 259 | o.write("#\n# $%s\n# [no history recorded]\n#\n" % var) |
260 | o.write('# "%s"\n' % (commentVal)) | 260 | o.write('# "%s"\n' % (commentVal)) |
261 | 261 | ||
262 | def get_variable_files(self, var): | ||
263 | """Get the files where operations are made on a variable""" | ||
264 | var_history = self.variable(var) | ||
265 | files = [] | ||
266 | for event in var_history: | ||
267 | files.append(event['file']) | ||
268 | return files | ||
269 | |||
270 | def get_variable_lines(self, var, f): | ||
271 | """Get the line where a operation is made on a variable in file f""" | ||
272 | var_history = self.variable(var) | ||
273 | lines = [] | ||
274 | for event in var_history: | ||
275 | if f== event['file']: | ||
276 | line = event['line'] | ||
277 | lines.append(line) | ||
278 | return lines | ||
279 | |||
280 | def del_var_history(self, var): | ||
281 | if var in self.variables: | ||
282 | self.variables[var] = [] | ||
262 | 283 | ||
263 | class DataSmart(MutableMapping): | 284 | class DataSmart(MutableMapping): |
264 | def __init__(self, special = COWDictBase.copy(), seen = COWDictBase.copy() ): | 285 | def __init__(self, special = COWDictBase.copy(), seen = COWDictBase.copy() ): |
@@ -429,6 +450,7 @@ class DataSmart(MutableMapping): | |||
429 | 450 | ||
430 | 451 | ||
431 | def setVar(self, var, value, **loginfo): | 452 | def setVar(self, var, value, **loginfo): |
453 | #print("var=" + str(var) + " val=" + str(value)) | ||
432 | if 'op' not in loginfo: | 454 | if 'op' not in loginfo: |
433 | loginfo['op'] = "set" | 455 | loginfo['op'] = "set" |
434 | self.expand_cache = {} | 456 | self.expand_cache = {} |