From bf8b27aba417bd4b7db247396ecd1bce58ab52fd Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 31 Mar 2004 18:14:28 +0000 Subject: [PATCH] Teach the oe tools to catch Exception so they fail a bit cleaner on exceptions it doesnt normally know how to handle. --- bin/oebuild | 6 +++++- bin/oeinstall | 10 +++++++--- bin/oemake | 9 ++++++++- bin/oeread | 5 ++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/bin/oebuild b/bin/oebuild index 5f2aa94..e15687f 100644 --- a/bin/oebuild +++ b/bin/oebuild @@ -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) diff --git a/bin/oeinstall b/bin/oeinstall index fba8cdc..91cfb76 100644 --- a/bin/oeinstall +++ b/bin/oeinstall @@ -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 diff --git a/bin/oemake b/bin/oemake index 456dd3b..03e43e3 100644 --- a/bin/oemake +++ b/bin/oemake @@ -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 diff --git a/bin/oeread b/bin/oeread index bc8f331..78435ec 100644 --- a/bin/oeread +++ b/bin/oeread @@ -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] -- 2.7.4