Patchwork [bitbake-devel,2/6] Hob: handle exceptions when loading templates

login
register
mail settings
Submitter Shane Wang
Date April 2, 2012, 8:29 a.m.
Message ID <cdb1e91988c26e79a8c38a2aa96de3d8b5cbfd4a.1333355236.git.shane.wang@intel.com>
Download mbox | patch
Permalink /patch/25065/
State New
Headers show

Comments

Shane Wang - April 2, 2012, 8:29 a.m.
Handle exceptions during type conversion to integers.

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index c1a75bd..151bec4 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -104,10 +104,22 @@  class Configuration:
         self.dldir = template.getVar("DL_DIR")
         self.sstatedir = template.getVar("SSTATE_DIR")
         self.sstatemirror = template.getVar("SSTATE_MIRROR")
-        self.pmake = int(template.getVar("PARALLEL_MAKE").split()[1])
-        self.bbthread = int(template.getVar("BB_NUMBER_THREADS"))
-        self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
-        self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
+        try:
+            self.pmake = int(template.getVar("PARALLEL_MAKE").split()[1])
+        except:
+            pass
+        try:
+            self.bbthread = int(template.getVar("BB_NUMBER_THREADS"))
+        except:
+            pass
+        try:
+            self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
+        except:
+            pass
+        try:
+            self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
+        except:
+            pass
         # image_overhead_factor is read-only.
         self.incompat_license = template.getVar("INCOMPATIBLE_LICENSE")
         self.curr_sdk_machine = template.getVar("SDKMACHINE")