summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/command.py5
-rw-r--r--bitbake/lib/bb/cooker.py29
-rw-r--r--bitbake/lib/bb/data.py4
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py1
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py11
5 files changed, 47 insertions, 3 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 5eb34aff3d..33a24406b5 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -153,7 +153,7 @@ class CommandsSync:
153 varname = params[0] 153 varname = params[0]
154 expand = True 154 expand = True
155 if len(params) > 1: 155 if len(params) > 1:
156 expand = params[1] 156 expand = (params[1] == "True")
157 157
158 return command.cooker.data.getVar(varname, expand) 158 return command.cooker.data.getVar(varname, expand)
159 getVariable.readonly = True 159 getVariable.readonly = True
@@ -230,7 +230,8 @@ class CommandsSync:
230 var = params[0] 230 var = params[0]
231 val = params[1] 231 val = params[1]
232 default_file = params[2] 232 default_file = params[2]
233 command.cooker.saveConfigurationVar(var, val, default_file) 233 op = params[3]
234 command.cooker.modifyConfigurationVar(var, val, default_file, op)
234 235
235 def createConfigFile(self, command, params): 236 def createConfigFile(self, command, params):
236 """ 237 """
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
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 87c4808b5e..8c9cb0f025 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -97,6 +97,10 @@ def delVar(var, d):
97 """Removes a variable from the data set""" 97 """Removes a variable from the data set"""
98 d.delVar(var) 98 d.delVar(var)
99 99
100def appendVar(var, value, d):
101 """Append additional value to a variable"""
102 d.appendVar(var, value)
103
100def setVarFlag(var, flag, flagvalue, d): 104def setVarFlag(var, flag, flagvalue, d):
101 """Set a flag for a given variable to a given value""" 105 """Set a flag for a given variable to a given value"""
102 d.setVarFlag(var, flag, flagvalue) 106 d.setVarFlag(var, flag, flagvalue)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 6bf402405d..3ddfb36a0c 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -440,6 +440,7 @@ class Builder(gtk.Window):
440 self.handler.connect("recipe-populated", self.handler_recipe_populated_cb) 440 self.handler.connect("recipe-populated", self.handler_recipe_populated_cb)
441 self.handler.connect("package-populated", self.handler_package_populated_cb) 441 self.handler.connect("package-populated", self.handler_package_populated_cb)
442 442
443 self.handler.append_to_bbfiles("${TOPDIR}/recipes/images/*.bb")
443 self.initiate_new_build_async() 444 self.initiate_new_build_async()
444 445
445 signal.signal(signal.SIGINT, self.event_handle_SIGINT) 446 signal.signal(signal.SIGINT, self.event_handle_SIGINT)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 42fd0b972b..7854742d4a 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -471,9 +471,18 @@ class HobHandler(gobject.GObject):
471 471
472 def set_var_in_file(self, var, val, default_file=None): 472 def set_var_in_file(self, var, val, default_file=None):
473 self.runCommand(["enableDataTracking"]) 473 self.runCommand(["enableDataTracking"])
474 self.server.runCommand(["setVarFile", var, val, default_file]) 474 self.server.runCommand(["setVarFile", var, val, default_file, "set"])
475 self.runCommand(["disableDataTracking"]) 475 self.runCommand(["disableDataTracking"])
476 476
477 def append_var_in_file(self, var, val, default_file=None):
478 self.server.runCommand(["setVarFile", var, val, default_file, "append"])
479
480 def append_to_bbfiles(self, val):
481 bbfiles = self.runCommand(["getVariable", "BBFILES", "False"]) or ""
482 bbfiles = bbfiles.split()
483 if val not in bbfiles:
484 self.append_var_in_file("BBFILES", val, "local.conf")
485
477 def get_parameters(self): 486 def get_parameters(self):
478 # retrieve the parameters from bitbake 487 # retrieve the parameters from bitbake
479 params = {} 488 params = {}