ajack 2003/11/20 16:27:58
Modified: python/gump/model module.py workspace.py project.py
python/gump engine.py
template/forrest/src/documentation/content/xdocs site.xml
Log:
Still trying to resolve the package bootstrap (i.e. not do the normal
active stuff to packages, but know what is a package at an early
enough time -- yet still be able to propagate state changes to all
possible dependees).
Revision Changes Path
1.8 +107 -26 jakarta-gump/python/gump/model/module.py
Index: module.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/module.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- module.py 20 Nov 2003 20:51:48 -0000 1.7
+++ module.py 21 Nov 2003 00:27:58 -0000 1.8
@@ -81,6 +81,7 @@
self.module = xml.module
self.hostPrefix = xml['host-prefix']
self.dir = xml.dir
+
def getCVSRoot(self):
# Form the CVS root
@@ -125,8 +126,7 @@
def getModule(self):
return self.module
-
-
+
def createUnnamedModule(workspace):
#
# Create an Unnamed Module (for projects not in modules)
@@ -150,45 +150,120 @@
self.repository=None
- self.updated=0
+ self.packaged = 0
+ self.packageComplete= 0
+ self.updated = 0
# provide default elements when not defined in xml
def complete(self,workspace):
if self.isComplete(): return
+
- # We have a CVS entry, expand it...
- if self.xml.cvs:
- repoName=self.xml.cvs.repository
- if workspace.hasRepository(repoName):
- # It references this repository...
- repo=workspace.getRepository(repoName)
- self.repository=repo
- repo.addModule(self)
- self.cvs=ModuleCVS(self.xml.cvs,repo)
- else:
- self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
- log.error(':TODO: No such repository in w/s ['+ repoName +'] on [' \
- + self.getName() + ']')
-
-
- # Determine source directory
- self.srcdir=self.xml.srcdir or self.xml.name
- self.absSrcDir=os.path.join(workspace.getBaseDirectory(),self.srcdir)
-
- # Claim ownership
+ packaged=0
+
+ # Claim ownership & check for packages
+ # ###################################################
+ # A module which contains only packaged projects might as
+ # well be considered packages, no need to update from CVS
+ # since we won't be building.
+ packageCount=0
+ allPackaged=1
+
for xmlproject in self.xml.project:
if workspace.hasProject(xmlproject.name):
+
+ #
+ # The project pretty much better be in the
+ # workspace, but avoid crashing...
+ #
project=workspace.getProject(xmlproject.name)
+
+ #
+ # Claim ownership
+ #
self.addProject(project)
+
+ #
+ # Check for packaged
+ #
+ if not project.isPackaged():
+ allPackaged=0
+ else:
+ self.addInfo('Packaged Project: ' + project.getName())
+ packageCount+=1
else:
log.error(':TODO: No such project in w/s ['+ `xmlproject.name` +']
on [' \
- + self.getName() + ']')
+ + self.getName() + ']')
+
+ # Must be one to be all
+ if not packageCount: allPackaged=0
+
+ #
+ # Give this module a second try, if some are packaged, and
+ # check if the others have no outputs, then call them good.
+ #
+ if packageCount and not allPackaged:
+ allPackaged=1
+ for project in self.getProjects():
+ if not project.isPackaged():
+ if not project.hasOutputs():
+ #
+ # Honorary package (allow folks to only mark the main
+ # project in a module as a package, and those that do
+ # not product significant outputs (e.g. test projects)
+ # will be asssumed to be packages.
+ #
+ project.changeState(STATE_COMPLETE,REASON_PACKAGE)
+ packageCount+=1
+ else:
+ allPackaged=0
+ if packageCount:
+ self.addWarning('Incomplete \'Packaged\' Module.
Project: ' + \
+ project.getName() + ' is not packaged')
+
+ # If packages module, accept it...
+ if allPackaged:
+ packaged=1
+ self.setPackaged(1)
+ self.changeState(STATE_COMPLETE,REASON_PACKAGE)
+ self.addInfo("\'Packaged\' Module. (Packaged projects: " + \
+ str(packageCount) + '.)')
+
+
+ # Determine source directory
+ self.srcdir=self.xml.srcdir or self.xml.name
+ self.absSrcDir=os.path.join(workspace.getBaseDirectory(),self.srcdir)
+
+ if not packaged:
+ # We have a CVS entry, expand it...
+ if self.xml.cvs:
+ repoName=self.xml.cvs.repository
+ if workspace.hasRepository(repoName):
+ # It references this repository...
+ repo=workspace.getRepository(repoName)
+ self.repository=repo
+ repo.addModule(self)
+ self.cvs=ModuleCVS(self.xml.cvs,repo)
+ else:
+ self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+ log.error(':TODO: No such repository in w/s ['+ repoName +'] on
[' \
+ + self.getName() + ']')
+
+
self.setComplete(1)
-
+ def completePackagedModule(self):
+ # If so far so good, check packages
+ if not self.isPackaged(): return
+ if self.packageComplete: return
+
+ self.addInfo("This is a packaged module")
+
+ self.packageComplete=1
+
def addProject(self,project):
project.setModule(self)
self.projects[project.getName()]=project
@@ -200,7 +275,13 @@
return self.projects.values()
def getChildren(self):
- return self.getProjects()
+ return self.getProjects()
+
+ def isPackaged(self):
+ return self.packaged
+
+ def setPackaged(self,packaged):
+ self.packaged=packaged
#
# Get a full list of all the projects that depend
1.6 +8 -4 jakarta-gump/python/gump/model/workspace.py
Index: workspace.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/workspace.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- workspace.py 20 Nov 2003 20:51:48 -0000 1.5
+++ workspace.py 21 Nov 2003 00:27:58 -0000 1.6
@@ -235,8 +235,7 @@
if not self.xml.signature:
self.signature = default.signature
else:
- self.signature=self.xml.signature
-
+ self.signature=self.xml.signature
#
# Import all repositories
@@ -272,7 +271,7 @@
# Duplicate, uh oh...
self.addError("Duplicate Project name [" + projectName + "]")
else:
- self.projects[projectName] = project
+ self.projects[projectName] = project
# Complete the modules
for module in self.getModules():
@@ -300,12 +299,17 @@
unnamedModule.addProject(project)
# Complete the project
- project.complete(self)
+ project.complete(self)
+
+ for project in self.getProjects():
+ if not project.isPackaged(): continue
+ project.checkPackage()
# Complete the properies
self.completeProperties()
self.setComplete(1)
+
def addModule(self,module):
self.modules[module.getName()]=module
1.12 +36 -6 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- project.py 20 Nov 2003 21:30:06 -0000 1.11
+++ project.py 21 Nov 2003 00:27:58 -0000 1.12
@@ -202,7 +202,7 @@
#############################################################
# Outputs
#
- self.jars={}
+ self.jars={}
def getAnt(self):
return self.ant
@@ -310,15 +310,14 @@
else:
dependee.addError("Dependency " + self.name + " " + message)
dependeeProject.changeState(STATE_PREREQ_FAILED,reason,cause)
-
#
# We have a potential clash between the <project package attribute and
# the <project <package element. The former indicates a packages install
# the latter the (Java) package name for the project contents. As such
# we test the attribute for type.
- #
+ #
def isPackaged(self):
- return type(self.xml.package) in types.StringTypes
+ return (type(self.xml.package) in types.StringTypes)
# provide elements when not defined in xml
def complete(self,workspace):
@@ -327,7 +326,8 @@
if not self.inModule():
self.addWarning("Not in a module")
return
-
+
+ #
# Packaged Projects don't need the full treatment..
#
packaged=self.isPackaged()
@@ -402,10 +402,40 @@
for xmloption in badOptions:
self.addWarning("Bad *Optional* Dependency. Project: " +
xmloption.project + " unknown to *this* workspace")
- #log.warn("Unknown *Optional* Dependency [" + xmloption.project
+ "] on [" + self.getName() + "]")
+ #log.warn("Unknown *Optional* Dependency [" + xmloption.project
+ "] on [" + self.getName() + "]")
+ else:
+ self.addInfo("This is a packaged project, location: " + str(self.home))
self.setComplete(1)
+ def checkPackage(self):
+ if self.okToPerformWork():
+ #
+ # Check the package was installed correctly...
+ #
+ outputsOk=1
+ for jar in self.getJars():
+ jarpath=jar.getPath()
+ if jarpath:
+ if not os.path.exists(jarpath):
+ self.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
+ outputsOk=0
+ self.addError("Missing Packaged Jar: " + str(jarpath))
+
+ if outputsOk:
+ self.changeState(STATE_COMPLETE,REASON_PACKAGE)
+ else:
+ # Just in case it was so bad it thougt it had no
+ # jars to check
+ self.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
+
+ #
+ # List them, why not...
+ #
+ from gump.utils.tools import listDirectoryAsWork
+ listDirectoryAsWork(self,self.getHomeDirectory(), \
+ 'list_package_'+self.getName())
+
def buildDependenciesMap(self,workspace):
badDepends=[]
# Walk the XML parts converting
1.10 +1 -90 jakarta-gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- engine.py 20 Nov 2003 21:47:55 -0000 1.9
+++ engine.py 21 Nov 2003 00:27:58 -0000 1.10
@@ -82,96 +82,7 @@
message='Workspace version ['+workspace.getVersion()+'] below expected
[' + setting.ws_version + ']'
workspace.addWarning(message)
log.warn(message)
-
- #
- # Check each project...
- #
- for project in workspace.getProjects():
-
- projectOk=1
-
- # If so far so good, check packages
- if project.isPackaged():
-
- project.addInfo("This is a packaged project, location: " +
str(project.home))
-
- #
- # Check the package was installed correctly...
- #
- outputsOk=1
- for jar in project.getJars():
- jarpath=jar.getPath()
- if jarpath:
- if not os.path.exists(jarpath):
- project.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
- outputsOk=0
- projectOk=0
- project.addError("Missing Packaged Jar: " +
str(jarpath))
- log.error("Missing Jar [" + str(jarpath) + "] on
*packaged* [" + project.getName() + "]")
-
- if outputsOk:
- project.changeState(STATE_COMPLETE,REASON_PACKAGE)
- else:
- # Just in case it was so bad it thougt it had no
- # jars to check
- project.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
-
- #
- # List them, why not...
- #
- listDirectoryAsWork(project,project.getHomeDirectory(), \
- 'list_package_'+project.getName())
-
- #
- # Check each module...
- #
- for module in workspace.getModules():
- moduleOk=1
-
- # A module which contains only packaged projects might as
- # well be considered complete, no need to update from CVS
- # since we won't be building.
- # :TODO: Ought we hack this as *any* not all???
- packageCount=0
- allPackaged=1
- for project in module.getProjects():
- if not project.isPackaged():
- allPackaged=0
- else:
- module.addInfo('Packaged Project: ' + project.getName())
- packageCount+=1
-
- # Must be one to be all
- if not packageCount: allPackaged=0
-
- # Give this module a second try, and if some are packaged
- # check if the others have no outputs, then call them good.
- if packageCount and not allPackaged:
- allPackaged=1
- for project in module.getProjects():
- if not project.isPackaged():
- if not project.hasOutputs():
- #
- # Honorary package (allow folks to only mark the main
- # project in a module as a package, and those that do
- # not product significant outputs (e.g. test projects)
- # will be asssumed to be packages.
- #
- project.changeState(STATE_COMPLETE,REASON_PACKAGE)
- packageCount+=1
- else:
- allPackaged=0
- if packageCount:
- module.addWarning('Incomplete \'Packaged\' Module.
Project: ' + \
- project.getName() + ' is not packaged')
-
- # If packages module, accept it...
- if allPackaged:
- module.changeState(STATE_COMPLETE,REASON_PACKAGE)
- module.addInfo("\'Packaged\' Module. (Packaged projects: " + \
- str(packageCount) + '.)')
-
-
+
def integrate(self,run):
workspace=run.getWorkspace()
1.9 +1 -1
jakarta-gump/template/forrest/src/documentation/content/xdocs/site.xml
Index: site.xml
===================================================================
RCS file:
/home/cvs/jakarta-gump/template/forrest/src/documentation/content/xdocs/site.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- site.xml 17 Nov 2003 22:10:56 -0000 1.8
+++ site.xml 21 Nov 2003 00:27:58 -0000 1.9
@@ -15,7 +15,7 @@
<index label="Project TODOs" href="project_todos.html"/>
<index label="Repositories" href="repositories.html"/>
<index label="Packages" href="packages.html"/>
- <index label="Context" href="context.html"/>
+ <index label="XML" href="workspace.html"/>
</work>
<stats label="Statistics">
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]