# HG changeset patch # User timothy.murphy@nokia.com # Date 1265401459 0 # Node ID 3bfc260b6d6111093f2d70ee1e1fb8d7755e3218 # Parent a363840a27e37aab41cd87fdf5c26368bc1426c4 fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine". diff -r a363840a27e3 -r 3bfc260b6d61 sbsv2/raptor/RELEASE-NOTES.txt --- a/sbsv2/raptor/RELEASE-NOTES.txt Fri Jan 29 09:52:16 2010 +0000 +++ b/sbsv2/raptor/RELEASE-NOTES.txt Fri Feb 05 20:24:19 2010 +0000 @@ -1,6 +1,10 @@ Release Notes for Symbian Build System v2 +Next Version +Defect Fixes: +- Better error messages for make-engine selection. e.g. "sbs -e arm" will now produce a useful error message rather than a traceback. "arm" is a real variant but it's not a make engine. In the past sbs would have tried to use it and would have failed with a complicated traceback. Also doesn't traceback for non-existent make engines. + version 2.12.1 Defect Fixes: diff -r a363840a27e3 -r 3bfc260b6d61 sbsv2/raptor/python/raptor.py --- a/sbsv2/raptor/python/raptor.py Fri Jan 29 09:52:16 2010 +0000 +++ b/sbsv2/raptor/python/raptor.py Fri Feb 05 20:24:19 2010 +0000 @@ -631,7 +631,7 @@ return True def SetMakeEngine(self, makeEngine): - self.makeEngine = makeEngine + self.makeEngineName = makeEngine return True def AddMakeOption(self, makeOption): @@ -1276,15 +1276,17 @@ if self.toolcheck != 'off': self.CheckConfigs(buildUnitsToBuild) else: - self.Info(" Not Checking Tool Versions") + self.Info("Not Checking Tool Versions") self.AssertBuildOK() # Setup a make engine. if not self.maker: - self.maker = raptor_make.MakeEngine(self) - if self.maker == None: - self.Error("No make engine present") + try: + self.maker = raptor_make.MakeEngine(self, self.makeEngineName) + except raptor_make.BadMakeEngineException,e: + self.Error("Unable to use make engine: %s " % str(e)) + self.AssertBuildOK() diff -r a363840a27e3 -r 3bfc260b6d61 sbsv2/raptor/python/raptor_data.py --- a/sbsv2/raptor/python/raptor_data.py Fri Jan 29 09:52:16 2010 +0000 +++ b/sbsv2/raptor/python/raptor_data.py Fri Feb 05 20:24:19 2010 +0000 @@ -884,6 +884,20 @@ vars.append(m) return [ BuildUnit(name=name, variants=vars) ] + def isChildOf(self, progenitor, cache): + r = False + pname = self.extends + while pname is not None and pname is not '': + parent = cache.FindNamedVariant(pname) + if parent is None: + break + if parent.name == progenitor: + r = True + break + pname = parent.extends + + return r + def __str__(self): s = "\n" % (self.name, self.extends) for op in self.ops: diff -r a363840a27e3 -r 3bfc260b6d61 sbsv2/raptor/python/raptor_make.py --- a/sbsv2/raptor/python/raptor_make.py Fri Jan 29 09:52:16 2010 +0000 +++ b/sbsv2/raptor/python/raptor_make.py Fri Feb 05 20:24:19 2010 +0000 @@ -33,18 +33,19 @@ from xml.sax.saxutils import escape +class BadMakeEngineException(Exception): + pass + # raptor_make module classes class MakeEngine(object): - def __init__(self, Raptor): + def __init__(self, Raptor, engine): self.raptor = Raptor self.valid = True self.descrambler = None self.descrambler_started = False - engine = Raptor.makeEngine - # look for an alias first as this gives end-users a chance to modify # the shipped variant rather than completely replacing it. if engine in Raptor.cache.aliases: @@ -52,8 +53,10 @@ elif engine in Raptor.cache.variants: avar = Raptor.cache.FindNamedVariant(engine) else: - Raptor.Error("No settings found for build engine '%s'", engine) - return + raise BadMakeEngineException("'%s' does not appear to be a make engine - no settings found for it" % engine) + + if not avar.isChildOf("make_engine", Raptor.cache): + raise BadMakeEngineException("'%s' is not a build engine (it's a variant but it does not extend 'make_engine')" % engine) # find the variant and extract the values try: @@ -105,14 +108,13 @@ self.selectors = [] except KeyError: - Raptor.Error("Bad '%s' configuration found.", engine) self.valid = False - return + raise BadMakeEngineException("Bad '%s' configuration found." % engine) # there must at least be a build command... if not self.buildCommand: - Raptor.Error("No build command for '%s'", engine) - self.valid = False + self.valid = False + raise BadMakeEngineException("No build command for '%s'"% engine) if self.usetalon: