From 49b67bb0150aa1854457243e12289efd1c7fe408 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 3 Dec 2012 15:51:55 +0000 Subject: Ensure sourcepool does not contain duplicates Before this change, if a stratum had dependencies listed, then morph would add that stratum to the list of things to build multiple times, resulting in more things being built. This was not a major problem, since it would just result in more cache lookups than necessary, but lookups are more expensive on remote artifact caches, and anything attempting to find which artifact would be the result of a build would get confused by there being many top-level artifacts with no dependencies. --- morphlib/sourcepool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morphlib/sourcepool.py b/morphlib/sourcepool.py index ef21ba5a..ec134c0a 100644 --- a/morphlib/sourcepool.py +++ b/morphlib/sourcepool.py @@ -30,8 +30,9 @@ class SourcePool(object): key = self._key(source.repo_name, source.original_ref, source.filename) - self._sources[key] = source - self._order.append(source) + if key not in self._sources: + self._sources[key] = source + self._order.append(source) def lookup(self, repo_name, original_ref, filename): '''Find a source in the pool. -- cgit v1.2.1