summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-04-02 16:29:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-05 18:48:07 +0100
commit36164b9a9bcc41094012495e97d4633df60b0f24 (patch)
tree2c4e3da809d64e22421e5ce5ef679f282ff68fe8 /bitbake
parent041cc16dd97383e261683c0a08687014167ad57d (diff)
downloadpoky-36164b9a9bcc41094012495e97d4633df60b0f24.tar.gz
Hob: handle exceptions in get_parameters() from the bitbake
Handle exceptions during type conversion into integers. (Bitbake rev: e03da8876045af545303db2b8044a17657337140) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py33
1 files changed, 26 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8909e010f9..9d1c7a2532 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -408,15 +408,22 @@ class HobHandler(gobject.GObject):
408 num_threads = 1 408 num_threads = 1
409 max_threads = 65536 409 max_threads = 65536
410 else: 410 else:
411 num_threads = int(num_threads) 411 try:
412 max_threads = 16 * num_threads 412 num_threads = int(num_threads)
413 max_threads = 16 * num_threads
414 except:
415 num_threads = 1
416 max_threads = 65536
413 params["max_threads"] = max_threads 417 params["max_threads"] = max_threads
414 418
415 bbthread = self.server.runCommand(["getVariable", "BB_NUMBER_THREADS"]) 419 bbthread = self.server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
416 if not bbthread: 420 if not bbthread:
417 bbthread = num_threads 421 bbthread = num_threads
418 else: 422 else:
419 bbthread = int(bbthread) 423 try:
424 bbthread = int(bbthread)
425 except:
426 bbthread = num_threads
420 params["bbthread"] = bbthread 427 params["bbthread"] = bbthread
421 428
422 pmake = self.server.runCommand(["getVariable", "PARALLEL_MAKE"]) 429 pmake = self.server.runCommand(["getVariable", "PARALLEL_MAKE"])
@@ -425,7 +432,10 @@ class HobHandler(gobject.GObject):
425 elif isinstance(pmake, int): 432 elif isinstance(pmake, int):
426 pass 433 pass
427 else: 434 else:
428 pmake = int(pmake.lstrip("-j ")) 435 try:
436 pmake = int(pmake.lstrip("-j "))
437 except:
438 pmake = num_threads
429 params["pmake"] = pmake 439 params["pmake"] = pmake
430 440
431 params["image_addr"] = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or "" 441 params["image_addr"] = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or ""
@@ -434,21 +444,30 @@ class HobHandler(gobject.GObject):
434 if not image_extra_size: 444 if not image_extra_size:
435 image_extra_size = 0 445 image_extra_size = 0
436 else: 446 else:
437 image_extra_size = int(image_extra_size) 447 try:
448 image_extra_size = int(image_extra_size)
449 except:
450 image_extra_size = 0
438 params["image_extra_size"] = image_extra_size 451 params["image_extra_size"] = image_extra_size
439 452
440 image_rootfs_size = self.server.runCommand(["getVariable", "IMAGE_ROOTFS_SIZE"]) 453 image_rootfs_size = self.server.runCommand(["getVariable", "IMAGE_ROOTFS_SIZE"])
441 if not image_rootfs_size: 454 if not image_rootfs_size:
442 image_rootfs_size = 0 455 image_rootfs_size = 0
443 else: 456 else:
444 image_rootfs_size = int(image_rootfs_size) 457 try:
458 image_rootfs_size = int(image_rootfs_size)
459 except:
460 image_rootfs_size = 0
445 params["image_rootfs_size"] = image_rootfs_size 461 params["image_rootfs_size"] = image_rootfs_size
446 462
447 image_overhead_factor = self.server.runCommand(["getVariable", "IMAGE_OVERHEAD_FACTOR"]) 463 image_overhead_factor = self.server.runCommand(["getVariable", "IMAGE_OVERHEAD_FACTOR"])
448 if not image_overhead_factor: 464 if not image_overhead_factor:
449 image_overhead_factor = 1 465 image_overhead_factor = 1
450 else: 466 else:
451 image_overhead_factor = float(image_overhead_factor) 467 try:
468 image_overhead_factor = float(image_overhead_factor)
469 except:
470 image_overhead_factor = 1
452 params['image_overhead_factor'] = image_overhead_factor 471 params['image_overhead_factor'] = image_overhead_factor
453 472
454 params["incompat_license"] = self._remove_redundant(self.server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or "") 473 params["incompat_license"] = self._remove_redundant(self.server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or "")