ajack 2004/05/25 15:46:01 Modified: python/gump/model project.py python/gump/runner runner.py python/gump/utils launcher.py sync.py python/gump/core gumprun.py python/gump/build script.py maven.py ant.py builder.py project mx4j.xml python/gump/document/xdocs documenter.py python/gump/test utils.py src/documentation/content/xdocs tabs.xml site.xml Log: 1) A notify change
2) Various logging changes (cosmetic) 3) Some docs tweaks (mainly cosmetic, trying to make log stand out) 4) wasBuilt() [on project] 5) launcher tests 6) Tweak to src/documentation for Forrest (but who knows..) Revision Changes Path 1.84 +10 -0 gump/python/gump/model/project.py Index: project.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/project.py,v retrieving revision 1.83 retrieving revision 1.84 diff -u -r1.83 -r1.84 --- project.py 21 May 2004 23:15:04 -0000 1.83 +++ project.py 25 May 2004 22:46:00 -0000 1.84 @@ -180,6 +180,8 @@ # self.honoraryPackage=0 + self.built=0 + def hasAnt(self): if hasattr(self,'ant') and self.ant: return 1 return 0 @@ -267,6 +269,14 @@ # Existence means 'true' return hasattr(self.xml,'redistributable') \ or (self.module and self.module.isRedistributable()) + + + def wasBuilt(self): + """ Was a build attempt made? """ + return self.built + + def setBuilt(self,built): + self.built=built def hasReports(self): if self.reports: return 1 1.4 +13 -5 gump/python/gump/runner/runner.py Index: runner.py =================================================================== RCS file: /home/cvs/gump/python/gump/runner/runner.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- runner.py 24 May 2004 16:39:08 -0000 1.3 +++ runner.py 25 May 2004 22:46:00 -0000 1.4 @@ -104,14 +104,17 @@ self.run.dispatchEvent(InitializeRunEvent(self.run)) def initializeActors(self): + + # Stamp times self.run.registerActor(TimeKeeper(self.run)) - self.run.registerActor(Statistician(self.run)) + # Update statistics + self.run.registerActor(Statistician(self.run)) - self.run.registerActor(Resulter(self.run)) - self.run.registerActor(Syndicator(self.run)) + # Generate results + self.run.registerActor(Resulter(self.run)) - # + # Document.. # Use Forrest if available & not overridden... # documenter=None @@ -124,7 +127,12 @@ self.run.getWorkspace().getLogUrl()) self.run.getOptions().setResolver(documenter.getResolver()) self.run.registerActor(documenter) - + + + # Syndicate once documented + self.run.registerActor(Syndicator(self.run)) + + # Notify last self.run.registerActor(Notifier(self.run)) def finalize(self): 1.24 +3 -1 gump/python/gump/utils/launcher.py Index: launcher.py =================================================================== RCS file: /home/cvs/gump/python/gump/utils/launcher.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- launcher.py 21 May 2004 23:15:06 -0000 1.23 +++ launcher.py 25 May 2004 22:46:00 -0000 1.24 @@ -162,9 +162,11 @@ class Cmd: """Command Line (executable plus parameters)""" - def __init__(self,command,name,cwd=None,env=None,timeout=None): + def __init__(self,command,name=None,cwd=None,env=None,timeout=None): self.cmdpath=command self.name=name + if not self.name: + self.name=command self.params=Parameters() self.env=env if not env: self.env={} 1.18 +2 -2 gump/python/gump/utils/sync.py Index: sync.py =================================================================== RCS file: /home/cvs/gump/python/gump/utils/sync.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- sync.py 21 May 2004 23:15:06 -0000 1.17 +++ sync.py 25 May 2004 22:46:00 -0000 1.18 @@ -65,7 +65,7 @@ if self.output: if isinstance(self.output,types.StringTypes): doClose=1 - log.debug(' changes to [' + self.output + ']') + log.debug(' changes to [' + self.output + ']') self.outputStream=open(self.output,'w') else: self.outputStream=self.output @@ -103,7 +103,7 @@ if not os.path.getsize(self.output) > 0: try: os.remove(self.output) - log.debug(' No changes, removed [' + self.output + ']') + log.debug('No changes, removed [' + self.output + ']') except: pass return self.actionsOccured 1.8 +1 -1 gump/python/gump/core/gumprun.py Index: gumprun.py =================================================================== RCS file: /home/cvs/gump/python/gump/core/gumprun.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- gumprun.py 24 May 2004 16:39:08 -0000 1.7 +++ gumprun.py 25 May 2004 22:46:00 -0000 1.8 @@ -620,7 +620,7 @@ import md5 import socket m=md5.new() - self.guid = socket.gethostname() + ':' + workspace.getName() + ':' + default.datetime + self.guid = socket.getfqdn() + ':' + workspace.getName() + ':' + default.datetime m.update(self.guid) self.hexguid=m.hexdigest().upper() log.debug('Run GUID [' + `self.guid` + '] using [' + `self.hexguid` + ']') 1.3 +2 -1 gump/python/gump/build/script.py Index: script.py =================================================================== RCS file: /home/cvs/gump/python/gump/build/script.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- script.py 21 May 2004 23:15:07 -0000 1.2 +++ script.py 25 May 2004 22:46:00 -0000 1.3 @@ -54,7 +54,7 @@ workspace=self.run.getWorkspace() - log.info(' ------ Script-ing: #[' + `project.getPosition()` + '] : ' + project.getName()) + log.info('Run Project (as a script): #[' + `project.getPosition()` + '] : ' + project.getName()) # # Get the appropriate build command... @@ -68,6 +68,7 @@ # Update Context work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult) project.performedWork(work) + project.setBuilt(1) # Update Context w/ Results if not cmdResult.state==CMD_STATE_SUCCESS: 1.3 +3 -4 gump/python/gump/build/maven.py Index: maven.py =================================================================== RCS file: /home/cvs/gump/python/gump/build/maven.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- maven.py 21 May 2004 23:15:07 -0000 1.2 +++ maven.py 25 May 2004 22:46:00 -0000 1.3 @@ -56,11 +56,10 @@ workspace=self.run.getWorkspace() - log.debug(' ------ Maven-ing: #[' + `project.getPosition()` + '] ' + project.getName()) + log.debug('Run Maven on Project: #[' + `project.getPosition()` + '] ' + project.getName()) self.performPreBuild(project, stats) - wasBuilt=0 if project.okToPerformWork(): # @@ -75,7 +74,7 @@ # Update Context work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult) project.performedWork(work) - wasBuilt=1 + project.setBuilt(1) # Update Context w/ Results if not cmdResult.state==CMD_STATE_SUCCESS: @@ -87,7 +86,7 @@ # For now, things are going good... project.changeState(STATE_SUCCESS) - if wasBuilt: + if project.wasBuilt(): pomFile=self.locateMavenProjectFile(project) if os.path.exists(pomFile): project.addDebug('Maven POM in: ' + pomFile) 1.3 +2 -2 gump/python/gump/build/ant.py Index: ant.py =================================================================== RCS file: /home/cvs/gump/python/gump/build/ant.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ant.py 21 May 2004 23:15:07 -0000 1.2 +++ ant.py 25 May 2004 22:46:00 -0000 1.3 @@ -57,7 +57,7 @@ workspace=self.run.getWorkspace() - log.info(' ------ Ant-ing: #[' + `project.getPosition()` + '] : ' + project.getName()) + log.info('Run Ant on Project: #[' + `project.getPosition()` + '] : ' + project.getName()) # # Get the appropriate build command... @@ -71,7 +71,7 @@ # Update Context work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult) project.performedWork(work) - wasBuilt=1 + project.setBuilt(1) # Update Context w/ Results if not cmdResult.state==CMD_STATE_SUCCESS: 1.3 +5 -8 gump/python/gump/build/builder.py Index: builder.py =================================================================== RCS file: /home/cvs/gump/python/gump/build/builder.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- builder.py 21 May 2004 23:15:07 -0000 1.2 +++ builder.py 25 May 2004 22:46:00 -0000 1.3 @@ -128,7 +128,7 @@ workspace=self.run.getWorkspace() - log.info(' Project: #[' + `project.getPosition()` + '] : ' + project.getName()) + log.info('Build Project: #[' + `project.getPosition()` + '] : ' + project.getName()) # Extract stats (in case we want to do conditional processing) stats=None @@ -143,9 +143,8 @@ # Do this even if not ok self.performPreBuild(project, stats) - wasBuilt=0 if project.okToPerformWork(): - log.debug(' ------ Building: [' + `project.getPosition()` + '] ' + project.getName()) + log.debug('Performing Build Upon: [' + `project.getPosition()` + '] ' + project.getName()) # Turn on --verbose or --debug if failing ... if stats: @@ -166,8 +165,6 @@ elif project.hasMaven(): self.maven.buildProject(project, stats) - # A build attempt was made... - wasBuilt=1 if not project.okToPerformWork() and not project.isDebug(): # Display... @@ -175,7 +172,7 @@ project.setDebug(1) # Do this even if not ok - self.performPostBuild( project, wasBuilt, stats ) + self.performPostBuild( project, stats ) if project.isFailed(): log.warn('Failed to build project #[' + `project.getPosition()` + '] : [' + project.getName() + '], state:' \ @@ -280,7 +277,7 @@ if startedOk and not project.okToPerformWork(): log.warn('Failed to perform pre-build on project [' + project.getName() + ']') - def performPostBuild(self, project, wasBuilt, stats): + def performPostBuild(self, project, stats): """Perform Post-Build Actions""" log.debug(' ------ Performing post-Build Actions (check jars) for : '+ project.getName()) @@ -385,7 +382,7 @@ # # Display report output, even if failed... # - if project.hasReports() and wasBuilt: + if project.hasReports() and project.wasBuilt(): #project.addInfo('Project produces reports') for report in project.getReports(): reportDir=report.getResolvedPath() 1.25 +1 -1 gump/project/mx4j.xml Index: mx4j.xml =================================================================== RCS file: /home/cvs/gump/project/mx4j.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- mx4j.xml 24 May 2004 23:18:19 -0000 1.24 +++ mx4j.xml 25 May 2004 22:46:00 -0000 1.25 @@ -24,7 +24,7 @@ <cvs repository="sourceforge" dir="mx4j"/> - <nag from="Gump <[EMAIL PROTECTED]>" + <nag from="Simone Bordet <[EMAIL PROTECTED]>" to="[EMAIL PROTECTED]"/> <project name="mx4j"> 1.4 +63 -53 gump/python/gump/document/xdocs/documenter.py Index: documenter.py =================================================================== RCS file: /home/cvs/gump/python/gump/document/xdocs/documenter.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- documenter.py 24 May 2004 16:39:09 -0000 1.3 +++ documenter.py 25 May 2004 22:46:00 -0000 1.4 @@ -1461,52 +1461,53 @@ self.documentAnnotations(document,module) self.documentServerLinks(document,module) - projectsSection=document.createSection('Projects') - if (len(module.getProjects()) > 1): - self.documentSummary(projectsSection,module.getProjectSummary()) + if not realtime: + projectsSection=document.createSection('Projects') + if (len(module.getProjects()) > 1): + self.documentSummary(projectsSection,module.getProjectSummary()) - if (len(module.getProjects()) > 1): - ptodosSection=projectsSection.createSection('Projects with Issues') - ptodosTable=ptodosSection.createTable(['Name','State','Elapsed']) - pcount=0 - for project in module.getProjects(): - if not self.gumpSet.inProjectSequence(project): continue - - # - # Determine if there are todos, otherwise continue - # - todos=0 - for pair in project.aggregateStates(): - if pair.state==STATE_FAILED: - todos=1 + if (len(module.getProjects()) > 1): + ptodosSection=projectsSection.createSection('Projects with Issues') + ptodosTable=ptodosSection.createTable(['Name','State','Elapsed']) + pcount=0 + for project in module.getProjects(): + if not self.gumpSet.inProjectSequence(project): continue + + # + # Determine if there are todos, otherwise continue + # + todos=0 + for pair in project.aggregateStates(): + if pair.state==STATE_FAILED: + todos=1 - if not todos: continue + if not todos: continue + pcount+=1 + + projectRow=ptodosTable.createRow() + projectRow.createComment(project.getName()) + self.insertLink(project,module,projectRow.createData()) + self.insertStateIcon(project,module,projectRow.createData()) + projectRow.createData(secsToElapsedTimeString(project.getElapsedSecs())) + + if not pcount: ptodosTable.createLine('None') + + pallSection=projectsSection.createSection('All Projects') + pallTable=pallSection.createTable(['Name','State','Elapsed']) + + pcount=0 + for project in module.getProjects(): + if not self.run.getGumpSet().inProjectSequence(project): continue pcount+=1 - projectRow=ptodosTable.createRow() + projectRow=pallTable.createRow() projectRow.createComment(project.getName()) - self.insertLink(project,module,projectRow.createData()) + self.insertLink(project,module,projectRow.createData()) self.insertStateIcon(project,module,projectRow.createData()) projectRow.createData(secsToElapsedTimeString(project.getElapsedSecs())) - - if not pcount: ptodosTable.createLine('None') - - pallSection=projectsSection.createSection('All Projects') - pallTable=pallSection.createTable(['Name','State','Elapsed']) - - pcount=0 - for project in module.getProjects(): - if not self.run.getGumpSet().inProjectSequence(project): continue - pcount+=1 - - projectRow=pallTable.createRow() - projectRow.createComment(project.getName()) - self.insertLink(project,module,projectRow.createData()) - self.insertStateIcon(project,module,projectRow.createData()) - projectRow.createData(secsToElapsedTimeString(project.getElapsedSecs())) - if not pcount: pallTable.createLine('None') + if not pcount: pallTable.createLine('None') self.documentFileList(document,module,'Module-level Files') self.documentWorkList(document,module,'Module-level Work') @@ -1535,45 +1536,44 @@ if module.hasCvs(): if module.cvs.hasModule(): - repoList.createEntry( "CVS Module: ", module.cvs.getModule()) + repoList.createEntry( "CVS Module: ", module.cvs.getModule()) if module.cvs.hasTag(): - repoList.createEntry( "CVS Tag: ", module.cvs.getTag()) + repoList.createEntry( "CVS Tag: ", module.cvs.getTag()) if module.cvs.hasDir(): - repoList.createEntry( "CVS Dir: ", module.cvs.getDir()) + repoList.createEntry( "CVS Dir: ", module.cvs.getDir()) if module.cvs.hasHostPrefix(): - repoList.createEntry( "CVS Host Prefix: ", module.cvs.getHostPrefix()) + repoList.createEntry( "CVS Host Prefix: ", module.cvs.getHostPrefix()) repoList.createEntry( "CVSROOT: ", module.cvs.getCvsRoot()) if module.hasSvn(): if module.svn.hasDir(): - repoList.createEntry( "SVN Directory: ", module.svn.getDir()) + repoList.createEntry( "SVN Directory: ", module.svn.getDir()) repoList.createEntry( "SVN URL: ", module.svn.getRootUrl()) repoList.createEntry('Redistributable: ', getBooleanString(module.isRedistributable())) if module.isRedistributable(): - if module.hasJars(): if module.jars.hasUrl(): - repoList.createEntry( "Jars URL: ", module.jars.getUrl()) - + repoList.createEntry( "Jars URL: ", module.jars.getUrl()) - # x.write('<p><strong>Module Config :</strong> <link href=\'xml.html\'>XML</link></p>') + # x.write('<p><strong>Module Config :</strong> <link href=\'xml.html\'>XML</link></p>') self.documentXML(detailsSection,module) document.serialize() document=None - - # Document Projects - for project in module.getProjects(): - if not self.run.getGumpSet().inProjectSequence(project): continue - self.documentProject(project) + + if not realtime: + # Document Projects + for project in module.getProjects(): + if not self.run.getGumpSet().inProjectSequence(project): continue + self.documentProject(project) # Document the module XML # x=startXDoc(getModuleXMLDocument(self.workspace,modulename,mdir)) @@ -1628,8 +1628,14 @@ if project.cause and not project==project.cause: self.insertTypedLink( project.cause, project, stateList.createEntry( "Root Cause: ")) + self.documentAnnotations(document,project) - self.documentWorkList(document,project,'Project-level Work',0) + + note='' + if project.wasBuilt(): + note='Project build output found here...' + self.documentWorkList(document,project,'Project-level Work',0, \ + note) self.documentServerLinks(document,project) # Project Details (main ones) @@ -2136,12 +2142,16 @@ ' (' + '%02.2f' % summary.packagesPercentage + '%)'] ) - def documentWorkList(self,xdocNode,workable,description='Work',tailFail=1): + def documentWorkList(self,xdocNode,workable,description='Work',tailFail=1,note=''): worklist=workable.getWorkList() if not worklist: return workSection=xdocNode.createSection(description) + + if note: + workSection.createNote(note) + workTable=workSection.createTable(['Name','State','Start','Elapsed']) for work in worklist: 1.12 +23 -2 gump/python/gump/test/utils.py Index: utils.py =================================================================== RCS file: /home/cvs/gump/python/gump/test/utils.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- utils.py 21 May 2004 23:15:00 -0000 1.11 +++ utils.py 25 May 2004 22:46:01 -0000 1.12 @@ -18,7 +18,7 @@ """ from gump.utils import * -from gump.utils.launcher import Parameters +from gump.utils.launcher import * from gump.test.pyunit import UnitTestSuite class TestBean: @@ -143,5 +143,26 @@ def testGarbageCollection(self): invokeGarbageCollection('testCollect') + + def testGoodLaunch(self): + env=Cmd('env') + result=execute(env) + self.assertEqual('Ought succeed', result.state,CMD_STATE_SUCCESS) + + def testBadLaunch(self): + env=Cmd('eXnXv') + result=execute(env) + self.assertEqual('Ought failed', result.state, CMD_STATE_FAILED) + + def testFailedLaunch(self): + env=Cmd('exit 2') + result=execute(env) + self.assertEqual('Ought failed', result.state, CMD_STATE_FAILED) + self.assertEqual('Ought failed', result.exit_code, 2) + + def testFailedLaunch2(self): + env=Cmd('exit 70') + result=execute(env) + self.assertEqual('Ought failed', result.state, CMD_STATE_FAILED) + self.assertEqual('Ought failed', result.exit_code, 70) - \ No newline at end of file 1.4 +3 -3 gump/src/documentation/content/xdocs/tabs.xml Index: tabs.xml =================================================================== RCS file: /home/cvs/gump/src/documentation/content/xdocs/tabs.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tabs.xml 27 Feb 2004 09:38:56 -0000 1.3 +++ tabs.xml 25 May 2004 22:46:01 -0000 1.4 @@ -16,9 +16,9 @@ --> <!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.0//EN" "tab-cocoon-v10.dtd"> - <tabs software="MyProj" - title="MyProj" - copyright="Foo" + <tabs software="Apache Gump" + title="Apache Gump" + copyright="[EMAIL PROTECTED]@ Apache Software Foundation" xmlns:xlink="http://www.w3.org/1999/xlink"> <tab id="home" label="Home" dir=""/> 1.15 +1 -1 gump/src/documentation/content/xdocs/site.xml Index: site.xml =================================================================== RCS file: /home/cvs/gump/src/documentation/content/xdocs/site.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- site.xml 20 Apr 2004 11:48:49 -0000 1.14 +++ site.xml 25 May 2004 22:46:01 -0000 1.15 @@ -17,7 +17,7 @@ <site label="Gump" href="" xmlns="http://apache.org/forrest/linkmap/1.0" - tab="home"> + tab="gump"> <gump label="Gump"> <index href="index.html" label="Home"/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]