sbsv2/raptor/bin/recipestats.py
branchwip
changeset 92 6ebd8f14df45
parent 90 608b444a9759
parent 88 b5820d0f3a1c
child 100 55250667c668
--- a/sbsv2/raptor/bin/recipestats.py	Wed Dec 09 13:46:46 2009 +0000
+++ b/sbsv2/raptor/bin/recipestats.py	Wed Dec 09 20:09:35 2009 +0000
@@ -66,14 +66,14 @@
 
 	recipe_re = re.compile(".*<recipe name='([^']+)'.*")
 	time_re = re.compile(".*<time start='([0-9]+\.[0-9]+)' *elapsed='([0-9]+\.[0-9]+)'.*")
-	status_re = re.compile(".*<status exit='([^']*)'.*")
+	status_re = re.compile(".*<status exit='(?P<exit>(ok|failed))'( *code='(?P<code>[0-9]+)')?.*")
 
 	alternating = 0
 	start_time = 0.0
 
 	
 	for l in f.xreadlines():
-		l2 = l.rstrip("\n")
+		l2 = l.rstrip("\n\r")
 		rm = recipe_re.match(l2)
 
 		if rm is not None:
@@ -83,26 +83,32 @@
 
 		tm = time_re.match(l2)
 		if tm is not None:
-			s = float(tm.groups()[0])
-			elapsed = float(tm.groups()[1])
+			try:
+				s = float(tm.groups()[0])
+				elapsed = float(tm.groups()[1])
+
+				if start_time == 0.0:
+					start_time = s
 
-			if start_time == 0.0:
-				start_time = s
+				s -= start_time
 
-			s -= start_time
-
-			#print s,elapsed
-			continue
+				#print s,elapsed
+				continue
+			except ValueError, e:
+				raise Exception("Parse problem: float conversion on these groups: %s\n%s" %(str(tm.groups()), str(e)))
+		else:
+			if l2.find("<time") is not -1:
+				raise Exception("unparsed timing status: %s\n"%l2)
 
 		sm = status_re.match(l2)
 
 		if sm is None:
 			continue
 
-		if sm.groups()[0] == 'ok':
+		if sm.groupdict()['exit'] == 'ok':
 			status = 0
 		else:
-			status = int(sm.groups()[0])
+			status = int(sm.groupdict()['code'])
 
 		st.add(s, elapsed, rname, status)