diff options
| author | Cristiana Voicu <cristiana.voicu@intel.com> | 2013-07-29 11:44:58 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-06 13:02:24 +0100 |
| commit | bb8a265b0fa61a502c95b830ac82715e6685e2ab (patch) | |
| tree | e9b9facdca1126f32037309e21d9dc30253367ea /bitbake/lib/bb/cooker.py | |
| parent | 116219ce09c63dfdbf1f57563c6d0b400bd96823 (diff) | |
| download | poky-bb8a265b0fa61a502c95b830ac82715e6685e2ab.tar.gz | |
bitbake: 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]
(Bitbake rev: 4aedbee90bd92395c2460a68702e6ede00e256c9)
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 29 |
1 files changed, 29 insertions, 0 deletions
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 |
