ajack 2004/03/16 13:04:47
Modified: python/gump engine.py build.py
Added: python/gump debug.py
Log:
More work on the standalone scripts...
Revision Changes Path
1.88 +48 -23 gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/gump/python/gump/engine.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- engine.py 16 Mar 2004 19:50:14 -0000 1.87
+++ engine.py 16 Mar 2004 21:04:46 -0000 1.88
@@ -68,16 +68,19 @@
###########################################
def performUpdate(self,run):
- return self.perform(run, GumpTaskList(['update']) )
+ return self.perform(run, GumpTaskList(['update','document']) )
def performBuild(self,run):
- return self.perform(run, GumpTaskList(['build']) )
+ return self.perform(run, GumpTaskList(['build','document']) )
+
+ def performDebug(self,run):
+ return self.perform(run, GumpTaskList(['update','build','document']) )
def performIntegrate(self,run):
- return self.perform(run,
GumpTaskList(['update','build','document','syndicate']) )
+ return self.perform(run,
GumpTaskList(['update','build','document','outputs','notify']) )
def performCheck(self,run):
- return self.perform(run,
GumpTaskList(['update','check','document','syndicate']) )
+ return self.perform(run, GumpTaskList(['update','check','document']) )
###########################################
@@ -167,15 +170,26 @@
def update(self, run):
logResourceUtilization('Before update')
+
+ #
+ # Doing a full build?
+ #
+ all=not run.getOptions().isQuick()
+
+ if all:
+ modules=run.getGumpSet().getModuleSequence()
+ else:
+ modules=run.getGumpSet().getModules()
+
#
# Checkout from source code repositories
#
- self.updateModules(run)
+ self.updateModules(run,modules)
#
# Checkout from source code repositories
#
- self.syncWorkDirs(run)
+ self.syncWorkDirs(run,modules)
# Return an exit code based off success
# :TODO: Move onto run
@@ -186,15 +200,7 @@
return result
- def updateModules(self, run):
- return self.performUpdateModules( run, \
- run.getGumpSet().getModules())
-
- def updateModulesAll(self, run):
- return self.performUpdateModules( run, \
- run.getGumpSet().getModuleSequence())
-
- def performUpdateModules(self, run, list):
+ def updateModules(self, run, list):
workspace = run.getWorkspace()
@@ -269,14 +275,14 @@
# Were the contents of the repository modified?
module.setUpdated(cmdResult.hasOutput())
- def syncWorkDirs( self, run ):
+ def syncWorkDirs( self, run,list ):
"""copy the raw module (project) materials from source to work dir"""
workspace = run.getWorkspace()
log.debug('--- Synchronizing work directories with sources')
- for module in run.getGumpSet().getModuleSequence():
+ for module in list:
# If no CVS/SVN, nothing to sync
if not module.hasCvs() \
@@ -924,13 +930,15 @@
def bind(self,engine):
- self.method=getattr(engine,self.name)
-
- if not (isinstance(self.method,types.MethodType) and
callable(self.method)):
- raise RuntimeError, 'Failed to bind task name [' + self.name + '] to
engine [' + `engine` + ']'
+ self.method=getattr(engine,self.name,None)
+
+ # For debugging ...
+ #if not (isinstance(self.method,types.MethodType) and
callable(self.method)):
+ # raise RuntimeError, 'Failed to bind task name [' + self.name + '] to
engine [' + `engine` + ']'
def invoke(self,run):
- return self.method(run)
+ if self.method:
+ return self.method(run)
class GumpTaskList(list):
@@ -958,28 +966,45 @@
# The rules (the bare minimum of what needs
# to have run, for a task to run w/o crashing).
#
+
+
if 'preprocess'==name:
+ # Everything needs this ...
task=GumpTask(name,[])
elif 'loadStatistics'==name:
+ # The minimum to load stats onto the tree
task=GumpTask(name,['preprocess'])
elif 'updateStatistics'==name:
- task=GumpTask(name,['preprocess','gatherResults'])
+ # Publish results to the statistics database
+ # NB: Not really true to depend upon load, but cleaner..
+ task=GumpTask(name,['preprocess','gatherResults','loadStatistics'])
elif 'update'==name:
+ # Update from CVS|SVN repositories
task=GumpTask(name,['preprocess','loadStatistics'])
elif 'build'==name:
+ # Build using Ant|Maven|...
task=GumpTask(name,['preprocess','loadStatistics'])
elif 'prepareDocumentation'==name:
+ # Prepare documentation (e.g. create forest templates)
task=GumpTask(name,['preprocess',])
elif 'document'==name:
+ # Perform actual documentation
task=GumpTask(name,['preprocess','loadStatistics','prepareDocumentation','gatherResults'])
elif 'notify'==name:
+ # Was once called 'nag'...
task=GumpTask(name,['preprocess','loadStatistics'])
elif 'syndicate'==name:
+ # Syndicate to news feeds
task=GumpTask(name,['preprocess','loadStatistics'])
elif 'gatherResults'==name:
+ # Gather results.xml from other servers
task=GumpTask(name,['preprocess'])
elif 'generateResults'==name:
+ # Generate the results.xml for this server/workspace
task=GumpTask(name,['preprocess','loadStatistics'])
+ elif 'outputs'==name:
+ # Publish the stuff out the door
+
task=GumpTask(name,['syndicate','generateResults','updateStatistics','notify'])
else:
raise RuntimeError, 'Unknown task name ['+name+']'
return task
1.45 +3 -0 gump/python/gump/build.py
Index: build.py
===================================================================
RCS file: /home/cvs/gump/python/gump/build.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- build.py 16 Mar 2004 19:50:14 -0000 1.44
+++ build.py 16 Mar 2004 21:04:47 -0000 1.45
@@ -50,6 +50,9 @@
# get parsed workspace definition
workspace=WorkspaceLoader().load(ws, options.isCache())
+
+ # Ensure we use text, not forrest...
+ options.setText(1)
# The Run Details...
run=GumpRun(workspace,ps,options)
1.1 gump/python/gump/debug.py
Index: debug.py
===================================================================
#!/usr/bin/python
# Copyright 2003-2004 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This is one commandline entrypoint into Gump.
It loads the workspace, then updates the specified modules.
"""
import os.path
import os
import sys
import logging
from gump import log
from gump.engine import GumpEngine
from gump.gumprun import GumpRun, GumpRunOptions, GumpSet
from gump.utils.commandLine import handleArgv
from gump.model.loader import WorkspaceLoader
###############################################################################
# Initialize
###############################################################################
###############################################################################
# Functions
###############################################################################
# static void main()
if __name__=='__main__':
# Process command line
(args,options) = handleArgv(sys.argv)
ws=args[0]
ps=args[1]
# get parsed workspace definition
workspace=WorkspaceLoader().load(ws, options.isCache())
# Ensure we use text, not forrest...
options.setText(1)
# The Run Details...
run=GumpRun(workspace,ps,options)
#
# Perform this integration run...
#
result = GumpEngine().performDebug(run)
#
log.info('Gump Update complete. Exit code:' + str(result))
# bye!
sys.exit(result)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]