diff -r 1248e8f6a72d -r db59fc762214 sbsv2/raptor/python/raptor_make.py --- a/sbsv2/raptor/python/raptor_make.py Tue Mar 16 17:16:51 2010 +0000 +++ b/sbsv2/raptor/python/raptor_make.py Thu Mar 18 15:06:42 2010 +0000 @@ -31,11 +31,58 @@ import traceback import sys from xml.sax.saxutils import escape +from xml.sax.saxutils import unescape class BadMakeEngineException(Exception): pass +def XMLEscapeLog(stream): + inRecipe = False + + for line in stream: + if line.startswith(""): + inOutput = True + yield unescape(line[8:])+'\n' + # This is make output so don't unescape it. + elif line.startswith(''): + line = line[19:] + inOutput = True + yield unescape(line)+'\n' + else: + end_output = line.find("") + + if end_output != -1: + line = line[:end_output] + inOutput = False + + yield unescape(line)+'\n' + + af.close() + + + # raptor_make module classes class MakeEngine(object): @@ -82,6 +129,25 @@ self.jobsOption = evaluator.Get("jobs") self.defaultMakeOptions = evaluator.Get("defaultoptions") + # Logging + # copylogfromannofile means, for emake, that we should ignore + # emake's console output and instead extract output from its annotation + # file. This is a workaround for a problem where some emake + # console output is lost. The annotation file has a copy of this + # output in the "parse" job and it turns out to be uncorrupted. + self.copyLogFromAnnoFile = (evaluator.Get("copylogfromannofile") == "true") + self.annoFileName = None + + if self.copyLogFromAnnoFile: + for o in self.raptor.makeOptions: + if o.startswith("--emake-annofile="): + self.annoFileName = o[17:] + self.raptor.Info("annofile: " + o) + + if not self.annoFileName: + self.raptor.Info("Cannot copy log from annotation file as no annotation filename was specified via the option --mo=--emake-annofile=") + self.copyLogFromAnnoFile = False + # buffering self.scrambled = (evaluator.Get("scrambled") == "true") @@ -479,8 +545,16 @@ # clock skew messages from some build engines scatter their # output across our xml. stderrfilename = makefile+'.stderr' + stdoutfilename = makefile+'.stdout' command += " 2>'%s' " % stderrfilename + # Keep a copy of the stdout too in the case of using the + # annofile - so that we can trap the problem that + # makes the copy-log-from-annofile workaround necessary + # and perhaps determine when we can remove it. + if self.copyLogFromAnnoFile: + command += " >'%s' " % stdoutfilename + # Substitute the makefile name for any occurrence of #MAKEFILE# command = command.replace("#MAKEFILE#", str(makefile)) @@ -518,28 +592,23 @@ stream = p.stdout inRecipe = False - line = " " - while line: - line = stream.readline() - - if line.startswith("