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.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ce7ca43d2a..d17716d39e 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -304,6 +304,44 @@ class BBCooker:
304 loginfo = {"op":set, "file":default_file, "line":total.count("\n")} 304 loginfo = {"op":set, "file":default_file, "line":total.count("\n")}
305 self.data.setVar(var, val, **loginfo) 305 self.data.setVar(var, val, **loginfo)
306 306
307 def removeConfigurationVar(self, var):
308 conf_files = self.data.varhistory.get_variable_files(var)
309 topdir = self.data.getVar("TOPDIR")
310
311 for conf_file in conf_files:
312 if topdir in conf_file:
313 with open(conf_file, 'r') as f:
314 contents = f.readlines()
315 f.close()
316
317 lines = self.data.varhistory.get_variable_lines(var, conf_file)
318 for line in lines:
319 total = ""
320 i = 0
321 for c in contents:
322 total += c
323 i = i + 1
324 if i==int(line):
325 end_index = len(total)
326 index = total.rfind(var, 0, end_index)
327
328 begin_line = total.count("\n",0,index)
329
330 #check if the variable was saved before in the same way
331 if contents[begin_line-1]== "#added by bitbake\n":
332 contents[begin_line-1] = contents[begin_line] = "\n"
333 else:
334 contents[begin_line] = "\n"
335 #remove var from history
336 self.data.varhistory.del_var_history(var, conf_file, line)
337
338 total = ""
339 for c in contents:
340 total += c
341 with open(conf_file, 'w') as f:
342 f.write(total)
343 f.close()
344
307 def createConfigFile(self, name): 345 def createConfigFile(self, name):
308 path = os.getcwd() 346 path = os.getcwd()
309 confpath = os.path.join(path, "conf", name) 347 confpath = os.path.join(path, "conf", name)