def Introduction(self): """Print a header of useful information about Raptor""" self.Info("%s: version %s\n", name, raptor_version.fullversion()) self.Info("%s %s", env, str(self.home)) self.Info("Set-up %s", str(self.raptorXML)) self.Info("Command-line-arguments %s", " ".join(self.args)) self.Info("Current working directory %s", os.getcwd()) # the inherited environment for e, value in sorted( os.environ.items() ): self.Info("Environment %s=%s", e, value.replace("]]>", "]]>")) # and some general debug stuff self.Debug("Platform %s", "-".join(hostplatform)) self.Debug("Filesystem %s", self.filesystem) self.Debug("Python %d.%d.%d", *sys.version_info[:3]) self.Debug("Command-line-parser %s", self.CLI) for e,value in self.override.items(): self.Debug("Override %s = %s", e, value) for t in self.targets: self.Debug("Target %s", t)
def OpenLog(self): """Open a log file for the various I/O methods to write to.""" try: # Find all the raptor plugins and put them into a pluginbox. if not self.systemPlugins.isAbsolute(): self.systemPlugins = self.home.Append(self.systemPlugins) self.pbox = pluginbox.PluginBox(str(self.systemPlugins)) self.raptor_params = BuildStats(self) # Open the requested plugins using the pluginbox self.out.open(self.raptor_params, self.filterList, self.pbox) # log header self.out.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n") namespace = "http://symbian.com/xml/build/log" progress_namespace = "http://symbian.com/xml/build/log/progress" schema = "http://symbian.com/xml/build/log/1_0.xsd" self.out.write("<buildlog sbs_version=\"%s\" xmlns=\"%s\" xmlns:progress=\"%s\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"%s %s\">\n" % (raptor_version.fullversion(), namespace, progress_namespace, namespace, schema)) self.logOpen = True except Exception,e: self.out = sys.stdout # make sure that we can actually get errors out. self.logOpen = False self.FatalError("Unable to open the output logs: %s" % str(e))
def PrintVersion(self,dummy): global name print name, "version", raptor_version.fullversion() self.mission = Raptor.M_VERSION return False
def __init__(self, Raptor, engine="make_engine"): self.raptor = Raptor self.valid = True self.descrambler = None self.descrambler_started = False # look for an alias first as this gives end-users a chance to modify # the shipped variant rather than completely replacing it. if engine in Raptor.cache.aliases: avar = Raptor.cache.FindNamedAlias(engine) elif engine in Raptor.cache.variants: avar = Raptor.cache.FindNamedVariant(engine) else: raise BadMakeEngineException("'%s' does not appear to be a make engine - no settings found for it" % engine) if not avar.isDerivedFrom("make_engine", Raptor.cache): raise BadMakeEngineException("'%s' is not a build engine (it's a variant but it does not extend 'make_engine')" % engine) # find the variant and extract the values try: units = avar.GenerateBuildUnits(Raptor.cache) evaluator = Raptor.GetEvaluator( None, units[0] , gathertools=True) # shell self.shellpath = evaluator.Get("DEFAULT_SHELL") usetalon_s = evaluator.Get("USE_TALON") self.usetalon = usetalon_s is not None and usetalon_s != "" self.talonshell = str(evaluator.Get("TALON_SHELL")) self.talontimeout = str(evaluator.Get("TALON_TIMEOUT")) self.talonretries = str(evaluator.Get("TALON_RETRIES")) # work around for RVCT 2.2 failed compiles delete_on_failed_compile_s = evaluator.Get("DELETE_ON_FAILED_COMPILE") self.delete_on_failed_compile = "" if delete_on_failed_compile_s is not None and delete_on_failed_compile_s != "": self.delete_on_failed_compile = "1" # commands self.initCommand = evaluator.Get("initialise") self.buildCommand = evaluator.Get("build") self.shutdownCommand = evaluator.Get("shutdown") # options self.makefileOption = evaluator.Get("makefile") self.keepGoingOption = evaluator.Get("keep_going") 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: self.annoFileName = string_following("--emake-annofile=", o) if self.annoFileName: 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=<filename>") self.copyLogFromAnnoFile = False # buffering self.scrambled = (evaluator.Get("scrambled") == "true") # check tool versions Raptor.CheckToolset(evaluator, avar.name) # default targets (can vary per-invocation) self.defaultTargets = Raptor.defaultTargets # work out how to split up makefiles try: selectorNames = [ x.strip() for x in evaluator.Get("selectors").split(',') if x.strip() != "" ] self.selectors = [] if len(selectorNames) > 0: for name in selectorNames: pattern = evaluator.Get(name.strip() + ".selector.iface") target = evaluator.Get(name.strip() + ".selector.target") ignoretargets = evaluator.Get(name.strip() + ".selector.ignoretargets") self.selectors.append(MakefileSelector(name,pattern,target,ignoretargets)) except KeyError: Raptor.Error("%s.selector.iface, %s.selector.target not found in make engine configuration", name, name) self.selectors = [] except KeyError: self.valid = False raise BadMakeEngineException("Bad '%s' configuration found." % engine) # there must at least be a build command... if not self.buildCommand: self.valid = False raise BadMakeEngineException("No build command for '%s'"% engine) if self.usetalon: talon_settings=""" TALON_SHELL:=%s TALON_TIMEOUT:=%s TALON_RECIPEATTRIBUTES:=\ name='$$RECIPE'\ target='$$TARGET'\ host='$$HOSTNAME'\ layer='$$COMPONENT_LAYER'\ component='$$COMPONENT_NAME'\ bldinf='$$COMPONENT_META' mmp='$$PROJECT_META'\ config='$$SBS_CONFIGURATION' platform='$$PLATFORM'\ phase='$$MAKEFILE_GROUP' source='$$SOURCE' export TALON_RECIPEATTRIBUTES TALON_SHELL TALON_TIMEOUT USE_TALON:=%s """ % (self.talonshell, self.talontimeout, "1") else: talon_settings=""" USE_TALON:= """ timing_start = "$(info " + \ raptor_timing.Timing.custom_string(tag = "start", object_type = "makefile", task = "parse", key = "$(THIS_FILENAME)", time="$(shell date +%s.%N)").rstrip("\n") + ")" timing_end = "$(info " + \ raptor_timing.Timing.custom_string(tag = "end", object_type = "makefile", task = "parse", key = "$(THIS_FILENAME)", time="$(shell date +%s.%N)").rstrip("\n") + ")" # Debugging on or off for make: # We need it at the very top level so that it can be used # to determine what extra info to put in recipe tags try: flmdebug_setting = os.environ["FLMDEBUG"] except KeyError: flmdebug_setting = "" self.makefile_prologue = """ # generated by %s %s HOSTPLATFORM:=%s HOSTPLATFORM_DIR:=%s OSTYPE:=%s FLMHOME:=%s SHELL:=%s THIS_FILENAME:=$(firstword $(MAKEFILE_LIST)) DELETE_ON_FAILED_COMPILE:=%s %s FLMDEBUG:=%s include %s """ % ( raptor.name, raptor_version.fullversion(), " ".join(raptor.hostplatform), raptor.hostplatform_dir, self.raptor.filesystem, str(self.raptor.systemFLM), self.shellpath, self.delete_on_failed_compile, talon_settings, flmdebug_setting, self.raptor.systemFLM.Append('globals.mk') ) # Unless dependency processing has been eschewed via the CLI, use a .DEFAULT target to # trap missing dependencies (ignoring user config files that we know are usually absent) if not (self.raptor.noDependGenerate or self.raptor.noDependInclude): self.makefile_prologue += """ $(FLMHOME)/user/final.mk: $(FLMHOME)/user/default.flm: $(FLMHOME)/user/globals.mk: .DEFAULT:: @echo "<warning>Missing dependency detected: $@</warning>" """ # Only output timings if requested on CLI if self.raptor.timing: self.makefile_prologue += "\n# Print Start-time of Makefile parsing\n" \ + timing_start + "\n\n" self.makefile_epilogue = "\n\n# Print End-time of Makefile parsing\n" \ + timing_end + "\n" else: self.makefile_epilogue = "" self.makefile_epilogue += """ include %s """ % (self.raptor.systemFLM.Append('final.mk') )
def testVersion(self): self.failUnless(re.match("^\d+\.\d+\.", raptor_version.fullversion()))