summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py17
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py2
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py7
3 files changed, 17 insertions, 9 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)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 829281357d..46023cc585 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -198,7 +198,7 @@ class Configuration:
198 handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf") 198 handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf")
199 # local.conf 199 # local.conf
200 if not defaults: 200 if not defaults:
201 handler.set_var_in_file("MACHINE", self.curr_mach, "local.conf") 201 handler.early_assign_var_in_file("MACHINE", self.curr_mach, "local.conf")
202 handler.set_var_in_file("DISTRO", self.curr_distro, "local.conf") 202 handler.set_var_in_file("DISTRO", self.curr_distro, "local.conf")
203 handler.set_var_in_file("DL_DIR", self.dldir, "local.conf") 203 handler.set_var_in_file("DL_DIR", self.dldir, "local.conf")
204 handler.set_var_in_file("SSTATE_DIR", self.sstatedir, "local.conf") 204 handler.set_var_in_file("SSTATE_DIR", self.sstatedir, "local.conf")
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index ef74e563f9..3f5bebaca3 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -315,7 +315,7 @@ class HobHandler(gobject.GObject):
315 315
316 def set_machine(self, machine): 316 def set_machine(self, machine):
317 if machine: 317 if machine:
318 self.set_var_in_file("MACHINE", machine, "local.conf") 318 self.early_assign_var_in_file("MACHINE", machine, "local.conf")
319 319
320 def set_sdk_machine(self, sdk_machine): 320 def set_sdk_machine(self, sdk_machine):
321 self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf") 321 self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
@@ -472,6 +472,11 @@ class HobHandler(gobject.GObject):
472 self.server.runCommand(["setVarFile", var, val, default_file, "set"]) 472 self.server.runCommand(["setVarFile", var, val, default_file, "set"])
473 self.runCommand(["disableDataTracking"]) 473 self.runCommand(["disableDataTracking"])
474 474
475 def early_assign_var_in_file(self, var, val, default_file=None):
476 self.runCommand(["enableDataTracking"])
477 self.server.runCommand(["setVarFile", var, val, default_file, "earlyAssign"])
478 self.runCommand(["disableDataTracking"])
479
475 def append_var_in_file(self, var, val, default_file=None): 480 def append_var_in_file(self, var, val, default_file=None):
476 self.server.runCommand(["setVarFile", var, val, default_file, "append"]) 481 self.server.runCommand(["setVarFile", var, val, default_file, "append"])
477 482