diff options
author | Dongxiao Xu <dongxiao.xu@intel.com> | 2012-04-12 23:46:26 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-13 12:04:19 +0100 |
commit | 9c1dcdceb235c53b92a64e741f5a5491b1e489bd (patch) | |
tree | c1f2111a2c7c947c3fd00f7542e104c03d49cf1a /bitbake/lib/bb/ui | |
parent | 302f2cc8ce756ab61042f1d904df4d18071a976a (diff) | |
download | poky-9c1dcdceb235c53b92a64e741f5a5491b1e489bd.tar.gz |
Hob: Implement Hob config parse hook
To make Hob's specific variable settings take effect, we add a Hob
config hook at the end of parsing for each configuration file, and in
the hook function, Hob will set its own variables to the data store.
This fixes:
[YOCTO #2210]
[YOCTO #2254]
(Bitbake rev: 0ec7d1bbfd2e09ae60f99e6134b20ffd1d9145b1)
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 26 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 26 |
2 files changed, 40 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 10b9a77032..410ff5fa85 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -210,6 +210,30 @@ class Parameters: | |||
210 | self.tmpdir = params["tmpdir"] | 210 | self.tmpdir = params["tmpdir"] |
211 | self.enable_proxy = False | 211 | self.enable_proxy = False |
212 | 212 | ||
213 | def hob_conf_filter(fn, data): | ||
214 | if fn.endswith("/local.conf"): | ||
215 | distro = data.getVar("DISTRO_HOB") | ||
216 | if distro: | ||
217 | if distro != "defaultsetup": | ||
218 | data.setVar("DISTRO", distro) | ||
219 | else: | ||
220 | data.delVar("DISTRO") | ||
221 | |||
222 | keys = ["MACHINE_HOB", "SDKMACHINE_HOB", "PACKAGE_CLASSES_HOB", \ | ||
223 | "BB_NUMBER_THREADS_HOB", "PARALLEL_MAKE_HOB", "DL_DIR_HOB", \ | ||
224 | "SSTATE_DIR_HOB", "SSTATE_MIRROR_HOB", "INCOMPATIBLE_LICENSE_HOB"] | ||
225 | for key in keys: | ||
226 | var_hob = data.getVar(key) | ||
227 | if var_hob: | ||
228 | data.setVar(key.split("_HOB")[0], var_hob) | ||
229 | return | ||
230 | |||
231 | if fn.endswith("/bblayers.conf"): | ||
232 | layers = data.getVar("BBLAYERS_HOB") | ||
233 | if layers: | ||
234 | data.setVar("BBLAYERS", layers) | ||
235 | return | ||
236 | |||
213 | class Builder(gtk.Window): | 237 | class Builder(gtk.Window): |
214 | 238 | ||
215 | (MACHINE_SELECTION, | 239 | (MACHINE_SELECTION, |
@@ -296,6 +320,8 @@ class Builder(gtk.Window): | |||
296 | self.handler.connect("command-succeeded", self.handler_command_succeeded_cb) | 320 | self.handler.connect("command-succeeded", self.handler_command_succeeded_cb) |
297 | self.handler.connect("command-failed", self.handler_command_failed_cb) | 321 | self.handler.connect("command-failed", self.handler_command_failed_cb) |
298 | 322 | ||
323 | self.handler.set_config_filter(hob_conf_filter) | ||
324 | |||
299 | self.initiate_new_build_async() | 325 | self.initiate_new_build_async() |
300 | 326 | ||
301 | def create_visual_elements(self): | 327 | def create_visual_elements(self): |
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 1a7427a812..292d9056b2 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py | |||
@@ -253,43 +253,42 @@ class HobHandler(gobject.GObject): | |||
253 | self.server.runCommand(["setVariable", "INHERIT", inherits]) | 253 | self.server.runCommand(["setVariable", "INHERIT", inherits]) |
254 | 254 | ||
255 | def set_bblayers(self, bblayers): | 255 | def set_bblayers(self, bblayers): |
256 | self.server.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)]) | 256 | self.server.runCommand(["setVariable", "BBLAYERS_HOB", " ".join(bblayers)]) |
257 | 257 | ||
258 | def set_machine(self, machine): | 258 | def set_machine(self, machine): |
259 | if machine: | 259 | if machine: |
260 | self.server.runCommand(["setVariable", "MACHINE", machine]) | 260 | self.server.runCommand(["setVariable", "MACHINE_HOB", machine]) |
261 | 261 | ||
262 | def set_sdk_machine(self, sdk_machine): | 262 | def set_sdk_machine(self, sdk_machine): |
263 | self.server.runCommand(["setVariable", "SDKMACHINE", sdk_machine]) | 263 | self.server.runCommand(["setVariable", "SDKMACHINE_HOB", sdk_machine]) |
264 | 264 | ||
265 | def set_image_fstypes(self, image_fstypes): | 265 | def set_image_fstypes(self, image_fstypes): |
266 | self.server.runCommand(["setVariable", "IMAGE_FSTYPES", image_fstypes]) | 266 | self.server.runCommand(["setVariable", "IMAGE_FSTYPES", image_fstypes]) |
267 | 267 | ||
268 | def set_distro(self, distro): | 268 | def set_distro(self, distro): |
269 | if distro != "defaultsetup": | 269 | self.server.runCommand(["setVariable", "DISTRO_HOB", distro]) |
270 | self.server.runCommand(["setVariable", "DISTRO", distro]) | ||
271 | 270 | ||
272 | def set_package_format(self, format): | 271 | def set_package_format(self, format): |
273 | package_classes = "" | 272 | package_classes = "" |
274 | for pkgfmt in format.split(): | 273 | for pkgfmt in format.split(): |
275 | package_classes += ("package_%s" % pkgfmt + " ") | 274 | package_classes += ("package_%s" % pkgfmt + " ") |
276 | self.server.runCommand(["setVariable", "PACKAGE_CLASSES", package_classes]) | 275 | self.server.runCommand(["setVariable", "PACKAGE_CLASSES_HOB", package_classes]) |
277 | 276 | ||
278 | def set_bbthreads(self, threads): | 277 | def set_bbthreads(self, threads): |
279 | self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", threads]) | 278 | self.server.runCommand(["setVariable", "BB_NUMBER_THREADS_HOB", threads]) |
280 | 279 | ||
281 | def set_pmake(self, threads): | 280 | def set_pmake(self, threads): |
282 | pmake = "-j %s" % threads | 281 | pmake = "-j %s" % threads |
283 | self.server.runCommand(["setVariable", "PARALLEL_MAKE", pmake]) | 282 | self.server.runCommand(["setVariable", "PARALLEL_MAKE_HOB", pmake]) |
284 | 283 | ||
285 | def set_dl_dir(self, directory): | 284 | def set_dl_dir(self, directory): |
286 | self.server.runCommand(["setVariable", "DL_DIR", directory]) | 285 | self.server.runCommand(["setVariable", "DL_DIR_HOB", directory]) |
287 | 286 | ||
288 | def set_sstate_dir(self, directory): | 287 | def set_sstate_dir(self, directory): |
289 | self.server.runCommand(["setVariable", "SSTATE_DIR", directory]) | 288 | self.server.runCommand(["setVariable", "SSTATE_DIR_HOB", directory]) |
290 | 289 | ||
291 | def set_sstate_mirror(self, url): | 290 | def set_sstate_mirror(self, url): |
292 | self.server.runCommand(["setVariable", "SSTATE_MIRROR", url]) | 291 | self.server.runCommand(["setVariable", "SSTATE_MIRROR_HOB", url]) |
293 | 292 | ||
294 | def set_extra_size(self, image_extra_size): | 293 | def set_extra_size(self, image_extra_size): |
295 | self.server.runCommand(["setVariable", "IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size)]) | 294 | self.server.runCommand(["setVariable", "IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size)]) |
@@ -298,13 +297,16 @@ class HobHandler(gobject.GObject): | |||
298 | self.server.runCommand(["setVariable", "IMAGE_ROOTFS_SIZE", str(image_rootfs_size)]) | 297 | self.server.runCommand(["setVariable", "IMAGE_ROOTFS_SIZE", str(image_rootfs_size)]) |
299 | 298 | ||
300 | def set_incompatible_license(self, incompat_license): | 299 | def set_incompatible_license(self, incompat_license): |
301 | self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", incompat_license]) | 300 | self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE_HOB", incompat_license]) |
302 | 301 | ||
303 | def set_extra_config(self, extra_setting): | 302 | def set_extra_config(self, extra_setting): |
304 | for key in extra_setting.keys(): | 303 | for key in extra_setting.keys(): |
305 | value = extra_setting[key] | 304 | value = extra_setting[key] |
306 | self.server.runCommand(["setVariable", key, value]) | 305 | self.server.runCommand(["setVariable", key, value]) |
307 | 306 | ||
307 | def set_config_filter(self, config_filter): | ||
308 | self.server.runCommand(["setConfFilter", config_filter]) | ||
309 | |||
308 | def set_http_proxy(self, http_proxy): | 310 | def set_http_proxy(self, http_proxy): |
309 | self.server.runCommand(["setVariable", "http_proxy", http_proxy]) | 311 | self.server.runCommand(["setVariable", "http_proxy", http_proxy]) |
310 | 312 | ||