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/08 20:51:56 UTC
svn commit: r189620 - in /gump/trunk/python/gump: core/model/module.py
core/model/project.py test/resources/full1/profile.xml
Author: ajack
Date: Wed Jun 8 11:51:54 2005
New Revision: 189620
URL: http://svn.apache.org/viewcvs?rev=189620&view=rev
Log:
Second try at circular dependency detection. This time with the test projects
now included in the test profile, so locally tested as working. Next step is
to test on the full metadata, using a test (against TRUNK) workspace on vmgump.
Modified:
gump/trunk/python/gump/core/model/module.py
gump/trunk/python/gump/core/model/project.py
gump/trunk/python/gump/test/resources/full1/profile.xml
Modified: gump/trunk/python/gump/core/model/module.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/module.py?rev=189620&r1=189619&r2=189620&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/module.py (original)
+++ gump/trunk/python/gump/core/model/module.py Wed Jun 8 11:51:54 2005
@@ -316,7 +316,12 @@
# provide default elements when not defined in xml
def complete(self,workspace):
-
+
+ # Give some indication when spinning on
+ # circular dependencies, 'cos even though we
+ # have code in to not spin, never assume never...
+ log.debug('Complete: %s' % self)
+
if self.isComplete(): return
# :TODO: hacky
Modified: gump/trunk/python/gump/core/model/project.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/project.py?rev=189620&r1=189619&r2=189620&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/project.py (original)
+++ gump/trunk/python/gump/core/model/project.py Wed Jun 8 11:51:54 2005
@@ -343,11 +343,18 @@
# provide elements when not defined in xml
def complete(self,workspace,visited=None):
+
+ # Give some indication when spinning on
+ # circular dependencies, 'cos even though we
+ # have code in to not spin, never assume never...
+ log.debug('Complete: %s, Path: %s' % (self, visited))
+
if self.isComplete(): return
- if not visited:
- # Start with knowledge of having visited self.
- visited = [self]
+ # Create a copy, for recursion, and
+ # detection of circular paths.
+ new_visited = [self]
+ if visited: new_visited += visited
if not self.inModule():
self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
@@ -573,15 +580,22 @@
# completed metadata within a dependent project
for dependency in self.getDirectDependencies():
depProject=dependency.getProject()
- if depProject in visited:
- self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
- self.addError("Circular Dependency with %s." % \
- depProject.getName())
+ if depProject in new_visited:
+ for circProject in new_visited:
+ circProject.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+ circProject.addError("Circular Dependency. Path: %s -> %s." % \
+ (new_visited, depProject.getName()))
+
+ self.addError("Dependency broken, removing dependency on %s from %s." % \
+ (depProject.getName(), self.getName()))
+
removes.append(dependency)
else:
+ # Don't redo what is done.
if not depProject.isComplete():
- depProject.complete(workspace)
- visited.append(depProject)
+ # Recurse, knowing which project
+ # is in this list.
+ depProject.complete(workspace, new_visited)
# Remove circulars...
for dependency in removes:
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=189620&r1=189619&r2=189620&view=diff
==============================================================================
--- gump/trunk/python/gump/test/resources/full1/profile.xml (original)
+++ gump/trunk/python/gump/test/resources/full1/profile.xml Wed Jun 8 11:51:54 2005
@@ -9,6 +9,8 @@
<module href="module3.xml"/>
<module href="module4.xml"/>
<module href="module5.xml"/>
+ <module href="module6.xml"/>
+ <module href="module7.xml"/>
<module href="broken1.xml"/>
<module href="broken2.xml"/>