ajack 2004/05/05 10:41:33
Modified: python/gump/model project.py
python/gump/utils __init__.py sync.py
python/gump/document resolver.py
python/gump/core engine.py
python/gump/document/forrest documenter.py
Log:
Add to captured output for Maven builds.
Revision Changes Path
1.81 +15 -11 gump/python/gump/model/project.py
Index: project.py
===================================================================
RCS file: /home/cvs/gump/python/gump/model/project.py,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- project.py 30 Apr 2004 18:55:07 -0000 1.80
+++ project.py 5 May 2004 17:41:33 -0000 1.81
@@ -979,23 +979,27 @@
# :TODO: write...
for annotatedPath in classpath.getPathParts():
if isinstance(annotatedPath,AnnotatedPath):
- id=annotatedPath.getId()
- path=annotatedPath.getPath()
- props.write(('maven.jar.%s=%s\n') % (id,path))
+ props.write(('# Contributor: %s\nmaven.jar.%s=%s\n') % \
+ ( annotatedPath.getContributor(), \
+ annotatedPath.getId(), \
+ annotatedPath.getPath()))
return propertiesFile
def locateMavenLog(self):
- """Return Maven log location"""
-
- #
- # Where to put this:
- #
+ """Return Maven log location"""
+ basedir = self.maven.getBaseDirectory() or self.getBaseDirectory()
+ return os.path.abspath(os.path.join(basedir,'maven.log'))
+
+ def locateMavenProjectPropertiesFile(self):
+ """Return Maven project properties file location"""
basedir = self.maven.getBaseDirectory() or self.getBaseDirectory()
- logFile=os.path.abspath(os.path.join(\
- basedir,'maven.log'))
+ return os.path.abspath(os.path.join(basedir,'project.properties'))
- return logFile
+ def locateMavenProjectFile(self):
+ """Return Maven project file location"""
+ basedir = self.maven.getBaseDirectory() or self.getBaseDirectory()
+ return os.path.abspath(os.path.join(basedir,'project.xml'))
def dump(self, indent=0, output=sys.stdout):
""" Display the contents of this object """
1.39 +16 -2 gump/python/gump/utils/__init__.py
Index: __init__.py
===================================================================
RCS file: /home/cvs/gump/python/gump/utils/__init__.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- __init__.py 5 May 2004 15:08:52 -0000 1.38
+++ __init__.py 5 May 2004 17:41:33 -0000 1.39
@@ -397,13 +397,27 @@
# if not os.name == 'dos' and not os.name == 'nt':
# log.error("Failed get resource utilization." \
#
-def invokeGarbageCollection():
+def inspectGarbageCollection():
+ tracked = 0
try:
import gc
tracked = len(gc.get_objects())
log.debug('Objects Tracked by GC : ' + `tracked`)
+ except:
+ pass
+ return tracked
+
+def invokeGarbageCollection():
+ try:
+ # See what GC thinks
+ inspectGarbageCollection()
+
+ # Perform GC
+ import gc
unreachable = gc.collect()
+
+ # Curiousity..
if unreachable:
log.debug('Objects Unreachable by GC : ' + `unreachable`)
except:
- raise
\ No newline at end of file
+ pass
\ No newline at end of file
1.12 +13 -7 gump/python/gump/utils/sync.py
Index: sync.py
===================================================================
RCS file: /home/cvs/gump/python/gump/utils/sync.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sync.py 5 May 2004 15:56:24 -0000 1.11
+++ sync.py 5 May 2004 17:41:33 -0000 1.12
@@ -44,11 +44,12 @@
the class can be also used to copy from one directory to another
x = Sync(sourcedir, targetdir, )
"""
- def __init__(self, sourcedir, targetdir, action = SYNC_ACTION):
+ def __init__(self, sourcedir, targetdir, action = SYNC_ACTION, debug=0):
Annotatable.__init__(self)
self.sourcedir = sourcedir
self.targetdir = targetdir
self.action = action
+ self.debug=debug
def execute(self):
log.debug('Starting %s from [%s]' % (self.action,self.sourcedir))
@@ -74,7 +75,10 @@
def isCopy(self): return (COPY_ACTION == self.action)
def isSync(self): return (SYNC_ACTION == self.action)
def isDiff(self): return (DIFF_ACTION == self.action)
-
+
+ def setDebug(self, debug): self.sebug = debug
+ def isDebug(self): return self.debug
+
def copytree(self, src, dst, symlinks=0):
# Only supported on some platforms.
@@ -153,10 +157,10 @@
tobedeleted = os.path.join(destdir, afile)
destinationStat = os.stat(tobedeleted)
if S_ISDIR(destinationStat[ST_MODE]):
- log.debug('attempting to remove directory [%s]' %
(`tobedeleted`))
+ if self.isDebug(): log.debug('Attempting to remove directory
[%s]' % (`tobedeleted`))
shutil.rmtree(tobedeleted)
else:
- log.debug('attempting to remove file [%s]' % (`tobedeleted`))
+ if self.isDebug(): log.debug('Attempting to remove file [%s]' %
(`tobedeleted`))
os.remove(tobedeleted)
def removenonmatching(self, sourcedir, destdir, acceptablefiles, existingfiles):
@@ -179,12 +183,14 @@
fulldestfile = os.path.join(destdir, afile)
if os.path.isdir(fullsourcefile) and not
os.path.isdir(fulldestfile):
- log.debug('removing file [%s] to be replaced by directory'
+ if self.isDebug():
+ log.debug('Removing file [%s] to be replaced by directory'
%(`fulldestfile`))
os.remove(fulldestfile)
removed.append(afile)
elif os.path.isfile(fullsourcefile) and
os.path.isdir(fulldestfile):
- log.debug('removing directory [%s] to be replaced by file'
+ if self.isDebug():
+ log.debug('Removing directory [%s] to be replaced by file'
%(`fulldestfile`))
shutil.rmtree(fulldestfile)
removed.append(afile)
@@ -219,7 +225,7 @@
performCopy = 1
if performCopy:
- log.debug("Attempting copy from [%s] to [%s]" %(`srcname`, `dstname`))
+ if self.isDebug(): log.debug("Attempting copy from [%s] to [%s]"
%(`srcname`, `dstname`))
shutil.copy2(srcname, dstname)
#else:
# log.debug("Do not copy from [%s:%s] to [%s:%s]" \
1.27 +2 -2 gump/python/gump/document/resolver.py
Index: resolver.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/resolver.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- resolver.py 5 May 2004 15:08:52 -0000 1.26
+++ resolver.py 5 May 2004 17:41:33 -0000 1.27
@@ -190,12 +190,12 @@
def makePath(self,path,root=None):
if not root: root=self.rootDir
if not os.path.exists(root):
- log.debug('Make directory : [' + root + ']')
+ #log.debug('Make directory : [' + root + ']')
os.makedirs(root)
for p in path:
root=os.path.join(root,p)
if not os.path.exists(root):
- log.debug('Make directory : [' + root + ']')
+ #log.debug('Make directory : [' + root + ']')
os.mkdir(root)
def getRootUrl(self):
1.10 +26 -14 gump/python/gump/core/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/gump/python/gump/core/engine.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- engine.py 3 May 2004 17:18:06 -0000 1.9
+++ engine.py 5 May 2004 17:41:33 -0000 1.10
@@ -27,7 +27,8 @@
from gump.core.gumprun import *
from gump.core.config import dir, default, basicConfig
-from gump.utils import dump, display, getIndent, logResourceUtilization
+from gump.utils import dump, display, getIndent, logResourceUtilization, \
+ invokeGarbageCollection
from gump.utils.note import Annotatable
from gump.utils.work import *
@@ -107,6 +108,10 @@
log.info('Perform task [' + task.getName() + ']')
task.invoke(run)
+
+ # Seems a nice place to clean up...
+ invokeGarbageCollection()
+
###########################################
def preprocess(self,run,exitOnError=1):
@@ -550,7 +555,7 @@
try:
catFileToFileHolder(project,propertiesFile, \
FILE_TYPE_CONFIG, \
- project.getName() + ' ' + os.path.basename(propertiesFile))
+ os.path.basename(propertiesFile))
except:
log.error('Display Properties [ ' + propertiesFile + ']
Failed', exc_info=1)
@@ -674,20 +679,27 @@
catDirectoryContentsToFileHolder(project,reportDir,FILE_TYPE_OUTPUT)
# Maven generates a maven.log...
- if project.hasMaven() and wasBuilt and not project.isPackaged():
- try:
- logFile=project.locateMavenLog()
+ if project.hasMaven() and not project.isPackaged():
+ pomFile=project.locateMavenProjectFile()
+ if os.path.exists(pomFile):
+ project.addDebug('Maven POM in: ' + pomFile)
+ catFileToFileHolder(project,pomFile, \
+ FILE_TYPE_CONFIG, \
+ os.path.basename(pomFile))
+
+ projpFile=project.locateMavenProjectPropertiesFile()
+ if os.path.exists(projpFile):
+ project.addDebug('Maven project properties in: ' + projpFile)
+ catFileToFileHolder(project,pomFile, \
+ FILE_TYPE_CONFIG, \
+ os.path.basename(projpFile))
+
+ logFile=project.locateMavenLog()
+ if os.path.exists(logFile):
project.addDebug('Maven Log in: ' + logFile)
- try:
- catFileToFileHolder(project,logFile, \
+ catFileToFileHolder(project,logFile, \
FILE_TYPE_LOG, \
- project.getName() + ' ' + os.path.basename(logFile))
- except:
- log.error('Display Log [ ' + logFile + '] Failed', exc_info=1)
-
- except:
- log.warning('Display Maven Log Failed', exc_info=1)
- # Not worth crapping out over...
+ os.path.basename(logFile))
def performProjectPackageProcessing(self, run, project, stats):
1.27 +35 -24 gump/python/gump/document/forrest/documenter.py
Index: documenter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/forrest/documenter.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- documenter.py 4 May 2004 21:06:48 -0000 1.26
+++ documenter.py 5 May 2004 17:41:33 -0000 1.27
@@ -397,7 +397,11 @@
for name in ['java.vendor', 'java.version', 'os.name', 'os.arch',
'os.version']:
if name in javaproperties:
definitionTable.createEntry(name, javaproperties[name])
-
+
+ tracked=inspectGarbageCollection()
+ if tracked:
+ definitionTable.createEntry('Garbage Collector Tracked', tracked)
+
rssSyndRow=definitionTable.createRow()
rssSyndRow.createData('Syndication')
rssSyndRow.createData().createFork('rss.xml','RSS')
@@ -1620,36 +1624,36 @@
# % (getModuleProjectRelativeUrl(modulename,project.name)) )
- if project.isDebug():
- miscSection=document.createSection('Miscellaneous')
+ miscSection=document.createSection('Miscellaneous')
- #
- # Outputs (e.g. Jars)
- #
- if project.hasJars():
- outputSection = miscSection.createSection('Outputs')
- outputTable = outputSection.createTable(['Name','Id'])
+ #
+ # Outputs (e.g. Jars)
+ #
+ if project.hasJars():
+ outputSection = miscSection.createSection('Outputs')
+ outputTable = outputSection.createTable(['Name','Id'])
- for jar in project.getJars():
- outputRow=outputTable.createRow()
+ for jar in project.getJars():
+ outputRow=outputTable.createRow()
- # The name (path) of the jar
- outputRow.createData(jar.getName())
+ # The name (path) of the jar
+ outputRow.createData(jar.getName())
- # The jar id
- id=jar.getId() or 'N/A'
- outputRow.createData(id)
+ # The jar id
+ id=jar.getId() or 'N/A'
+ outputRow.createData(id)
- if project.hasBuildCommand():
+ if project.hasBuildCommand():
- if project.hasAnt():
- self.documentProperties(miscSection, project.getAnt(), 'Ant
Properties')
+ if project.hasAnt():
+ self.documentProperties(miscSection, project.getAnt(), 'Ant
Properties')
- (classpath,bootclasspath)=project.getClasspathObjects()
- self.displayClasspath(miscSection, classpath,'Classpath',project)
- self.displayClasspath(miscSection, bootclasspath,'Boot
Classpath',project)
+ (classpath,bootclasspath)=project.getClasspathObjects()
+ self.displayClasspath(miscSection, classpath,'Classpath',project)
+ self.displayClasspath(miscSection, bootclasspath,'Boot
Classpath',project)
+ if project.isDebug():
self.documentXML(miscSection,project)
dependencySection=document.createSection('Dependency')
@@ -1743,18 +1747,20 @@
if not classpath.getPathParts(): return
pathSection=document.createSection(title)
- pathTable=pathSection.createTable(['Path
Entry','Contributor','Instigator','Annotation'])
+ pathTable=pathSection.createTable(['Path
Entry','Contributor','Instigator','Id','Annotation'])
paths=0
for path in classpath.getPathParts():
if isinstance(path,AnnotatedPath):
pathStr=path.getPath()
contributor=path.getContributor()
instigator=path.getInstigator()
+ id=path.getId()
note=path.note
else:
pathStr=path
contributor=referencingObject.getWorkspace()
instigator=None
+ id=None
note=''
pathRow=pathTable.createRow()
@@ -1772,6 +1778,9 @@
else:
pathRow.createData('')
+ # The identifier....
+ pathRow.createData(id)
+
# Additional Notes...
pathRow.createData(note)
@@ -2446,7 +2455,8 @@
# Statistics Pages
#
def documentStatistics(self,run,workspace,gumpSet):
-
+
+ log.info('Generate Statistic Guru')
stats=StatisticsGuru(workspace)
document=XDocDocument('Statistics',self.resolver.getFile(stats))
@@ -2817,6 +2827,7 @@
#
def documentXRef(self,run,workspace,gumpSet):
+ log.info('Generate XRef Guru')
xref=XRefGuru(workspace)
document=XDocDocument('Cross Reference',self.resolver.getFile(xref))
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]