catch up fix
authorRichard Taylor <richard.i.taylor@nokia.com>
Mon, 29 Mar 2010 14:24:44 +0100
branchfix
changeset 416 fe1f29c50d40
parent 415 6fdebb56755a (current diff)
parent 413 5eb26ea9cb49 (diff)
child 417 ea9157619e03
catch up
--- a/sbsv2/raptor/RELEASE-NOTES.txt	Mon Mar 29 11:35:45 2010 +0100
+++ b/sbsv2/raptor/RELEASE-NOTES.txt	Mon Mar 29 14:24:44 2010 +0100
@@ -9,17 +9,22 @@
 - DPDEF141195 - Raptor doesn't handle spaces in tool paths
 - SF Bug 2172 - [Raptor] Resource builds warn on encountering trigraph-like strings
 - SF Bug 2308 - [Raptor] PLUGIN3 TARGETTYPEs don't set resource output offsets correctly
+- Fix: in copylogfromannofile mode, ensure that the build id and duration are included in the log. 
+  These are not critical but are useful.
+- Fix: remove unnecessary empty lines in log output in copylogfromannofile mode. 
+- SF Bug 1939 - [Raptor] PAGED keyword in MMP files should imply byte pair compressed
+- DPDEF144648 - Raptor failed to build tools_deb objects under Windows XP 
+- SF Bug 2134 - [Raptor] Raptor does not pass overridden make variables into its makefiles
 
 
 version 2.12.5
 
 Defect Fixes:
-- SF Bug 1939 - [Raptor] PAGED keyword in MMP files should imply byte pair compressed
-- DPDEF144648 - Raptor failed to build tools_deb objects under Windows XP 
 - Fix: Workaround for emake engine log corruption when clockskew errors occur (annofile2log). 
   Allow Raptor to obtain log from emake annotation file where it is uncorrupted.  A new 
-  Make engine option "copyannofile2log" enables/disables this mode for emake. If this option is disabled
+  Make engine option "copylogfromannofile" enables/disables this mode for emake. If this option is disabled
   or if no annotation file is specified for the build then Raptor reads logs directly as normal.
+- SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp 
 - SF Bug 2191 - [Raptor] - When forcesuccess is enabled, exit status for a failed recipe is "retry" but should be "failed"
 - Fix: extend tracecompiler tests to Linux
 - Fix: Amendment to SF Bug 1511 fix - removal of blanked DEFFILE keyword from e32abiv2ani.flm
--- a/sbsv2/raptor/python/raptor_cli.py	Mon Mar 29 11:35:45 2010 +0100
+++ b/sbsv2/raptor/python/raptor_cli.py	Mon Mar 29 14:24:44 2010 +0100
@@ -34,7 +34,7 @@
 # raptor_cli module attributes
 
 parser = OptionParser(prog = raptor.name,
-					  usage = """%prog [--help] [options] [variable=value] [target] ...
+					  usage = """%prog [--help] [options] [target] ...
 
 Targets:
 
@@ -247,13 +247,8 @@
 
 	# the leftover_args are either variable assignments of the form a=b
 	# or target names.
-	regex = re.compile("^(.+)=(.*)$")
 	for leftover in leftover_args:
-		assignment = regex.findall(leftover)
-		if len(assignment) > 0:
-			Raptor.SetEnv(assignment[0][0],assignment[0][1])
-		else:
-			Raptor.AddTarget(leftover)
+		Raptor.AddTarget(leftover)
 
 	# Define the dictionary of functions to be used.
 	# Attributes and function names can be added easily.
--- a/sbsv2/raptor/python/raptor_make.py	Mon Mar 29 11:35:45 2010 +0100
+++ b/sbsv2/raptor/python/raptor_make.py	Mon Mar 29 14:24:44 2010 +0100
@@ -37,7 +37,19 @@
 class BadMakeEngineException(Exception):
 	pass
 
+def string_following(prefix, str):
+	"""If str starts with prefix then return the rest of str, otherwise None"""
+	if str.startswith(prefix):
+		return str[len(prefix):]
+	else:
+		return None
+
 def XMLEscapeLog(stream):
+	""" A generator that reads a raptor log from a stream and performs an XML escape
+	    on all text between tags, which is usually make output that could contain
+	    illegal characters that upset XML-based log parsers.
+	    This function yields "xml-safe" output line by line.
+	"""
 	inRecipe = False
 
 	for line in stream:
@@ -54,22 +66,49 @@
 			yield escape(line)
 
 def AnnoFileParseOutput(annofile):
+	""" A generator that extracts log output from an emake annotation file, 
+	    perform an XML-unescape on it and "yields" it line by line.  """
 	af = open(annofile, "r")
 
 	inOutput = False
-	inParseJob = False
+
+	buildid = ""
 	for line in af:
 		line = line.rstrip("\n\r")
 
+
 		if not inOutput:
-			if line.startswith("<output>"):
+			o = string_following("<output>", line)
+			if not o:
+				o = string_following('<output src="prog">', line)
+
+			if o:
 				inOutput = True	
-				yield unescape(line[8:])+'\n'
-				# This is make output so don't unescape it.
-			elif line.startswith('<output src="prog">'):
-				line = line[19:]
-				inOutput = True	
-				yield unescape(line)+'\n'
+				yield unescape(o)+'\n'
+				continue
+
+
+			o = string_following('<build id="',line)
+			if o:
+				buildid = o[:o.find('"')]
+				yield "Starting build: "+buildid+"\n"
+				continue 
+
+			o = string_following('<metric name="duration">', line)
+			if o:
+				secs = int(o[:o.find('<')])
+				if secs != 0:
+					duration = "%d:%d" % (secs/60, secs % 60)
+				else:
+					duration = "0:0"
+				continue 
+
+
+			o = string_following('<metric name="clusterAvailability">', line)
+			if o:
+				availability = o[:o.find('<')]
+				continue 
+				
 		else:
 			end_output = line.find("</output>")
 		
@@ -77,8 +116,10 @@
 				line = line[:end_output]
 				inOutput = False
 			
-			yield unescape(line)+'\n'
+			if line != "":	
+				yield unescape(line)+'\n'
 
+	yield "Finished build: %s   Duration: %s (m:s)   Cluster availability: %s%%\n" %(buildid,duration,availability)
 	af.close()
 
 
@@ -140,8 +181,8 @@
 
 			if self.copyLogFromAnnoFile:
 				for o in self.raptor.makeOptions:
-					if o.startswith("--emake-annofile="):
-						self.annoFileName = o[17:]
+					self.annoFileName = string_following("--emake-annofile=", o)
+					if self.annoFileName:
 						self.raptor.Info("annofile: " + o)
 
 				if not self.annoFileName:
--- a/sbsv2/raptor/test/smoke_suite/annofile2log.py	Mon Mar 29 11:35:45 2010 +0100
+++ b/sbsv2/raptor/test/smoke_suite/annofile2log.py	Mon Mar 29 14:24:44 2010 +0100
@@ -24,16 +24,12 @@
 	
 	t.usebash = True
 	t.errors = 0
-	t.returncode = 1
+	t.returncode = 0
 	t.exceptions = 0
 	t.command = "cd smoke_suite/test_resources/annofile2log && ( diff -wB <(python testanno2log.py <(bzip2 -dc scrubbed_ncp_dfs_resource.anno.bz2)) <(bzip2 -dc scrubbed_ncp_dfs_resource.stdout.bz2))"
 	
 	t.mustmatch_multiline = [ 
-		".*1a2.*" + 
-		"Starting build: 488235.{1,3}" +
-		"14009c12884.{1,4}" +
-		"---.{1,4}" +
-		"Finished build: 488235   Duration: 1:15 \(m:s\)   Cluster availability: 100%.*"
+		"^ *.?"
                 ]
 
 
--- a/sbsv2/raptor/util/talon/talon.c	Mon Mar 29 11:35:45 2010 +0100
+++ b/sbsv2/raptor/util/talon/talon.c	Mon Mar 29 14:24:44 2010 +0100
@@ -586,7 +586,7 @@
 
 				if (p->returncode != 0)
 				{
-					char *exitstr = force_success ? "failed" : retries > 0 ? "retry" : "failed";
+					char *exitstr = (force_success || retries <= 0) ? "failed" : "retry";
 					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='%s' code='%d' attempt='%d'%s%s />", exitstr, p->returncode, attempt, flagsstr, reasonstr );
 				} else {
 					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='ok' attempt='%d'%s%s />", attempt, flagsstr, reasonstr );