[meta-ti] [PATCH] linux.inc: don't choke on missing defconfig in lzop dep

Christopher Larson kergoth at gmail.com
Tue Dec 20 10:16:28 PST 2011


When a recipe is being parsed which will be skipped due to an incompatible
machine, no local defconfig will exist for the current machine. It seems 
that
the fetch localpath code doesn't error in that case, so we need to check for
an IOError on the attempted open. Without this, we can hit parse errors.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
  recipes-kernel/linux/linux.inc |   15 ++++++++++-----
  1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/recipes-kernel/linux/linux.inc b/recipes-kernel/linux/linux.inc
index e8a754f..6996283 100644
--- a/recipes-kernel/linux/linux.inc
+++ b/recipes-kernel/linux/linux.inc
@@ -269,9 +269,14 @@ python () {
      try:
          defconfig = bb.fetch2.localpath('file://defconfig', d)
      except bb.fetch2.FetchError:
-        pass
-    else:
-        if 'CONFIG_KERNEL_LZO=y\n' in open(defconfig).readlines():
-            depends = d.getVar('DEPENDS', False)
-            d.setVar('DEPENDS', depends + ' lzop-native')
+        return
+
+    try:
+        configfile = open(defconfig)
+    except IOError:
+        return
+
+    if 'CONFIG_KERNEL_LZO=y\n' in configfile.readlines():
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' lzop-native')
  }
-- 
1.7.8




More information about the meta-ti mailing list