You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by aj...@apache.org on 2005/06/04 15:20:42 UTC

svn commit: r179986 - in /gump/trunk/python/gump: actor/document/xdocs/ actor/notify/ actor/syndication/ core/build/ core/model/ core/run/ core/runner/ test/resources/full1/

Author: ajack
Date: Sat Jun  4 06:20:42 2005
New Revision: 179986

URL: http://svn.apache.org/viewcvs?rev=179986&view=rev
Log:
Attempt to cope w/ circular dependencies and 
missing modules a little better.  Added a
test for these, and (too many) checks.

Added:
    gump/trunk/python/gump/test/resources/full1/module6.xml
    gump/trunk/python/gump/test/resources/full1/module7.xml
Modified:
    gump/trunk/python/gump/actor/document/xdocs/documenter.py
    gump/trunk/python/gump/actor/notify/notifier.py
    gump/trunk/python/gump/actor/syndication/syndicator.py
    gump/trunk/python/gump/core/build/builder.py
    gump/trunk/python/gump/core/model/depend.py
    gump/trunk/python/gump/core/model/project.py
    gump/trunk/python/gump/core/model/workspace.py
    gump/trunk/python/gump/core/run/actor.py
    gump/trunk/python/gump/core/runner/demand.py
    gump/trunk/python/gump/core/runner/runner.py
    gump/trunk/python/gump/test/resources/full1/profile.xml

Modified: gump/trunk/python/gump/actor/document/xdocs/documenter.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/actor/document/xdocs/documenter.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/document/xdocs/documenter.py (original)
+++ gump/trunk/python/gump/actor/document/xdocs/documenter.py Sat Jun  4 06:20:42 2005
@@ -81,6 +81,7 @@
         self.syncObject(module)
          
     def processProject(self,project):
+        
         verbose=self.run.getOptions().isVerbose()
         debug=self.run.getOptions().isDebug()
         self.documentProject(project,True)
@@ -808,6 +809,9 @@
         projectsTable=projectsSection.createTable(['Index','Time','Name','State','Duration\nin state','Last Modified','Notes'])
         pcount=0
         for project in self.gumpSet.getCompletedProjects():
+                        
+            # Hack for bad data.
+            if not project.inModule(): continue
                        
             #if realTime and \
             #    (project.getState()==STATE_FAILED or \
@@ -983,6 +987,9 @@
         depOrder=createOrderedList(sortedProjectList,compareProjectsByFullDependeeCount)
   
         for project in depOrder:
+            # Hack for bad data
+            if not project.inModule(): continue
+                
             if not self.gumpSet.inProjectSequence(project): continue       
             
             if not project.getState()==STATE_FAILED:
@@ -1042,6 +1049,9 @@
                     'Dependees','Project State','Duration\nin state'])
         pcount=0
         for project in sortedProjectList:
+            # Hack for bad data
+            if not project.inModule(): continue    
+            # Filter
             if not self.gumpSet.inProjectSequence(project): continue       
             
             if not project.getState()==STATE_SUCCESS or \
@@ -1088,6 +1098,9 @@
                     'Depends','Not-Built Depends','Project State','Duration\nin state'])
         pcount=0
         for project in sortedProjectList:
+            # Hack for bad data
+            if not project.inModule(): continue    
+            # Filter    
             if not self.gumpSet.inProjectSequence(project): continue       
             
             if not project.getState()==STATE_PREREQ_FAILED:
@@ -1678,6 +1691,10 @@
     #    endXDoc(x)
         
     def documentProject(self,project,realTime=False): 
+    
+        # Hack for bad data. Gump3 won't let it get this
+        # far.
+        if not project.inModule(): return
         
         spec=self.resolver.getFileSpec(project)
         document=XDocDocument('Project : ' + project.getName(),    

Modified: gump/trunk/python/gump/actor/notify/notifier.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/actor/notify/notifier.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/notify/notifier.py (original)
+++ gump/trunk/python/gump/actor/notify/notifier.py Sat Jun  4 06:20:42 2005
@@ -97,7 +97,8 @@
         if self._hasUnwanted():
             log.info('We have some unwanted\'s to send to list...')
             
-            self.sendEmail(wsTo or self.workspace.administrator,wsFrom or self.workspace.email,
+            self.sendEmail( wsTo or self.workspace.administrator,
+                            wsFrom or self.workspace.email,
                         'BATCH: All dressed up, with nowhere to go...',
                         self._getUnwantedContent())
                         
@@ -112,7 +113,8 @@
         # Belt and braces (notify to us if not notify to them)
         if self._hasUnsent():
             log.info('We have some unsented\'s to send to list...')    
-            self.sendEmail(wsTo or self.workspace.administrator,wsFrom or self.workspace.email,
+            self.sendEmail(wsTo or self.workspace.administrator,
+                        wsFrom or self.workspace.email,
                         'BATCH: Unable to send...',
                          self._getUnsentContent())
                         

Modified: gump/trunk/python/gump/actor/syndication/syndicator.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/actor/syndication/syndicator.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/syndication/syndicator.py (original)
+++ gump/trunk/python/gump/actor/syndication/syndicator.py Sat Jun  4 06:20:42 2005
@@ -63,7 +63,7 @@
     def processProject(self,project):    
         """
         Syndicate information about the project (if it needs it)
-        """
+        """                
         self.rss.syndicateProject(project)
         self.atom.syndicateProject(project)
            

Modified: gump/trunk/python/gump/core/build/builder.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/build/builder.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/build/builder.py (original)
+++ gump/trunk/python/gump/core/build/builder.py Sat Jun  4 06:20:42 2005
@@ -321,7 +321,7 @@
                         project.addError("See Directory Listing Work for Missing Outputs")
             else:
                 project.changeState(STATE_SUCCESS)
-        else:
+        elif project.inModule():
             # List source directory (when failed) in case it helps debugging...
             listDirectoryToFileHolder(project,project.getModule().getWorkingDirectory(), 
                                         FILE_TYPE_SOURCE, 'list_source_'+project.getName())           

Modified: gump/trunk/python/gump/core/model/depend.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/depend.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/depend.py (original)
+++ gump/trunk/python/gump/core/model/depend.py Sat Jun  4 06:20:42 2005
@@ -93,6 +93,7 @@
         self.optional=optional
         self.ids=ids
         self.noclasspath=noclasspath
+        self.valid=True
         if annotation:	self.addInfo(annotation)
         
     def __del__(self):
@@ -222,6 +223,12 @@
         # Which direction (to or from?)
         self.dependees=dependees
         
+    def removeDepend(self, depend):
+        # :TODO: Ought remove more (or never delete,
+        # but never let 'bad' (i.e. circular) get in
+        # here in the first place.
+        self.depends.remove(depend)
+        
     def addDepend(self, depend):
         
         #
@@ -310,6 +317,9 @@
     # 
     def addDependency(self,depend):
         self.directDependencies.addDepend(depend)
+        
+    def removeDependency(self,depend):
+        self.directDependencies.removeDepend(depend)
             
     def getDirectDependencies(self):
         return self.directDependencies.getDepends()
@@ -451,14 +461,6 @@
             if dependency.getProject().getName()==name	\
                 and not dependency.isNoClasspath() :
                 return True            
-        return False
-
-    def uponFuzzy(self):
-        """
-        At least one of these dependencies is Fuzzy...
-        """
-        for dependency in self.getFullDependencies():
-            if dependency.getProject().isFuzzy(): return True
         return False
 
     # determine if this project is a prereq of any project on the todo list

Modified: gump/trunk/python/gump/core/model/project.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/project.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/project.py (original)
+++ gump/trunk/python/gump/core/model/project.py Sat Jun  4 06:20:42 2005
@@ -342,11 +342,16 @@
         return (not self.isPackaged()) and self.hasBuilder()
         
     # provide elements when not defined in xml
-    def complete(self,workspace): 
+    def complete(self,workspace,visited=None): 
         if self.isComplete(): return
-
+        
+        if not visited:         
+            # Start with knowledge of having visited self.
+            visited = [self]
+                            
         if not self.inModule():
-            self.addWarning("Not in a module")
+            self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+            self.addError("Not in a module")
             return
          
         # :TODO: hacky   
@@ -562,12 +567,25 @@
         [b.expand(self, workspace) for b in self.builder]
 
         if not packaged:
+            removes = []
+            
             # Complete dependencies so properties can reference the,
             # completed metadata within a dependent project
             for dependency in self.getDirectDependencies():
                 depProject=dependency.getProject()
-                if not depProject.isComplete():
-                    depProject.complete(workspace)
+                if depProject in visited:
+                    self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+                    self.addError("Circular Dependency with %s." % \
+                            depProject.getName())
+                    removes.append(dependency)
+                else:
+                    if not depProject.isComplete():
+                        depProject.complete(workspace)
+                    visited.append(depProject)
+                        
+            # Remove circulars...
+            for dependency in removes:
+                self.removeDependency(dependency)
 
             self.buildDependenciesMap(workspace)                        
         
@@ -594,14 +612,16 @@
             # TODO -- move these back?
             #
             if badDepends or badOptions: 
-                for xmldepend in badDepends:
+                for badDep in badDepends:
+                    (xmldepend,reason) = badDep
                     self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
-                    self.addError("Bad Dependency. Project: " \
-                            + getDomAttributeValue(xmldepend,'project') + " unknown to *this* workspace")
+                    self.addError("Bad Dependency. Project: %s : %s " \
+                            % (getDomAttributeValue(xmldepend,'project'),reason))
 
-                for xmloption in badOptions:                
-                    self.addWarning("Bad *Optional* Dependency. Project: " \
-                            + getDomAttributeValue(xmloption,'project') + " unknown to *this* workspace")
+                for badOpt in badOptions:
+                    (xmloption,reason) = badOpt   
+                    self.addWarning("Bad *Optional* Dependency. Project: %s : %s" \
+                            % (getDomAttributeValue(xmloption,'project') , reason))
         else:
             self.addInfo("This is a packaged project, location: " + self.home)        
                                     
@@ -625,10 +645,10 @@
                     
         # Close down the DOM...
         self.shutdownDom()       
-        
-        # Done, don't redo
+    
+        # Done so don't redo
         self.setComplete(True)
-
+    
     # turn the <jvmarg> children of domchild into jvmargs
     def addJVMArgs(self,domChild):        
         for jvmarg in getDomChildIterator(domChild,'jvmarg'):
@@ -651,7 +671,7 @@
                 # Add a dependency
                 self.addDependency(dependency)
             else:
-                badDepends.append(ddom)    
+                badDepends.append((ddom,"unknown to *this* workspace"))    
                 
         # Walk the XML parts converting
         badOptions=[]
@@ -666,7 +686,7 @@
                 # Add a dependency
                 self.addDependency(dependency)                    
             else:
-                badOptions.append(odom)
+                badOptions.append((odom,"unknown to *this* workspace"))
 
         return (badDepends, badOptions)
         

Modified: gump/trunk/python/gump/core/model/workspace.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/workspace.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/workspace.py (original)
+++ gump/trunk/python/gump/core/model/workspace.py Sat Jun  4 06:20:42 2005
@@ -473,13 +473,13 @@
     def hasNotifyFromOverride(self):
         if not self.isNotify(): return False
         nag=self.getDomChild('nag')
-        return hasDomAttribute(nag,'from')
+        return hasDomAttribute(nag,'from')        
         
     def getNotifyFromOverride(self):
         if self.isNotify():
             nag=self.getDomChild('nag')
-            return getDomAttributeValue(nag,'from')
-        
+            return getDomAttributeValue(nag,'from')    
+            
     def getNotifyOverrides(self):
         
         # Nag Overrides
@@ -492,7 +492,7 @@
         if self.hasNotifyFromOverride():
             wsNotifyFromOverrideAddr=self.getNotifyFromOverride()
         
-        return ( wsNotifyToOverrideAddr, wsNotifyFromOverrideAddr)
+        return ( wsNotifyToOverrideAddr, wsNotifyFromOverrideAddr )
              
     def getVersion(self):
         if self.hasDomAttribute('version'):

Modified: gump/trunk/python/gump/core/run/actor.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/run/actor.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/run/actor.py (original)
+++ gump/trunk/python/gump/core/run/actor.py Sat Jun  4 06:20:42 2005
@@ -163,10 +163,15 @@
         is available on the sub-class (i.e. if needed)
         """
         if not hasattr(self,'processProject'): return        
-        if not callable(self.processProject):  return        
-        self.log.debug('Process Project [' + `project` + '] using [' + `self` + ']')        
-        self.processProject(project)
-               
+        if not callable(self.processProject):  return     
+        
+        # Hack for bad data.
+        if project.inModule():   
+        	self.log.debug('Process Project [' + `project` + '] using [' + `self` + ']')        
+        	self.processProject(project)
+     	else:
+            self.log.debug('Skip Project (not in module) [' + `project` + '] for [' + `self` + ']')        
+        	   
     def _processOtherEvent(self,event):
         """
         Call a method called 'processOtherEvent(event)', if it

Modified: gump/trunk/python/gump/core/runner/demand.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/runner/demand.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/runner/demand.py (original)
+++ gump/trunk/python/gump/core/runner/demand.py Sat Jun  4 06:20:42 2005
@@ -180,16 +180,18 @@
         # In project order...
         for project in sequence:
 
-            # Process the module, upon demand
-            module=project.getModule()
-            
             # If we want to be updating...
             if gumpOptions.isUpdate():
-                # W/ multiple project in one module, it may be done
-                if not module.isUpdated():
-                    self.log.debug('Update module *inlined* (not in background thread) ' + `module` + '.')     
-                    inlined+=1
-                    self.performUpdate(module)
+                
+                if project.inModule():
+                    # Process the module, upon demand
+                    module=project.getModule()
+            
+                    # W/ multiple project in one module, it may be done
+                    if not module.isUpdated():
+                        self.log.debug('Update module *inlined* (not in background thread) ' + `module` + '.')     
+                        inlined+=1
+                        self.performUpdate(module)
 
             # If we want to be building...
             if gumpOptions.isBuild():

Modified: gump/trunk/python/gump/core/runner/runner.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/runner/runner.py?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/core/runner/runner.py (original)
+++ gump/trunk/python/gump/core/runner/runner.py Sat Jun  4 06:20:42 2005
@@ -216,7 +216,11 @@
         
         # Notify last
         if self.run.getOptions().isNotify() and self.run.getWorkspace().isNotify():
-            self.run.registerActor(Notifier(self.run))         
+            self.run.registerActor(Notifier(self.run))    
+        else:
+            self.log.info('Not doing notifications [%s,%s]' \
+                % (self.run.getOptions().isNotify(), \
+                    self.run.getWorkspace().isNotify() ) )
                     
                     
         # See what we have...            

Added: gump/trunk/python/gump/test/resources/full1/module6.xml
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/resources/full1/module6.xml?rev=179986&view=auto
==============================================================================
--- gump/trunk/python/gump/test/resources/full1/module6.xml (added)
+++ gump/trunk/python/gump/test/resources/full1/module6.xml Sat Jun  4 06:20:42 2005
@@ -0,0 +1,27 @@
+<module name="module6">
+
+  <url  href="http://gump.apache.org/"/>
+  <description>
+    Module #6
+  </description>
+
+  <cvs repository="repository1"/>
+
+  <project name="project6">
+    <package>org.apache.project6</package>
+
+    <depend project="project7"><noclasspath/></depend>
+    <depend project="alias1"><noclasspath/></depend>
+
+    <home nested="dist"/>
+    <work nested="classes" />
+
+    <jar name="lib/output.jar" id="output"/>
+
+    <license name="LICENSE"/>
+
+    <nag from="Gump Integration Build &lt;general@gump.apache.org&gt;"
+         to="general@gump.apache.org"/>
+  </project>
+</module>
+

Added: gump/trunk/python/gump/test/resources/full1/module7.xml
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/resources/full1/module7.xml?rev=179986&view=auto
==============================================================================
--- gump/trunk/python/gump/test/resources/full1/module7.xml (added)
+++ gump/trunk/python/gump/test/resources/full1/module7.xml Sat Jun  4 06:20:42 2005
@@ -0,0 +1,27 @@
+<module name="module7">
+
+  <url  href="http://gump.apache.org/"/>
+  <description>
+    Module #7
+  </description>
+
+  <cvs repository="repository1"/>
+
+  <project name="project7">
+    <package>org.apache.project7</package>
+
+    <depend project="project6"><noclasspath/></depend>
+    <depend project="alias1"><noclasspath/></depend>
+
+    <home nested="dist"/>
+    <work nested="classes" />
+
+    <jar name="lib/output.jar" id="output"/>
+
+    <license name="LICENSE"/>
+
+    <nag from="Gump Integration Build &lt;general@gump.apache.org&gt;"
+         to="general@gump.apache.org"/>
+  </project>
+</module>
+

Modified: gump/trunk/python/gump/test/resources/full1/profile.xml
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/resources/full1/profile.xml?rev=179986&r1=179985&r2=179986&view=diff
==============================================================================
--- gump/trunk/python/gump/test/resources/full1/profile.xml (original)
+++ gump/trunk/python/gump/test/resources/full1/profile.xml Sat Jun  4 06:20:42 2005
@@ -31,6 +31,8 @@
 
   <!-- Override package1 to be a package -->
   <project name='package1' package='package1' />
+  <!-- this is a missing package, within a missing module -->
+  <project name='package2' package='missing_package' />
   
 </profile>