ajack 2003/12/02 09:36:40
Modified: python/gump engine.py build.py
python/gump/document forrest.py
project ws-axis.xml
python exe.py
python/gump/utils work.py tools.py
python/gump/model project.py object.py
python/gump/test pyunit.py
python/gump/test/resources/full1 module3.xml
python/gump/output rss.py
Added: python/gump/test tools.py
Log:
1) Tried to make <junitreport do a directory contents concatenation
2) added this to ws-axis
3) Did some model cleanup (more raw xml -> cooked object)
Revision Changes Path
1.30 +24 -11 jakarta-gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- engine.py 1 Dec 2003 17:34:07 -0000 1.29
+++ engine.py 2 Dec 2003 17:36:39 -0000 1.30
@@ -98,7 +98,7 @@
#
# Run the build commands
#
- self.build(run)
+ self.buildAll(run)
# Update [or load if not 'all'] Statistics
self.updateStatistics(run)
@@ -202,9 +202,9 @@
work=CommandWorkItem(WORK_TYPE_UPDATE,cmd,cmdResult)
- # Update Contexts
- repository.performedWork(work)
- module.performedWork(work)
+ # Update Contexts
+ module.performedWork(work)
+ repository.performedWork(work.clone())
# Update Context w/ Results
if not cmdResult.state==CMD_STATE_SUCCESS:
@@ -264,19 +264,25 @@
"""
- def build(self,run):
- """ Build a GumpRun """
+ def buildAll(self,run):
+ """ Build a GumpRun's Full Project Stack """
sequence=run.getGumpSet().getSequence()
- return self.buildProjectSequence(run,sequence)
+ return self.buildProjectList(run,sequence)
+
+ def buildProjects(self,run):
+ """ Build a GumpRun's Projects """
+ list=run.getGumpSet().getProjects()
+
+ return self.buildProjectList(run,list)
- def buildProjectSequence(self,run,sequence):
+ def buildProjectList(self,run,list):
workspace=run.getWorkspace()
log.debug('Total Project Sequence (i.e. build order):');
- for p in sequence:
- log.debug(' Sequence : ' + p.name)
+ for p in list:
+ log.debug(' To Build : ' + p.name)
log.debug('--- Building work directories with sources')
@@ -284,7 +290,7 @@
repository=run.getOutputsRepository()
# build all projects this project depends upon, then the project itself
- for project in sequence:
+ for project in list:
if project.isPackaged(): continue
if project.okToPerformWork():
@@ -478,6 +484,13 @@
project.addWarning("No such directory (where output is
expect) : " + dir)
else:
project.changeState(STATE_SUCCESS)
+
+ #
+ # Display report output...
+ #
+ for report in project.getReports():
+ reportDir=report.getResolvedPath()
+ catDirectoryContentsAsWork(project,reportDir)
"""
1.39 +7 -1 jakarta-gump/python/gump/build.py
Index: build.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- build.py 24 Nov 2003 18:32:19 -0000 1.38
+++ build.py 2 Dec 2003 17:36:39 -0000 1.39
@@ -40,6 +40,7 @@
args = handleArgv(sys.argv)
ws=args[0]
ps=args[1]
+ quick=args[2]
# get parsed workspace definition
workspace=WorkspaceLoader().load(ws)
@@ -63,10 +64,15 @@
# The Run Details...
run=GumpRun(workspace,ps,options)
+ engine=GumpEngine()
+
#
# Perform this integration run...
#
- result = GumpEngine().build(run)
+ if not quick:
+ result = engine.buildAll(run)
+ else:
+ result = engine.buildProjects(run)
#
log.info('Gump Build complete. Exit code:' + str(result))
1.22 +10 -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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- forrest.py 2 Dec 2003 00:45:41 -0000 1.21
+++ forrest.py 2 Dec 2003 17:36:39 -0000 1.22
@@ -1459,13 +1459,20 @@
packageMap=xref.getPackageToModuleMap()
for package in packageMap.keys():
- packageTable.createRow().createHeader('Package: ' + package)
-
moduleList=createOrderedList(packageMap.get(package))
+ hasSome=0
for module in moduleList:
if not gumpSet.inModules(module): continue
- self.insertLink( module, xref,packageTable.createRow().createData())
+ hasSome=1
+
+ if hasSome:
+ packageRow=packageTable.createRow()
+ packageRow.createData(package)
+
+ for module in moduleList:
+ if not gumpSet.inModules(module): continue
+ self.insertLink(module, xref, packageRow.createData())
document.serialize()
1.4 +2 -1 jakarta-gump/project/ws-axis.xml
Index: ws-axis.xml
===================================================================
RCS file: /home/cvs/jakarta-gump/project/ws-axis.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ws-axis.xml 31 Oct 2003 12:56:58 -0000 1.3
+++ ws-axis.xml 2 Dec 2003 17:36:40 -0000 1.4
@@ -53,7 +53,8 @@
<license name="LICENSE"/>
<javadoc nested="java/build/javadocs"/>
-
+ <junitreport nested="java/testreports"/>
+
<nag from="Sam Ruby <[EMAIL PROTECTED]>"
to="[EMAIL PROTECTED]">
<regexp subject="Build Failure - Axis"/>
1.2 +2 -2 jakarta-gump/python/exe.py
Index: exe.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/exe.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- exe.py 28 Apr 2003 08:00:05 -0000 1.1
+++ exe.py 2 Dec 2003 17:36:40 -0000 1.2
@@ -6,6 +6,6 @@
# 1 - install py2exe [http://starship.python.net/crew/theller/py2exe/]
# 2 - run: python exedist.py py2exe
-setup(name="build",
- scripts=["build.py"],
+setup(name="integrate",
+ scripts=["integrate.py"],
)
1.2 +45 -9 jakarta-gump/python/gump/utils/work.py
Index: work.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/utils/work.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- work.py 20 Nov 2003 20:51:49 -0000 1.1
+++ work.py 2 Dec 2003 17:36:40 -0000 1.2
@@ -93,14 +93,16 @@
class WorkItem(Ownable):
""" Unit of Work"""
- def __init__(self,type,state,message=''):
+ def __init__(self,name,type,state,message=''):
Ownable.__init__(self)
+ self.name=name
self.type=type
self.state=state
self.message=message
def overview(self):
+ overview='Work Name: ' + self.name +'\n'
overview='Work Type: ' + workTypeName(self.type)+'\n'
overview+='State: ' + stateName(self.state)+'\n'
if self.message:
@@ -110,13 +112,23 @@
def getType(self):
return self.type
- def getName(self):
+ def getTypeName(self):
return workTypeName(self.type)
+
+ def getName(self):
+ return self.name
+
+ def setName(self,name):
+ self.name=name
+
+ def clone(self):
+ return WorkItem(self.name,self.type,self.state,self.message)
+
class TimedWorkItem(WorkItem):
""" Unit of Work w/ times """
- def __init__(self,type,state,secs,message=''):
- WorkItem.__init__(self,type,state,message)
+ def __init__(self,name,type,state,secs,message=''):
+ WorkItem.__init__(self,name,type,state,message)
self.secs=secs
def elapsedTime(self):
@@ -131,11 +143,15 @@
overview+=str(secs) + " seconds\n"
return overview
+ def clone(self):
+ return TimedWorkItem(self.name,self.type,self.state,self.secs,self.message)
+
class CommandWorkItem(TimedWorkItem):
""" Unit of Work"""
def __init__(self,type,command,result=None,message=''):
if not result: result=CmdResult(command)
-
TimedWorkItem.__init__(self,type,commandStateToWorkState(result.state),result.elapsed,message)
+ TimedWorkItem.__init__(self,command.name,type,\
+ commandStateToWorkState(result.state),result.elapsed,message)
self.command=command
self.result=result
@@ -151,18 +167,38 @@
def tail(self,lines=50):
return self.result.tail(lines)
- def getName(self):
- return self.command.name
+ def clone(self):
+ return CommandWorkItem(self,type,self.command,self.result,self.message)
class WorkList(list,Ownable):
+
"""List of work (in order)"""
def __init__(self,owner=None):
Ownable.__init__(self,owner)
- self.index={}
+
+ # Organize by name
+ self.nameIndex={}
def add(self,item):
- self.index[item.type]=item
+
+ if item.hasOwner():
+ raise RuntimeError, 'WorkItem already owned, can\'t add to list'
+
+ # Keep unique within the scope of this list
+ name=item.getName()
+ uniquifier=1
+ while self.nameIndex.has_key(name):
+ name=item.getName()+str(uniquifier)
+ uniquifier+=1
+ item.setName(name)
+
+ # Store by name
+ self.nameIndex[name]=item
+
+ # Store in the list
self.append(item)
+
+ # Let this item know it's owner
item.setOwner(self.getOwner())
def elapsedSecs(self):
1.4 +33 -0 jakarta-gump/python/gump/utils/tools.py
Index: tools.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/utils/tools.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tools.py 20 Nov 2003 20:51:49 -0000 1.3
+++ tools.py 2 Dec 2003 17:36:40 -0000 1.4
@@ -84,7 +84,40 @@
# Update workable
workable.performedWork(CommandWorkItem(WORK_TYPE_DOCUMENT,cmd,result))
+
+ return ok
+
+def catDirectoryContentsAsWork(workable,directory,name=None):
+ try:
+ if os.path.exists(directory) and os.path.isdir(directory):
+ for fileName in os.listdir(directory):
+ file=os.path.abspath(os.path.join(directory,fileName))
+ if os.path.exists(file) and os.path.isfile(file):
+ catFileAsWork(workable, file, name+'_'+fileName)
+ except:
+ try:
+ workable.addWarning('No such directory [' + str(directory) + ']')
+ except:
+ pass
+
+
+def catFileAsWork(workable,file,name=None):
+ ok=0
+ if not name: name='cat_'+os.path.basename(file)
+ cmd=getCmdFromString("cat "+str(file),name)
+ try:
+ result=execute(cmd)
+ ok=result.state==CMD_STATE_SUCCESS
+ if not ok:
+ log.error('Failed to cat [' + str(file) + ']')
+ except Exception, details:
+ ok=0
+ log.error('Failed to cat [' + str(file) + '] : ' + str(details))
+ # Update workable
+ workable.performedWork(CommandWorkItem(WORK_TYPE_DOCUMENT,cmd,result))
+
+ return ok
def syncDirectories(noRSync,type,cwddir,tmpdir,sourcedir,destdir,name=None):
1.21 +31 -3 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- project.py 2 Dec 2003 00:45:41 -0000 1.20
+++ project.py 2 Dec 2003 17:36:40 -0000 1.21
@@ -65,7 +65,8 @@
from time import localtime, strftime, tzname
from gump.model.state import *
-from gump.model.object import ModelObject, NamedModelObject, Jar
+from gump.model.object import ModelObject, NamedModelObject, Jar, \
+ Mkdir, Delete, JunitReport, Work
from gump.model.stats import Statable, Statistics
from gump.model.property import Property
from gump.model.ant import Ant,Maven
@@ -209,6 +210,10 @@
self.maven=None
self.script=None
+ self.works=[]
+ self.mkdirs=[]
+ self.deletes=[]
+ self.reports=[]
#############################################################
# Outputs
@@ -269,6 +274,9 @@
def getJars(self):
return self.jars.values()
+
+ def getReports(self):
+ return self.reports
def getDependencies(self):
return self.depends
@@ -422,6 +430,26 @@
else:
#:TODO: Warn .. no name
pass
+
+ # Grab all the work
+ for w in self.xml.work:
+ work=Work(w,self)
+ self.works.append(work)
+
+ # Grab all the mkdirs
+ for m in self.xml.mkdir:
+ mkdir=Mkdir(m,self)
+ self.mkdirs.append(mkdir)
+
+ # Grab all the deleted
+ for d in self.xml.delete:
+ delete=Delete(d,self)
+ self.deletes.append(delete)
+
+ # Grab all the reports (junit for now)
+ if self.xml.junitreport:
+ report=JunitReport(self.xml.junitreport,self)
+ self.reports.append(report)
# Expand <ant <depends/<properties...
if self.ant: self.ant.expand(self,workspace)
@@ -450,8 +478,8 @@
for xmloption in badOptions:
self.addWarning("Bad *Optional* Dependency. Project: " +
xmloption.project + " unknown to *this* workspace")
else:
- self.addInfo("This is a packaged project, location: " + str(self.home))
-
+ self.addInfo("This is a packaged project, location: " + str(self.home))
+
self.setComplete(1)
def checkPackage(self):
1.10 +29 -5 jakarta-gump/python/gump/model/object.py
Index: object.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/object.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- object.py 26 Nov 2003 20:01:16 -0000 1.9
+++ object.py 2 Dec 2003 17:36:40 -0000 1.10
@@ -290,16 +290,40 @@
def getType(self):
return self.xml.type
-# represents a <junitreport/> element
-class JunitReport(ModelObject): pass
+class Resolvable(ModelObject):
+ def __init__(self,xml,owner):
+ ModelObject.__init__(self,xml,owner)
+
+ def getResolvedPath(self,path):
+ path=None
+ if self.xml.nested:
+ path=os.path.abspath( \
+ os.path.join( self.owner.getModule().getSourceDirectory(),
\
+ work.nested))
+ elif self.xml.parent:
+ path=os.path.abspath( \
+ os.path.join(self.owner.getWorkspace().getBaseDirectory(),
\
+ self.xml.parent))
+
+# represents a <junitreport/> element
+class JunitReport(Resolvable):
+ def __init__(self,xml,owner):
+ Resolvable.__init__(self,xml,owner)
+
# represents a <mkdir/> element
-class Mkdir(ModelObject): pass
+class Mkdir(Resolvable):
+ def __init__(self,xml,owner):
+ Resolvable.__init__(self,xml,owner)
# represents a <delete/> element
-class Delete(ModelObject): pass
+class Delete(Resolvable):
+ def __init__(self,xml,owner):
+ Resolvable.__init__(self,xml,owner)
# represents a <work/> element
-class Work(ModelObject): pass
+class Work(Resolvable):
+ def __init__(self,xml,owner):
+ Resolvable.__init__(self,xml,owner)
1.12 +3 -0 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pyunit.py 2 Dec 2003 00:45:40 -0000 1.11
+++ pyunit.py 2 Dec 2003 17:36:40 -0000 1.12
@@ -329,6 +329,9 @@
from gump.test.xref import XRefTestSuite
runner.addSuite(XRefTestSuite())
+ from gump.test.tools import ToolsTestSuite
+ runner.addSuite(ToolsTestSuite())
+
#from gump.test.integrator import IntegratorTestSuite
#runner.addSuite(IntegratorTestSuite())
1.1 jakarta-gump/python/gump/test/tools.py
Index: tools.py
===================================================================
#!/usr/bin/env python
# $Header: 1.7 2003/05/10 18:20:36 nicolaken Exp $
# $Revision: 1.7 $
# $Date: 2003/05/10 18:20:36 $
#
# ====================================================================
#
# The Apache Software License, Version 1.1
#
# Copyright (c) 2003 The Apache Software Foundation. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement:
# "This product includes software developed by the
# Apache Software Foundation (http://www.apache.org/)."
# Alternately, this acknowlegement may appear in the software itself,
# if and wherever such third-party acknowlegements normally appear.
#
# 4. The names "The Jakarta Project", "Alexandria", and "Apache Software
# Foundation" must not be used to endorse or promote products derived
# from this software without prior written permission. For written
# permission, please contact [EMAIL PROTECTED]
#
# 5. Products derived from this software may not be called "Apache"
# nor may "Apache" appear in their names without prior written
# permission of the Apache Group.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation. For more
# information on the Apache Software Foundation, please see
# <http://www.apache.org/>.
"""
Utils Testing
"""
from gump.utils.tools import *
from gump.test.pyunit import UnitTestSuite
class TestWork(Workable):
def __init__(self):
# Holds work (with state)
Workable.__init__(self)
class ToolsTestSuite(UnitTestSuite):
def __init__(self):
UnitTestSuite.__init__(self)
def suiteSetUp(self):
self.testwork=TestWork()
def testListAsWork(self):
listDirectoryAsWork(self.testwork,'.','test')
def testCatFileAsWork(self):
catFileAsWork(self.testwork,'./text.xml','test')
def testCatDirAsWork(self):
catDirectoryContentsAsWork(self.testwork,'.','test')
1.4 +3 -1 jakarta-gump/python/gump/test/resources/full1/module3.xml
Index: module3.xml
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/test/resources/full1/module3.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- module3.xml 25 Nov 2003 04:58:04 -0000 1.3
+++ module3.xml 2 Dec 2003 17:36:40 -0000 1.4
@@ -18,7 +18,9 @@
<option project="random"/>
<home nested="dist"/>
-
+
+ <junitreport nested="docs/junitreports3"/>
+
<jar name="lib/output3.jar" id="output3"/>
<license name="LICENSE"/>
1.8 +2 -2 jakarta-gump/python/gump/output/rss.py
Index: rss.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/output/rss.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- rss.py 1 Dec 2003 17:34:08 -0000 1.7
+++ rss.py 2 Dec 2003 17:36:40 -0000 1.8
@@ -261,7 +261,7 @@
def syndicateModule(self,module,mainRSS):
rssFile=self.run.getOptions().getResolver().getFile(module,'index','.rss')
- moduleURL=self.run.getOptions().getResolver().getFile(module)
+ moduleURL=self.run.getOptions().getResolver().getUrl(module)
moduleRSS=RSS(rssFile, \
Channel(moduleURL,\
@@ -276,7 +276,7 @@
def syndicateProject(self,project,moduleRSS,mainRSS):
rssFile=self.run.getOptions().getResolver().getFile(project,project.getName(),'.rss')
- projectURL=self.run.getOptions().getResolver().getFile(project)
+ projectURL=self.run.getOptions().getResolver().getUrl(project)
projectRSS=RSS(rssFile, \
Channel(projectURL,\
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]