diff options
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 7ca9947df8..a4a6be658d 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -162,6 +162,35 @@ class BBCooker: | |||
162 | self.data = self.databuilder.data | 162 | self.data = self.databuilder.data |
163 | self.data_hash = self.databuilder.data_hash | 163 | self.data_hash = self.databuilder.data_hash |
164 | 164 | ||
165 | def modifyConfigurationVar(self, var, val, default_file, op): | ||
166 | if op == "append": | ||
167 | self.appendConfigurationVar(var, val, default_file) | ||
168 | elif op == "set": | ||
169 | self.saveConfigurationVar(var, val, default_file) | ||
170 | |||
171 | def appendConfigurationVar(self, var, val, default_file): | ||
172 | #add append var operation to the end of default_file | ||
173 | default_file = bb.cookerdata.findConfigFile(default_file) | ||
174 | |||
175 | with open(default_file, 'r') as f: | ||
176 | contents = f.readlines() | ||
177 | f.close() | ||
178 | |||
179 | total = "" | ||
180 | for c in contents: | ||
181 | total += c | ||
182 | |||
183 | total += "#added by bitbake" | ||
184 | total += "\n%s += \"%s\"\n" % (var, val) | ||
185 | |||
186 | with open(default_file, 'w') as f: | ||
187 | f.write(total) | ||
188 | f.close() | ||
189 | |||
190 | #add to history | ||
191 | loginfo = {"op":append, "file":default_file, "line":total.count("\n")} | ||
192 | self.data.appendVar(var, val, **loginfo) | ||
193 | |||
165 | def saveConfigurationVar(self, var, val, default_file): | 194 | def saveConfigurationVar(self, var, val, default_file): |
166 | 195 | ||
167 | replaced = False | 196 | replaced = False |