filter terminal flags up if recipe exceeds line limit fix
authoryiluzhu
Thu, 10 Dec 2009 16:35:03 +0000
branchfix
changeset 45 0e5978b000d1
parent 42 0785cc0c667b
child 46 14d284e75719
filter terminal flags up if recipe exceeds line limit
sbsv2/raptor/python/plugins/filter_terminal.py
--- a/sbsv2/raptor/python/plugins/filter_terminal.py	Thu Dec 10 14:00:35 2009 +0000
+++ b/sbsv2/raptor/python/plugins/filter_terminal.py	Thu Dec 10 16:35:03 2009 +0000
@@ -105,7 +105,7 @@
 
 	attribute_re = re.compile("([a-z][a-z0-9]*)='([^']*)'",re.I)
 	maxdots = 40 # if one prints dots then don't print masses
-	recipelinelimit = 200 # don't scan ultra-long recipes in case we run out of memory
+	recipelinelimit = 100 # don't scan ultra-long recipes in case we run out of memory
 
 	# recipes that we think most users are interested in
 	# and the mapping that we will use to output them as
@@ -282,6 +282,7 @@
 			# This variable holds all recipe information
 			self.failed = False # Recipe status
 			self.recipeBody = []
+			self.recipelineExceeded = 0
 			return		
 		elif text.startswith("</recipe>"):
 			# detect the end of a recipe
@@ -336,6 +337,10 @@
 		elif text.startswith("]]>"):
 			if self.inRecipe:
 				self.inBody = False
+				if self.recipelineExceeded:
+					self.recipeBody.append("[filter_terminal: OUTPUT TRUNCATED: Recipe output limit exceeded; " + \
+						"see logfile for full output (%s lines shown out of %s)]" % \
+						(FilterTerminal.recipelinelimit, FilterTerminal.recipelinelimit + self.recipelineExceeded))
 		elif text.startswith("<info>Copied"):
 			if not self.analyseonly and not self.quiet:
 				start = text.find(" to ") + 4
@@ -365,8 +370,11 @@
 			# we have to keep the output until we find out
 			# if the recipe failed. But not all of it if it turns
 			# out to be very long
-			if len(self.recipeBody) < FilterTerminal.recipelinelimit:
+			if len(self.recipeBody) <= FilterTerminal.recipelinelimit:
 				self.recipeBody.append(text)
+			else:
+				self.recipelineExceeded += 1
+
 
 	def logit(self):
 		""" log a message """