diff -r eb060913c963 -r de5b887c98f7 sbsv2/raptor/python/raptor.py --- a/sbsv2/raptor/python/raptor.py Tue May 18 19:36:14 2010 +0100 +++ b/sbsv2/raptor/python/raptor.py Fri Jun 04 13:09:28 2010 +0100 @@ -338,9 +338,6 @@ if build.quiet == True: cli_options += " -q" - if build.timing == True: - cli_options += " --timing" - if build.noDependInclude == True: cli_options += " --no-depend-include" @@ -448,9 +445,10 @@ created by the Main function. When operated by an IDE several Raptor objects may be created and operated at the same time.""" - + # mission enumeration M_BUILD = 1 - M_VERSION = 2 + M_QUERY = 2 + M_VERSION = 3 def __init__(self, home = None): @@ -520,7 +518,8 @@ self.noDependInclude = False self.noDependGenerate = False self.projects = set() - + self.queries = [] + self.cache = raptor_cache.Cache(self) self.override = {env: str(self.home)} self.targets = [] @@ -534,7 +533,7 @@ # what platform and filesystem are we running on? self.filesystem = raptor_utilities.getOSFileSystem() - self.timing = False + self.timing = True # Needed by filters such as copy_file to monitor progress self.toolset = None self.starttime = time.time() @@ -696,7 +695,7 @@ return True def SetTiming(self, TrueOrFalse): - self.timing = TrueOrFalse + self.Info("--timing switch no longer has any effect - build timing is now permanently on") return True def SetParallelParsing(self, type): @@ -717,6 +716,11 @@ self.projects.add(projectName.lower()) return True + def AddQuery(self, q): + self.queries.append(q) + self.mission = Raptor.M_QUERY + return True + def FilterList(self, value): self.filterList = value return True @@ -795,8 +799,10 @@ self.args = args # assuming self.CLI = "raptor_cli" - more_to_do = raptor_cli.GetArgs(self, args) + if not raptor_cli.GetArgs(self, args): + self.skipAll = True # nothing else to do + def ParseCommandLineTargets(self): # resolve inter-argument dependencies. # --what or --check implies the WHAT target and FilterWhat Filter if self.doWhat or self.doCheck: @@ -829,9 +835,13 @@ self.filterList += ",filterclean" if is_suspicious_clean: self.Warn('CLEAN, CLEANEXPORT and a REALLYCLEAN should not be combined with other targets as the result is unpredictable.') + else: + """ Copyfile implements the tag which is primarily useful with cluster builds. + It allows file copying to occur on the primary build host rather than on the cluster. + This is more efficient. + """ + self.filterList += ",filtercopyfile" - if not more_to_do: - self.skipAll = True # nothing else to do def ProcessConfig(self): # this function will perform additional processing of config @@ -1057,7 +1067,7 @@ self.raptor_params = BuildStats(self) # Open the requested plugins using the pluginbox - self.out.open(self.raptor_params, self.filterList.split(','), self.pbox) + self.out.open(self.raptor_params, self.filterList, self.pbox) # log header self.out.write("\n") @@ -1219,6 +1229,31 @@ return layers + def Query(self): + "process command-line queries." + + if self.mission != Raptor.M_QUERY: + return 0 + + # establish an object cache based on the current settings + self.LoadCache() + + # our "self" is a valid object for initialising an API Context + import raptor_api + api = raptor_api.Context(self) + + print "" % raptor_version.numericversion() + + for q in self.queries: + try: + print api.stringquery(q) + + except Exception, e: + self.Error("exception '%s' with query '%s'", str(e), q) + + print "" + return self.errorCode + def Build(self): if self.mission != Raptor.M_BUILD: # help or version requested instead. @@ -1318,9 +1353,21 @@ build.ConfigFile() build.ProcessConfig() build.CommandLine(argv) + build.ParseCommandLineTargets() return build + + @classmethod + def CreateCommandlineAnalysis(cls, argv): + """ Perform an analysis run where a build is not performed. """ + build = Raptor() + build.AssertBuildOK() + build.ConfigFile() + build.ProcessConfig() + build.CommandLine(argv) + # Don't parse command line targets - they don't make any sense if you're not doing a build + return build # Class for passing constricted parameters to filters @@ -1356,6 +1403,9 @@ # object which represents a build b = Raptor.CreateCommandlineBuild(argv) + if b.mission == Raptor.M_QUERY: + return b.Query() + return b.Build()