sbsv2/raptor/python/raptor_data.py
branchwip
changeset 330 f3b3d9f9a008
parent 204 a19456c07783
child 371 2db10eac415a
--- a/sbsv2/raptor/python/raptor_data.py	Mon Feb 15 16:01:55 2010 +0000
+++ b/sbsv2/raptor/python/raptor_data.py	Wed Feb 17 17:03:27 2010 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -884,6 +884,21 @@
 			vars.append(m)
 		return [ BuildUnit(name=name, variants=vars) ]
 
+	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:
+				return True
+			pname = parent.extends
+
+		return False
+
 	def __str__(self):
 		s = "<var name='%s' extends='%s'>\n" % (self.name, self.extends)
 		for op in self.ops:
@@ -936,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:
@@ -948,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:
@@ -955,6 +973,12 @@
 
 		return [ BuildUnit(name=name, variants=self.variants + self.modifiers) ]
 
+	def isDerivedFrom(self, progenitor, cache):
+		self.Resolve(cache)
+		for v in self.variants:
+			if v.isDerivedFrom(progenitor,cache):
+				return True
+		return False
 
 class AliasRef(Reference):