fix: get make engine name validation working with aliases. fix
authortimothy.murphy@nokia.com
Sat, 06 Feb 2010 09:36:43 +0000
branchfix
changeset 192 76300483f6fd
parent 191 3bfc260b6d61
child 193 8e61308a207e
fix: get make engine name validation working with aliases.
sbsv2/raptor/python/raptor_data.py
sbsv2/raptor/python/raptor_make.py
--- a/sbsv2/raptor/python/raptor_data.py	Fri Feb 05 20:24:19 2010 +0000
+++ b/sbsv2/raptor/python/raptor_data.py	Sat Feb 06 09:36:43 2010 +0000
@@ -884,19 +884,20 @@
 			vars.append(m)
 		return [ BuildUnit(name=name, variants=vars) ]
 
-	def isChildOf(self, progenitor, cache):
-		r = False
+	def isDerivedFrom(self, progenitor, cache):
+		if self.name == progenitor:
+			return True
+
 		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
+				return True
 			pname = parent.extends
 
-		return r
+		return False
 
 	def __str__(self):
 		s = "<var name='%s' extends='%s'>\n" % (self.name, self.extends)
@@ -950,7 +951,7 @@
 	def Valid(self):
 		return self.name and self.meaning
 
-	def GenerateBuildUnits(self, cache):
+	def Resolve(self, cache):
 		if not self.variants:
 			missing_variants = []
 			for r in self.varRefs:
@@ -962,6 +963,9 @@
 			if len(missing_variants) > 0:
 				raise MissingVariantException("Missing variants '%s'", " ".join(missing_variants))
 
+	def GenerateBuildUnits(self, cache):
+		self.Resolve(cache)
+
 		name = self.name
 
 		for v in self.modifiers:
@@ -969,6 +973,12 @@
 
 		return [ BuildUnit(name=name, variants=self.variants + self.modifiers) ]
 
+	def isDerivedFrom(self, progenitor, cache):
+		self.Resolve(cache)
+		if len(self.variants) == 1:
+			return self.variants[0].isDerivedFrom(progenitor,cache)
+		else:
+			return False
 
 class AliasRef(Reference):
 
--- a/sbsv2/raptor/python/raptor_make.py	Fri Feb 05 20:24:19 2010 +0000
+++ b/sbsv2/raptor/python/raptor_make.py	Sat Feb 06 09:36:43 2010 +0000
@@ -55,7 +55,7 @@
 		else:
 			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):
+		if not avar.isDerivedFrom("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