Teach the oe tools to catch Exception so they fail a bit cleaner on exceptions it...
authorChris Larson <clarson@kergoth.com>
Wed, 31 Mar 2004 18:14:28 +0000 (18:14 +0000)
committerChris Larson <clarson@kergoth.com>
Wed, 31 Mar 2004 18:14:28 +0000 (18:14 +0000)
bin/oebuild
bin/oeinstall
bin/oemake
bin/oeread

index 5f2aa94..e15687f 100644 (file)
@@ -64,10 +64,12 @@ def load_oefile(oefile, cfgdata):
        os.chdir(topdir)
        data.setVar('OEPATH', oepath, cfg)
        oe = copy.copy(cfgdata)
+       from oe.parse import ParseError
        try:
                oe = parse.handle(oefile, oe) # read .oe data
                return oe
-       except IOError, OSError:
+       except Exception, e:
+               error("%s" % e)
                return None
 
 
@@ -166,3 +168,5 @@ except build.EventException:
        (type, value, traceback) = sys.exc_info()
        e = value.event
        fatal("%s event exception, aborting" % event.getName(e))
+except Exception, e:
+       fatal("%s" % e)
index fba8cdc..91cfb76 100644 (file)
@@ -47,8 +47,8 @@ if '--version' in opthash or '-V' in opthash:
 
 try:
        cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
-except IOError:
-       fatal("Unable to open oe.conf")
+except Exception, e:
+       fatal("Unable to open oe.conf: %s" % e)
 
 # sanity check
 if cfg_oe is None:
@@ -163,7 +163,11 @@ for f in files:
                        continue
        from copy import deepcopy
        fdata = deepcopy(cfg_oe)
-       parse.handle(f, fdata)
+       try:
+               parse.handle(f, fdata)
+       except Exception, e:
+               error("%s" % e)
+               fdata = None
        if fdata is None:
                continue
        # allow metadata files to add items to OEFILES
index 456dd3b..03e43e3 100644 (file)
@@ -75,6 +75,12 @@ def buildPackage(graph, item):
                __build_cache_fail.append(item)
                del pkgdata[fn]
                return 0
+       except Exception, e:
+               event.fire(event.PkgFailed(item, pkgdata[fn]))
+               __build_cache_fail.append(item)
+               error("%s" % e)
+               del pkgdata[fn]
+               return 0
 
 def get_oefiles( path = os.getcwd() ):
        """Get list of default .oe files by reading out the current directory"""
@@ -123,7 +129,8 @@ def load_oefile( oefile, cfg ):
                parse.handle(oefile, oe) # read .oe data
                os.chdir(oldpath)
                return oe
-       except IOError, OSError:
+       except Exception, e:
+               error("%s" % e)
                os.chdir(oldpath)
                return None
 
index bc8f331..78435ec 100644 (file)
@@ -11,7 +11,10 @@ cfgkeys.sort()
 
 if len(sys.argv) == 2:
        oefile = copy.deepcopy(cfg)
-       oefile = oe.parse.handle(sys.argv[1], oefile)
+       try:
+               oefile = oe.parse.handle(sys.argv[1], oefile)
+       except Exception, e:
+               oe.fatal("%s" % e)
        oefilekeys = oefile.keys()
        oefilekeys.sort()
        print "Variables in %s:" % sys.argv[1]