summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2013-01-25 16:10:12 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-31 12:46:19 +0000
commitf0aef9953d3504e673c8572f1ae64cefdf678b0f (patch)
tree51ff6cfd3d4d307074eb5ffd9956ee177c75717c /bitbake/lib/bb/ui/crumbs
parent33c6c411ea7ada066122b758b05abf7472ca0a16 (diff)
downloadpoky-f0aef9953d3504e673c8572f1ae64cefdf678b0f.tar.gz
bitbake: bitbake & hob: implement functions to assure consistency for configuration files
Added a new command in bitbake to save a variable in a file; added a function in cooker which is called by this command. Added new command in bitbake to enable/disable data tracking. The function saveConfigurationVar from cooker.py saves a variable in the file that is received by argument. It checks all the operations made on that variable, using the history. If it's the first time when it does some changes on a variable,it comments the lines where an operation is made on it, and it sets it in a line to the end of file. If it's not the first time(it has a comment before), it replaces the line. Made some changes in hob to save the variables from bblayers.conf and local.conf using the bitbake command. [YOCTO #2934] (Bitbake rev: 55b814ccfa413d461d12956896364ab63eed70a8) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py32
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py5
-rw-r--r--bitbake/lib/bb/ui/crumbs/template.py24
3 files changed, 24 insertions, 37 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 9da926dd14..e9cfa2197c 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -217,26 +217,32 @@ class Configuration:
217 self.split_proxy("git", template.getVar("GIT_PROXY_HOST") + ":" + template.getVar("GIT_PROXY_PORT")) 217 self.split_proxy("git", template.getVar("GIT_PROXY_HOST") + ":" + template.getVar("GIT_PROXY_PORT"))
218 self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT")) 218 self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT"))
219 219
220 def save(self, template, defaults=False): 220 def save(self, handler, template, defaults=False):
221 template.setVar("VERSION", "%s" % hobVer) 221 template.setVar("VERSION", "%s" % hobVer)
222 # bblayers.conf 222 # bblayers.conf
223 template.setVar("BBLAYERS", " ".join(self.layers)) 223 handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf")
224 # local.conf 224 # local.conf
225 if not defaults: 225 if not defaults:
226 template.setVar("MACHINE", self.curr_mach) 226 handler.set_var_in_file("MACHINE", self.curr_mach, "local.conf")
227 template.setVar("DISTRO", self.curr_distro) 227 handler.set_var_in_file("DISTRO", self.curr_distro, "local.conf")
228 template.setVar("DL_DIR", self.dldir) 228 handler.set_var_in_file("DL_DIR", self.dldir, "local.conf")
229 template.setVar("SSTATE_DIR", self.sstatedir) 229 handler.set_var_in_file("SSTATE_DIR", self.sstatedir, "local.conf")
230 template.setVar("SSTATE_MIRRORS", self.sstatemirror) 230 sstate_mirror_list = self.sstatemirror.split("\\n ")
231 template.setVar("PARALLEL_MAKE", "-j %s" % self.pmake) 231 sstate_mirror_list_modified = []
232 template.setVar("BB_NUMBER_THREADS", self.bbthread) 232 for mirror in sstate_mirror_list:
233 template.setVar("PACKAGE_CLASSES", " ".join(["package_" + i for i in self.curr_package_format.split()])) 233 if mirror != "":
234 mirror = mirror + "\\n"
235 sstate_mirror_list_modified.append(mirror)
236 handler.set_var_in_file("SSTATE_MIRRORS", sstate_mirror_list_modified, "local.conf")
237 handler.set_var_in_file("PARALLEL_MAKE", "-j %s" % self.pmake, "local.conf")
238 handler.set_var_in_file("BB_NUMBER_THREADS", self.bbthread, "local.conf")
239 handler.set_var_in_file("PACKAGE_CLASSES", " ".join(["package_" + i for i in self.curr_package_format.split()]), "local.conf")
234 template.setVar("IMAGE_ROOTFS_SIZE", self.image_rootfs_size) 240 template.setVar("IMAGE_ROOTFS_SIZE", self.image_rootfs_size)
235 template.setVar("IMAGE_EXTRA_SPACE", self.image_extra_size) 241 template.setVar("IMAGE_EXTRA_SPACE", self.image_extra_size)
236 template.setVar("INCOMPATIBLE_LICENSE", self.incompat_license) 242 template.setVar("INCOMPATIBLE_LICENSE", self.incompat_license)
237 template.setVar("SDKMACHINE", self.curr_sdk_machine) 243 template.setVar("SDKMACHINE", self.curr_sdk_machine)
238 template.setVar("CONF_VERSION", self.conf_version) 244 handler.set_var_in_file("CONF_VERSION", self.conf_version, "local.conf")
239 template.setVar("LCONF_VERSION", self.lconf_version) 245 handler.set_var_in_file("LCONF_VERSION", self.lconf_version, "bblayers.conf")
240 template.setVar("EXTRA_SETTING", self.extra_setting) 246 template.setVar("EXTRA_SETTING", self.extra_setting)
241 template.setVar("TOOLCHAIN_BUILD", self.toolchain_build) 247 template.setVar("TOOLCHAIN_BUILD", self.toolchain_build)
242 template.setVar("IMAGE_FSTYPES", self.image_fstypes) 248 template.setVar("IMAGE_FSTYPES", self.image_fstypes)
@@ -670,7 +676,7 @@ class Builder(gtk.Window):
670 self.template = TemplateMgr() 676 self.template = TemplateMgr()
671 try: 677 try:
672 self.template.open(filename, path) 678 self.template.open(filename, path)
673 self.configuration.save(self.template, defaults) 679 self.configuration.save(self.handler, self.template, defaults)
674 680
675 self.template.save() 681 self.template.save()
676 except Exception as e: 682 except Exception as e:
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 41022ef8eb..d953f3497c 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -146,7 +146,9 @@ class HobHandler(gobject.GObject):
146 elif next_command == self.SUB_MATCH_CLASS: 146 elif next_command == self.SUB_MATCH_CLASS:
147 self.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"]) 147 self.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
148 elif next_command == self.SUB_PARSE_CONFIG: 148 elif next_command == self.SUB_PARSE_CONFIG:
149 self.runCommand(["enableDataTracking"])
149 self.runCommand(["parseConfigurationFiles", "", ""]) 150 self.runCommand(["parseConfigurationFiles", "", ""])
151 self.runCommand(["disableDataTracking"])
150 elif next_command == self.SUB_GNERATE_TGTS: 152 elif next_command == self.SUB_GNERATE_TGTS:
151 self.runCommand(["generateTargetsTree", "classes/image.bbclass", []]) 153 self.runCommand(["generateTargetsTree", "classes/image.bbclass", []])
152 elif next_command == self.SUB_GENERATE_PKGINFO: 154 elif next_command == self.SUB_GENERATE_PKGINFO:
@@ -451,6 +453,9 @@ class HobHandler(gobject.GObject):
451 ret.append(i) 453 ret.append(i)
452 return " ".join(ret) 454 return " ".join(ret)
453 455
456 def set_var_in_file(self, var, val, default_file=None):
457 self.server.runCommand(["setVarFile", var, val, default_file])
458
454 def get_parameters(self): 459 def get_parameters(self):
455 # retrieve the parameters from bitbake 460 # retrieve the parameters from bitbake
456 params = {} 461 params = {}
diff --git a/bitbake/lib/bb/ui/crumbs/template.py b/bitbake/lib/bb/ui/crumbs/template.py
index e303c3a6b8..92c438f000 100644
--- a/bitbake/lib/bb/ui/crumbs/template.py
+++ b/bitbake/lib/bb/ui/crumbs/template.py
@@ -137,8 +137,6 @@ class RecipeFile(ConfigFile):
137 137
138class TemplateMgr(gobject.GObject): 138class TemplateMgr(gobject.GObject):
139 139
140 __gLocalVars__ = ["MACHINE", "PACKAGE_CLASSES", "DISTRO", "DL_DIR", "SSTATE_DIR", "SSTATE_MIRRORS", "PARALLEL_MAKE", "BB_NUMBER_THREADS", "CONF_VERSION"]
141 __gBBLayersVars__ = ["BBLAYERS", "LCONF_VERSION"]
142 __gRecipeVars__ = ["DEPENDS", "IMAGE_INSTALL"] 140 __gRecipeVars__ = ["DEPENDS", "IMAGE_INSTALL"]
143 141
144 def __init__(self): 142 def __init__(self):
@@ -153,36 +151,20 @@ class TemplateMgr(gobject.GObject):
153 return "%s/%s%s%s" % (path, "template-", filename, ".hob") 151 return "%s/%s%s%s" % (path, "template-", filename, ".hob")
154 152
155 @classmethod 153 @classmethod
156 def convert_to_bblayers_pathfilename(cls, filename, path):
157 return "%s/%s%s%s" % (path, "bblayers-", filename, ".conf")
158
159 @classmethod
160 def convert_to_local_pathfilename(cls, filename, path):
161 return "%s/%s%s%s" % (path, "local-", filename, ".conf")
162
163 @classmethod
164 def convert_to_image_pathfilename(cls, filename, path): 154 def convert_to_image_pathfilename(cls, filename, path):
165 return "%s/%s%s%s" % (path, "hob-image-", filename, ".bb") 155 return "%s/%s%s%s" % (path, "hob-image-", filename, ".bb")
166 156
167 def open(self, filename, path): 157 def open(self, filename, path):
168 self.template_hob = HobTemplateFile(TemplateMgr.convert_to_template_pathfilename(filename, path)) 158 self.template_hob = HobTemplateFile(TemplateMgr.convert_to_template_pathfilename(filename, path))
169 self.bblayers_conf = ConfigFile(TemplateMgr.convert_to_bblayers_pathfilename(filename, path))
170 self.local_conf = ConfigFile(TemplateMgr.convert_to_local_pathfilename(filename, path))
171 self.image_bb = RecipeFile(TemplateMgr.convert_to_image_pathfilename(filename, path)) 159 self.image_bb = RecipeFile(TemplateMgr.convert_to_image_pathfilename(filename, path))
172 160
173 def setVar(self, var, val): 161 def setVar(self, var, val):
174 if var in TemplateMgr.__gLocalVars__:
175 self.local_conf.setVar(var, val)
176 if var in TemplateMgr.__gBBLayersVars__:
177 self.bblayers_conf.setVar(var, val)
178 if var in TemplateMgr.__gRecipeVars__: 162 if var in TemplateMgr.__gRecipeVars__:
179 self.image_bb.setVar(var, val) 163 self.image_bb.setVar(var, val)
180 164
181 self.template_hob.setVar(var, val) 165 self.template_hob.setVar(var, val)
182 166
183 def save(self): 167 def save(self):
184 self.local_conf.save()
185 self.bblayers_conf.save()
186 self.image_bb.save() 168 self.image_bb.save()
187 self.template_hob.save() 169 self.template_hob.save()
188 170
@@ -200,12 +182,6 @@ class TemplateMgr(gobject.GObject):
200 if self.template_hob: 182 if self.template_hob:
201 del self.template_hob 183 del self.template_hob
202 template_hob = None 184 template_hob = None
203 if self.bblayers_conf:
204 del self.bblayers_conf
205 self.bblayers_conf = None
206 if self.local_conf:
207 del self.local_conf
208 self.local_conf = None
209 if self.image_bb: 185 if self.image_bb:
210 del self.image_bb 186 del self.image_bb
211 self.image_bb = None 187 self.image_bb = None