ajack 2003/11/25 17:26:28
Modified: python/gump engine.py
python/gump/test pyunit.py
python/gump/model state.py project.py
python/gump/test/resources/full1 module2.xml
python/gump/document forrest.py
Log:
Reworked mkdir/delete
Some documentation tweaks
Revision Changes Path
1.19 +109 -71 jakarta-gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- engine.py 24 Nov 2003 23:05:37 -0000 1.18
+++ engine.py 26 Nov 2003 01:26:28 -0000 1.19
@@ -100,22 +100,20 @@
#
self.build(run)
+ # Update [or load if not 'all'] Statistics
+ self.updateStatistics(run)
+
+ # Build HTML Result (via Forrest)
+ documenter=run.getOptions().getDocumenter()
+ if documenter :
+ documenter.document(run)
+
#
# Only an 'all' is an official build, for them:
#
- # Update statistics
- # Provide Documentation
- # Nag
- # Provide RSS
+ # Nag and provide RSS
#
if run.getGumpSet().isFull():
- # Update Statistics
- self.updateStatistics(run)
-
- # Build HTML Result (via Forrest)
- documenter=run.getOptions().getDocumenter()
- if documenter :
- documenter.document(run)
#
# Nag about failures -- only if we are allowed to
@@ -322,68 +320,100 @@
if not project.okToPerformWork():
log.warn('Failed to build project [' + project.getName() + '],
state:' \
+ project.getStateDescription())
-
+
+
+ def performDelete(self,project,delete,index=0):
+ """ Return the delete command for a <delete entry """
+ basedir=os.path.abspath(project.getModule().getSourceDirectory() or
dir.base)
+
+ #
+ # Delete a directory and/or a file
+ #
+ # :TODO: Before turning this on, we need to ensure that the command
+ # will not run wild. We need to ensure that there is no ";" and we
+ # need to ensure the directory/file is under the workspace.
+ #
+ if delete.dir:
+ dir=os.path.abspath(os.path.join(basedir,delete.dir)
+ try:
+ os.rmdir(dir))
+ except:
+ project.addError('Failed to delete directory ['+dir+'])
+ raise
+ elif delete.file:
+ file=os.path.abspath(os.path.join(basedir,delete.file)
+ try:
+ os.remove(file))
+ except:
+ project.addError('Failed to delete file ['+file+'])
+ raise
+ else:
+ project.addError(' <delete without \'file\' or \'dir\' attributes.')
+ raise RuntimeError('Bad <delete')
+
+ def performMkDir(self,project,mkdir,index=0):
+ """ Return the mkdir comment for a <mkdir entry """
+ basedir=os.path.abspath(self.getModule().getSourceDirectory() or dir.base)
+
+ # ----------------------------------------------------------------
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # Rsync should delete these things, not allow
+ # them to exist. We should NOT do this.
+ dirToMake=os.path.abspath(os.path.join(basedir,mkdir.dir))
+ if not os.path.exists(dirToMake):
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # :TODO: HACK HACK HACK HACK HACK HACK HACK
+ # ----------------------------------------------------------------
+
+ #
+ # Make a directory
+ #
+ if mkdir.dir:
+ try:
+ os.makedirs(dirToMake)
+ except:
+ project.addError('Failed to make directory ['+dirToMake+'])
+ raise
+ else:
+ project.addError(' <mkdir without \'dir\' attribute.')
+ raise RuntimeError('Bad <mkdir, missing \'dir\' attribute')
+
def performPreBuild( self, run, project ):
""" Perform pre-build Actions """
- workspace = run.getWorkspace()
-
- log.debug(' ------ Performing pre-Build Actions (mkdir/delete) for : '+
project.getName())
-
- # Deletes...
- dels=0
- for delete in project.xml.delete:
- cmd=project.getDeleteCommand(delete,dels)
-
- # Execute the command ....
- cmdResult=execute(cmd,workspace.tmpdir)
-
- # Update Context
- work=CommandWorkItem(WORK_TYPE_PREBUILD,cmd,cmdResult)
- project.performedWork(work)
-
- # Update Context w/ Results
- if not cmdResult.state==CMD_STATE_SUCCESS:
- project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
- else:
- dels+=1
- project.changeState(STATE_SUCCESS)
-
- # MkDirs...
- mkdirs=0
- for mkdir in project.xml.mkdir:
- # ----------------------------------------------------------------
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # Rsync should delete these things, not allow
- # them to exist. We should NOT do this.
- basedir=os.path.abspath(project.getModule().getSourceDirectory() \
- or dir.base)
- dirToMake=os.path.abspath(os.path.join(basedir,mkdir.dir))
- if os.path.exists(dirToMake): continue
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # :TODO: HACK HACK HACK HACK HACK HACK HACK
- # ----------------------------------------------------------------
-
+ #
+ #
+ # NOTE --------------- NOT TURNED ON YET!!!!!!
+ #
+ #
+ if 0 and project.okToPerformWork():
- cmd=project.getMkDirCommand(mkdir,mkdirs)
-
- # Execute the command ....
- cmdResult=execute(cmd,workspace.tmpdir)
-
- # Update Context
- work=CommandWorkItem(WORK_TYPE_PREBUILD,cmd,cmdResult)
- project.performedWork(work)
+ log.debug(' ------ Performing pre-Build Actions (mkdir/delete) for : '+
project.getName())
- # Update Context w/ Results
- if not cmdResult.state==CMD_STATE_SUCCESS:
- project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
- else:
- mkdirs+=1
- project.changeState(STATE_SUCCESS)
+ # Deletes...
+ dels=0
+ for delete in project.xml.delete:
+ try:
+ self.performDelete(project,delete,dels)
+ dels+=1
+ project.changeState(STATE_SUCCESS)
+ except:
+ project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
+
+ if project.okToPerformWork():
+ # MkDirs...
+ mkdirs=0
+ for mkdir in project.xml.mkdir:
+ try:
+ self.performMkdir(project,mkdir,mkdirs)
+ mkdirs+=1
+ project.changeState(STATE_SUCCESS)
+ except:
+ project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
if not project.okToPerformWork():
log.warn('Failed to perform prebuild on project [' + project.getName()
+ ']')
@@ -452,8 +482,16 @@
db=StatisticsDB()
- #
- # Update stats (and stash onto projects)
- #
- db.updateStatistics(run.getWorkspace())
+ workspace=run.getWorkspace()
+
+ if run.getGumpSet().isFull():
+ #
+ # Update stats (and stash onto projects)
+ #
+ db.updateStatistics(workspace)
+ else:
+ #
+ # Load stats (and stash onto projects)
+ #
+ db.loadStatistics(workspace)
1.9 +1 -1 jakarta-gump/python/gump/test/pyunit.py
Index: pyunit.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/test/pyunit.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- pyunit.py 23 Nov 2003 06:16:39 -0000 1.8
+++ pyunit.py 26 Nov 2003 01:26:28 -0000 1.9
@@ -282,7 +282,7 @@
printSeparator()
- log.info('Performed [' + `testsRun` + '] with [' + `len(problems)` + ']
issues.')
+ log.info('Performed [' + `testsRun` + '] tests with [' + `len(problems)` +
'] issues.')
for problem in problems:
log.error('PROBLEM: ' + str(problem))
1.7 +6 -4 jakarta-gump/python/gump/model/state.py
Index: state.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/state.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- state.py 19 Nov 2003 19:56:10 -0000 1.6
+++ state.py 26 Nov 2003 01:26:28 -0000 1.7
@@ -112,8 +112,9 @@
REASON_SYNC_FAILED=6
REASON_PREBUILD_FAILED=7
REASON_BUILD_FAILED=8
-REASON_BUILD_TIMEDOUT=9
-REASON_MISSING_OUTPUTS=10
+REASON_POSTBUILD_FAILED=9
+REASON_BUILD_TIMEDOUT=10
+REASON_MISSING_OUTPUTS=11
reasonCodeDescriptions = { REASON_UNSET : "Not Set",
REASON_PACKAGE : "Complete Package Install",
@@ -122,9 +123,10 @@
REASON_CONFIG_FAILED : "Configuration Failed",
REASON_UPDATE_FAILED : "Update Failed",
REASON_SYNC_FAILED : "Synchronize Failed",
- REASON_BUILD_FAILED : "Pre-Build Failed",
- REASON_BUILD_TIMEDOUT : "Build Timed Out",
+ REASON_PREBUILD_FAILED : "Pre-Build Failed",
REASON_BUILD_FAILED : "Build Failed",
+ REASON_POSTBUILD_FAILED : "Post-Build Failed",
+ REASON_BUILD_TIMEDOUT : "Build Timed Out",
REASON_MISSING_OUTPUTS : "Missing Build Outputs" }
def reasonString(reasonCode):
1.17 +1 -48 jakarta-gump/python/gump/model/project.py
Index: project.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/project.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- project.py 24 Nov 2003 01:45:15 -0000 1.16
+++ project.py 26 Nov 2003 01:26:28 -0000 1.17
@@ -726,53 +726,6 @@
return cmd
- def getDeleteCommand(self,delete,index=0):
- """ Return the delete command for a <delete entry """
- basedir=os.path.abspath(self.getModule().getSourceDirectory() or dir.base)
-
- cmd=Cmd('echo rm','delete_'+ \
- self.getModule().getName()+'_' \
- +self.getName()+'_'+str(index+1),\
- basedir)
-
- #
- # Delete a directory and/or a file
- #
- # :TODO: Before turning this on, we need to ensure that the command
- # will not run wild. We need to ensure that there is no ";" and we
- # need to ensure the directory/file is under the workspace.
- #
- if delete.dir:
- cmd.addParameter('-rf')
- cmd.addParameter(os.path.abspath(os.path.join(basedir,delete.dir)))
- elif delete.file:
- cmd.addParameter('-f')
- cmd.addParameter(os.path.abspath(os.path.join(basedir,delete.file)))
- else:
- log.info(' <delete without \'file\' or \'dir\' attributes.')
- return None
-
- return cmd
-
- def getMkDirCommand(self,mkdir,index=0):
- """ Return the mkdir comment for a <mkdir entry """
- basedir=os.path.abspath(self.getModule().getSourceDirectory() or dir.base)
-
- cmd=Cmd('mkdir','mkdir_'+self.getModule().getName()+'_' \
- +self.getName()+'_' \
- +str(index+1),\
- basedir)
-
- #
- # Make a directory
- #
- if mkdir.dir:
- cmd.addParameter(os.path.abspath(os.path.join(basedir,mkdir.dir)))
- else:
- log.info(' <mkdir without \'dir\' attribute.')
- return None
-
- return cmd
def dump(self, indent=0, output=sys.stdout):
""" Display the contents of this object """
@@ -962,7 +915,7 @@
# If 'all' or in ids list:
if (not ids) or (jar.getId() in ids):
if ids: dependStr += ' Id = ' + jar.getId()
-
path=AnnotatedPath(jar.path,self,dependency.getOwnerProject(),dependStr)
+
path=AnnotatedPath(jar.path,project,dependency.getOwnerProject(),dependStr)
# Add to CLASSPATH
if not jar.getType() == 'boot':
1.4 +1 -0 jakarta-gump/python/gump/test/resources/full1/module2.xml
Index: module2.xml
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/test/resources/full1/module2.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- module2.xml 25 Nov 2003 04:58:04 -0000 1.3
+++ module2.xml 26 Nov 2003 01:26:28 -0000 1.4
@@ -18,6 +18,7 @@
<option project="random"/>
<home nested="dist"/>
+ <mkdir dir="mkdir"/>
<jar name="lib/output2.jar" id="output2"/>
1.16 +4 -3 jakarta-gump/python/gump/document/forrest.py
Index: forrest.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- forrest.py 24 Nov 2003 18:42:08 -0000 1.15
+++ forrest.py 26 Nov 2003 01:26:28 -0000 1.16
@@ -364,7 +364,8 @@
projectsSection=document.createSection('Projects (in build order)')
projectsTable=projectsSection.createTable(['Name','Project
State','Duration\nin state','Last Updated','Elapsed'])
pcount=0
- for project in sortedProjectList:
+ for project in gumpSet.getSequence():
+ # :TODO: Next line irrelevent?
if not gumpSet.inSequence(project): continue
pcount+=1
@@ -866,8 +867,8 @@
for nagEntry in project.xml.nag:
toaddr=getattr(nagEntry,'to') or workspace.mailinglist
fromaddr=getStringFromUnicode(getattr(nagEntry,'from') or
workspace.email)
- detailsList.createEntry("Nag To: ", toaddr)
- detailsList.createEntry("Nag From: ", fromaddr)
+ detailsList.createEntry("Nag To: ").createFork('mailto:'+toaddr,toaddr)
+ detailsList.createEntry("Nag From:
").createFork('mailto:'+fromaddr,fromaddr)
self.documentProjectList(document, "Project Dependencies",
project.getDependencies(), 0, project)
self.documentProjectList(document, "Project Dependees",
project.getDependees(), 1, project)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]