summaryrefslogtreecommitdiffstats
path: root/lib/bb/cooker.py
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2013-07-29 11:44:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-06 12:59:21 +0100
commit4aedbee90bd92395c2460a68702e6ede00e256c9 (patch)
tree7c080f0b5abde79a0e3bc1ba44887c833b26115b /lib/bb/cooker.py
parent0aba493103d1fe50026a47db16529febbbbd77a2 (diff)
downloadbitbake-4aedbee90bd92395c2460a68702e6ede00e256c9.tar.gz
hob & bitbake: append a value to a variable from hob throught bitbake
It was necessary to append ${TOPDIR}/recipes/images to BBFILES. Implemented the mechanism to append a value to a variable: a command and the method in cooker. [YOCTO #4193] Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cooker.py')
-rw-r--r--lib/bb/cooker.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 7ca9947df..a4a6be658 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -162,6 +162,35 @@ class BBCooker:
self.data = self.databuilder.data
self.data_hash = self.databuilder.data_hash
+ def modifyConfigurationVar(self, var, val, default_file, op):
+ if op == "append":
+ self.appendConfigurationVar(var, val, default_file)
+ elif op == "set":
+ self.saveConfigurationVar(var, val, default_file)
+
+ def appendConfigurationVar(self, var, val, default_file):
+ #add append var operation to the end of default_file
+ default_file = bb.cookerdata.findConfigFile(default_file)
+
+ with open(default_file, 'r') as f:
+ contents = f.readlines()
+ f.close()
+
+ total = ""
+ for c in contents:
+ total += c
+
+ total += "#added by bitbake"
+ total += "\n%s += \"%s\"\n" % (var, val)
+
+ with open(default_file, 'w') as f:
+ f.write(total)
+ f.close()
+
+ #add to history
+ loginfo = {"op":append, "file":default_file, "line":total.count("\n")}
+ self.data.appendVar(var, val, **loginfo)
+
def saveConfigurationVar(self, var, val, default_file):
replaced = False