summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ff2af69069..ce7ca43d2a 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -193,7 +193,10 @@ class BBCooker:
193 if op == "append": 193 if op == "append":
194 self.appendConfigurationVar(var, val, default_file) 194 self.appendConfigurationVar(var, val, default_file)
195 elif op == "set": 195 elif op == "set":
196 self.saveConfigurationVar(var, val, default_file) 196 self.saveConfigurationVar(var, val, default_file, "=")
197 elif op == "earlyAssign":
198 self.saveConfigurationVar(var, val, default_file, "?=")
199
197 200
198 def appendConfigurationVar(self, var, val, default_file): 201 def appendConfigurationVar(self, var, val, default_file):
199 #add append var operation to the end of default_file 202 #add append var operation to the end of default_file
@@ -207,7 +210,7 @@ class BBCooker:
207 for c in contents: 210 for c in contents:
208 total += c 211 total += c
209 212
210 total += "#added by bitbake" 213 total += "#added by hob"
211 total += "\n%s += \"%s\"\n" % (var, val) 214 total += "\n%s += \"%s\"\n" % (var, val)
212 215
213 with open(default_file, 'w') as f: 216 with open(default_file, 'w') as f:
@@ -218,7 +221,7 @@ class BBCooker:
218 loginfo = {"op":append, "file":default_file, "line":total.count("\n")} 221 loginfo = {"op":append, "file":default_file, "line":total.count("\n")}
219 self.data.appendVar(var, val, **loginfo) 222 self.data.appendVar(var, val, **loginfo)
220 223
221 def saveConfigurationVar(self, var, val, default_file): 224 def saveConfigurationVar(self, var, val, default_file, op):
222 225
223 replaced = False 226 replaced = False
224 #do not save if nothing changed 227 #do not save if nothing changed
@@ -260,8 +263,8 @@ class BBCooker:
260 #check if the variable was saved before in the same way 263 #check if the variable was saved before in the same way
261 #if true it replace the place where the variable was declared 264 #if true it replace the place where the variable was declared
262 #else it comments it 265 #else it comments it
263 if contents[begin_line-1]== "#added by bitbake\n": 266 if contents[begin_line-1]== "#added by hob\n":
264 contents[begin_line] = "%s = \"%s\"\n" % (var, val) 267 contents[begin_line] = "%s %s \"%s\"\n" % (var, op, val)
265 replaced = True 268 replaced = True
266 else: 269 else:
267 for ii in range(begin_line, end_line): 270 for ii in range(begin_line, end_line):
@@ -290,8 +293,8 @@ class BBCooker:
290 total += c 293 total += c
291 294
292 #add the variable on a single line, to be easy to replace the second time 295 #add the variable on a single line, to be easy to replace the second time
293 total += "\n#added by bitbake" 296 total += "\n#added by hob"
294 total += "\n%s = \"%s\"\n" % (var, val) 297 total += "\n%s %s \"%s\"\n" % (var, op, val)
295 298
296 with open(default_file, 'w') as f: 299 with open(default_file, 'w') as f:
297 f.write(total) 300 f.write(total)