# HG changeset patch # User Richard Taylor # Date 1268920853 0 # Node ID 59ec73480ed35a4d0a2271aa21d13edd62af6342 # Parent 169ad30bb410e14d05efa48579e22b55be229550# Parent f4ccb4c573daa7108891fc835a1b46013a34465f catch up diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/RELEASE-NOTES.txt --- a/sbsv2/raptor/RELEASE-NOTES.txt Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/RELEASE-NOTES.txt Thu Mar 18 14:00:53 2010 +0000 @@ -1,7 +1,12 @@ Release Notes for Symbian Build System v2 next version +- 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 + 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 - Fix: improve robustness to bad -c options diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/lib/config/make.xml --- a/sbsv2/raptor/lib/config/make.xml Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/lib/config/make.xml Thu Mar 18 14:00:53 2010 +0000 @@ -47,6 +47,9 @@ + + + @@ -67,6 +70,9 @@ + + + diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/python/plugins/filter_bz2log.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/python/plugins/filter_bz2log.py Thu Mar 18 14:00:53 2010 +0000 @@ -0,0 +1,88 @@ +# Copyright (c) 2009 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: +# Compress the full Raptor log file using the BZip2 algorithm, maximum compression. +# +# + +import os +import sys +import raptor +import filter_interface +import bz2 + +class StringListCompressor(object): + def __init__(self, complevel=5, filename="file.log.bz2"): + self.compressor = bz2.BZ2Compressor(complevel) + self.stringlist = [] + self.outputopenedok = False + self.filename = filename + try: + self.fh = open(self.filename, "wb") + self.outputopenedok = True + except: + self.outputopenedok = False + + def write(self, data): + if self.outputopenedok: + compresseddata = self.compressor.compress(data) + self.fh.write(compresseddata) + + def __del__(self): + if self.outputopenedok: + compresseddata = self.compressor.flush() + self.fh.write(compresseddata) + self.fh.close() + +class Bz2log(filter_interface.Filter): + def __init__(self): + self.__inRecipe = False + self.compressor = None + + def open(self, raptor_instance): + """Open a log file for the various I/O methods to write to.""" + + if raptor_instance.logFileName == None: + self.out = sys.stdout # Default to stdout if no log file is given + else: + logname = str(raptor_instance.logFileName.path.replace("%TIME", raptor_instance.timestring)) + + # Ensure that filename has the right extension; append ".bz2" if required + if not logname.lower().endswith(".bz2"): + logname += ".bz2" + + try: + dirname = str(raptor_instance.logFileName.Dir()) + if dirname and not os.path.isdir(dirname): + os.makedirs(dirname) + except: + self.formatError("cannot create directory %s", dirname) + return False + + # Use highest compression level 9 which corresponds to a 900KB dictionary + self.compressor = StringListCompressor(9, logname) + if not self.compressor.outputopenedok: + self.out = None + self.formatError("failed to initialise compression routines." ) + return False + return True + + def write(self, data): + """Write data compressed log""" + if self.compressor: + self.compressor.write(data) + return True + + def close(self): + """Close the log file""" + return True diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/python/raptor_make.py --- a/sbsv2/raptor/python/raptor_make.py Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/python/raptor_make.py Thu Mar 18 14:00:53 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("\n") +try: + for l in XMLEscapeLog(AnnoFileParseOutput(annofile)): + sys.stdout.write(l) + +except Exception,e: + sys.stderr.write("error: " + str(e) + "\n") + retcode = 1 +sys.stdout.write("\n") + +sys.exit(retcode) diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/util/talon/talon.c --- a/sbsv2/raptor/util/talon/talon.c Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/util/talon/talon.c Thu Mar 18 14:00:53 2010 +0000 @@ -586,7 +586,7 @@ if (p->returncode != 0) { - char *exitstr = retries > 0 ? "retry" : "failed"; + char *exitstr = force_success ? "failed" : retries > 0 ? "retry" : "failed"; snprintf(status, STATUS_STRMAX - 1, "\n", exitstr, p->returncode, attempt, flagsstr, reasonstr ); } else { snprintf(status, STATUS_STRMAX - 1, "\n", attempt, flagsstr, reasonstr ); diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/util/talon/tests/config.sh --- a/sbsv2/raptor/util/talon/tests/config.sh Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/config.sh Thu Mar 18 14:00:53 2010 +0000 @@ -16,9 +16,19 @@ # # set up the environment for some talon tests. +eval `$SBS_HOME/bin/gethost.sh -e` + +if [[ "$HOSTPLATFORM" =~ "win" ]]; then +TEST_SHELL=$(cygpath -w $SBS_HOME/win32/bin/talon.exe) +TEST_TALON_SHELL=$(cygpath -w $SBS_CYGWIN/bin/bash.exe) +else +TEST_SHELL=$SBS_HOME/$HOSTPLATFORM_DIR/bin/talon +TEST_TALON_SHELL=/bin/bash +fi + cat >settings.mk <<-endofsettings - SHELL:=$(cygpath -w $SBS_HOME/win32/bin/talon.exe) - TALON_SHELL:=$(cygpath -w $SBS_CYGWIN/bin/bash.exe) + SHELL:=$TEST_SHELL + TALON_SHELL:=$TEST_TALON_SHELL TALON_BUILDID:=100 TALON_DEBUG:="" export TALON_SHELL TALON_BUILDID TALON_DEBUG diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/util/talon/tests/t4.mk --- a/sbsv2/raptor/util/talon/tests/t4.mk Tue Mar 16 17:04:21 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/t4.mk Thu Mar 18 14:00:53 2010 +0000 @@ -23,6 +23,11 @@ $(info testing timeouts) $(info ) -all: +.PHONY: all passed + +all: passed + @echo "t4-PASSED" + +passed: @|PLATFORM=armv5;MMP=barney.mmp;BLDINF=somebld.inf;|echo "Started a slow command under talon (attempt $$TALON_ATTEMPT):";echo "SHELL=$$SHELL";if (( $$TALON_ATTEMPT <4 )); then echo sleeping 6; sleep 6; echo "hi"; else echo "Not sleeping this time"; fi; echo "this should not appear in the recipe tags unless you try 4 times." diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/util/talon/tests/t6.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/util/talon/tests/t6.mk Thu Mar 18 14:00:53 2010 +0000 @@ -0,0 +1,33 @@ +# +# Copyright (c) 2009-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: +# +include settings.mk + +# Making sure that forcesuccess works. + +TALON_RECIPEATTRIBUTES:=flags='$$TALON_FLAGS' +TALON_RETRIES:=1 + +export TALON_RECIPEATTRIBUTES TALON_RETRIES + +.PHONY: all fred + +all: fred + @echo "t6-PASSED" + +fred: + |TALON_FLAGS=FORCESUCCESS;|echo "Forcesuccess'd command"; exit 1 + + diff -r 169ad30bb410 -r 59ec73480ed3 sbsv2/raptor/win32/bin/talon.exe Binary file sbsv2/raptor/win32/bin/talon.exe has changed