sbsv2/raptor/test/smoke_suite/test_resources/annofile2log/testanno2log.py
branchfix
changeset 362 0ff20a0b1aa9
parent 357 b4baa7ca35a7
child 490 b60bdff41580
--- a/sbsv2/raptor/test/smoke_suite/test_resources/annofile2log/testanno2log.py	Tue Mar 16 11:49:03 2010 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/annofile2log/testanno2log.py	Tue Mar 16 16:40:50 2010 +0000
@@ -1,64 +1,38 @@
+#
+# Copyright (c) 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"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+# Component description file
+#
+
+
 import sys
 import os
 sys.path.append(os.path.join(os.environ['SBS_HOME'],"python"))
-from xml.sax.saxutils import escape
-from xml.sax.saxutils import unescape
 
-def XMLEscapeLog(stream):
-	inRecipe = False
-
-	for line in stream:
-		if line.startswith("<recipe"):
-			inRecipe = True
-		elif line.startswith("</recipe"):
-			inRecipe = False
-			
-		# unless we are inside a "recipe", any line not starting
-		# with "<" is free text that must be escaped.
-		if inRecipe or line.startswith("<"):
-			yield line
-		else:
-			yield escape(line)
-
-def AnnoFileParseOutput(annofile):
-	af = open(annofile, "r")
-
-	inOutput = False
-	inParseJob = False
-	for line in af:
-		line = line.rstrip("\n\r")
-
-		if not inOutput:
-			if line.startswith("<output>"):
-				inOutput = True	
-				yield unescape(line[8:])
-				# This is make output so don't unescape it.
-			elif line.startswith('<output src="prog">'):
-				line = line[19:]
-				inOutput = True	
-				yield unescape(line)
-		else:
-			end_output = line.find("</output>")
-		
-			if end_output != -1:
-				line = line[:end_output]
-				inOutput = False
-			
-			yield unescape(line)
-
-	af.close()
+from raptor_make import XMLEscapeLog
+from raptor_make import AnnoFileParseOutput
 
 
 retcode=0
 
 
 annofile = sys.argv[1]
-#print "File = ", annofile
 
 sys.stdout.write("<build>\n")
 try:
 	for l in XMLEscapeLog(AnnoFileParseOutput(annofile)):
-		sys.stdout.write(l+"\n")
+		sys.stdout.write(l)
 
 except Exception,e:
 	sys.stderr.write("error: " + str(e) + "\n")