summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-19 15:06:28 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-19 15:07:31 +0000
commit8681a945994c12684a605ed638722f10fbc00db8 (patch)
treee3e165d188eea0417f44e66877c3e8c7885e5ffb /morphlib
parent0d60a83a99c80feb14b6d228f9a8426ef1f4579a (diff)
downloadmorph-8681a945994c12684a605ed638722f10fbc00db8.tar.gz
Avoid self-dependencies, do not add dependencies multiple times.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/blobs.py6
-rw-r--r--morphlib/builddependencygraph.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/morphlib/blobs.py b/morphlib/blobs.py
index 4c1190fb..1c8686b0 100644
--- a/morphlib/blobs.py
+++ b/morphlib/blobs.py
@@ -43,8 +43,10 @@ class Blob(object):
self.parents.remove(parent)
def add_dependency(self, other):
- self.dependencies.append(other)
- other.dependents.append(self)
+ if not other in self.dependencies:
+ self.dependencies.append(other)
+ if not self in other.dependents:
+ other.dependents.append(self)
def remove_dependency(self, other):
self.dependencies.remove(other)
diff --git a/morphlib/builddependencygraph.py b/morphlib/builddependencygraph.py
index b75eab84..90c4f084 100644
--- a/morphlib/builddependencygraph.py
+++ b/morphlib/builddependencygraph.py
@@ -183,12 +183,14 @@ class BuildDependencyGraph(object): # pragma: no cover
# chunks with no build-depends implicitly depend on all
# chunks listed earlier in the same stratum
for dependency in stratum_chunks:
- chunk.add_dependency(dependency)
+ if not dependency is chunk:
+ chunk.add_dependency(dependency)
elif isinstance(build_depends, list):
for depname in build_depends:
if depname in name_to_chunk:
dependency = name_to_chunk[depname]
- chunk.add_dependency(dependency)
+ if not dependency is chunk:
+ chunk.add_dependency(dependency)
else:
raise Exception('%s: source %s references %s before '
'it is defined' %