From 84e51a23a2ed2b9aeac03fc8f08050ecfc56ab4d Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Mon, 16 Apr 2012 19:11:23 +0100 Subject: Remove buggy cyclic dependency chain check from ArtifactResolver. However, leave a TODO note that we really want this in the source. --- morphlib/artifactresolver.py | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'morphlib/artifactresolver.py') diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py index f8ae4399..808f7119 100644 --- a/morphlib/artifactresolver.py +++ b/morphlib/artifactresolver.py @@ -27,13 +27,6 @@ class MutualDependencyError(cliapp.AppException): self, 'Cyclic dependency between %s and %s detected' % (a, b)) -class CyclicDependencyChainError(cliapp.AppException): - - def __init__(self): - cliapp.AppException.__init__( - self, 'Cyclic dependency chain detected') - - class DependencyOrderError(cliapp.AppException): def __init__(self, stratum, chunk, dependency_name): @@ -89,7 +82,8 @@ class ArtifactResolver(object): self._added_artifacts = set() artifacts = self._resolve_artifacts_recursively() - self._detect_cyclic_dependencies(artifacts) + # TODO perform cycle detection, e.g. based on: + # http://stackoverflow.com/questions/546655/finding-all-cycles-in-graph return artifacts def _resolve_artifacts_recursively(self): @@ -258,36 +252,7 @@ class ArtifactResolver(object): return artifacts def _chunk_artifact_names(self, source): - if 'artifacts' in source.morphology: - return sorted(source.morphology['artifacts'].keys()) + if 'chunks' in source.morphology: + return sorted(source.morphology['chunks'].keys()) else: return [source.morphology['name']] - - def _detect_cyclic_dependencies(self, artifacts): - # FIXME This is not well tested and might be incorrect. Better - # something based on - # http://stackoverflow.com/questions/546655/finding-all-cycles-in-graph - - visited = set() - explored = set() - parent = {} - - roots = [] - for artifact in artifacts: - if len(artifact.dependents) == 0: - roots.append(artifact) - parent[artifact] = None - - stack = collections.deque(roots) - while stack: - artifact = stack.popleft() - visited.add(artifact) - - for dependency in artifact.dependencies: - if not (artifact, dependency) in explored: - explored.add((artifact, dependency)) - parent[dependency] = artifact - if not dependency in visited: - stack.appendleft(dependency) - else: - raise CyclicDependencyChainError() -- cgit v1.2.1