sbsv2/raptor/python/raptor_make.py
branchfix
changeset 360 77642c41e033
parent 357 b4baa7ca35a7
child 408 a819f9223567
child 443 2f5cedd04db9
equal deleted inserted replaced
359:6173843d1ce4 360:77642c41e033
    29 import time
    29 import time
    30 from raptor_makefile import *
    30 from raptor_makefile import *
    31 import traceback
    31 import traceback
    32 import sys
    32 import sys
    33 from xml.sax.saxutils import escape
    33 from xml.sax.saxutils import escape
       
    34 from xml.sax.saxutils import unescape
    34 
    35 
    35 
    36 
    36 class BadMakeEngineException(Exception):
    37 class BadMakeEngineException(Exception):
    37 	pass
    38 	pass
    38 
    39 
   137 			self.copyLogFromAnnoFile = (evaluator.Get("copylogfromannofile") == "true")
   138 			self.copyLogFromAnnoFile = (evaluator.Get("copylogfromannofile") == "true")
   138 			self.annoFileName = None
   139 			self.annoFileName = None
   139 
   140 
   140 			if self.copyLogFromAnnoFile:
   141 			if self.copyLogFromAnnoFile:
   141 				for o in self.raptor.makeOptions:
   142 				for o in self.raptor.makeOptions:
   142 					if o.startswith("--mo=--emake-annofile="):
   143 					if o.startswith("--emake-annofile="):
   143 						self.annoFileName = o[22:]
   144 						self.annoFileName = o[17:]
       
   145 						self.raptor.Info("annofile: " + o)
   144 
   146 
   145 				if not self.annoFileName:
   147 				if not self.annoFileName:
   146 					self.raptor.Info("Cannot copy log from annotation file as no annotation filename was specified via the option --mo=--emake-annofile=<filename>")
   148 					self.raptor.Info("Cannot copy log from annotation file as no annotation filename was specified via the option --mo=--emake-annofile=<filename>")
   147 					self.copyLogFromAnnoFile = False
   149 					self.copyLogFromAnnoFile = False
   148 
   150 
   597 
   599 
   598 					returncode = p.wait()
   600 					returncode = p.wait()
   599 				else:
   601 				else:
   600 					returncode = p.wait()
   602 					returncode = p.wait()
   601 
   603 
   602 					annofilename = self.annoFileName.replace("#MAKEFILE#",makefile)
   604 					annofilename = self.annoFileName.replace("#MAKEFILE#", makefile)
       
   605 					self.raptor.Info("copylogfromannofile: Copying log from annotation file %s to work around a potential problem with the console output", annofilename)
   603 					try:
   606 					try:
   604 						for l in XMLEscapeLog(AnnoFileParseOutput(annofilename)):
   607 						for l in XMLEscapeLog(AnnoFileParseOutput(annofilename)):
   605 							self.raptor.out.write(l)
   608 							self.raptor.out.write(l)
   606 					except Exception,e:
   609 					except Exception,e:
   607 						self.raptor.Error("Couldn't complete stdout output from annofile %s for %s - '%s'", annofile, command, str(e))
   610 						self.raptor.Error("Couldn't complete stdout output from annofile %s for %s - '%s'", annofilename, command, str(e))
   608 
   611 
   609 
   612 
   610 				# Take all the stderr output that went into the .stderr file
   613 				# Take all the stderr output that went into the .stderr file
   611 				# and put it back into the log, but safely so it can't mess up
   614 				# and put it back into the log, but safely so it can't mess up
   612 				# xml parsers.
   615 				# xml parsers.
   627 
   630 
   628 			except Exception,e:
   631 			except Exception,e:
   629 				self.raptor.Error("Exception '%s' during '%s'", str(e), command)
   632 				self.raptor.Error("Exception '%s' during '%s'", str(e), command)
   630 				self.Tidy()
   633 				self.Tidy()
   631 				# Still report end-time of the build
   634 				# Still report end-time of the build
   632 				self.raptor.InfoEnd(object_type = "Building", task = "Makefile",
   635 				self.raptor.InfoEndTime(object_type = "Building", task = "Makefile",
   633 						key = str(makefile))
   636 						key = str(makefile))
   634 				return False
   637 				return False
   635 
   638 
   636 		# run any shutdown script
   639 		# run any shutdown script
   637 		if self.shutdownCommand != None and self.shutdownCommand != "":
   640 		if self.shutdownCommand != None and self.shutdownCommand != "":