linux.inc: don't choke on missing defconfig in lzop dep
authorChristopher Larson <chris_larson@mentor.com>
Fri, 30 Dec 2011 18:41:53 +0000 (12:41 -0600)
committerKoen Kooi <koen@dominion.thruhere.net>
Fri, 30 Dec 2011 18:52:53 +0000 (19:52 +0100)
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@mentor.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
recipes-kernel/linux/linux.inc

index e8a754f56bfa4a3a7ba0d47f1b8f0cc65d247c3d..6996283e8cdb728f6c7201815406872e20a71e62 100644 (file)
@@ -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')
 }