diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-12-03 15:51:55 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-12-03 16:54:15 +0000 |
commit | 49b67bb0150aa1854457243e12289efd1c7fe408 (patch) | |
tree | d4f904118d6024f3416634f2bd8f4e17286d0510 /morphlib/sourcepool.py | |
parent | 342b17b1b676e776405613275ffe2c6ca1c65df8 (diff) | |
download | morph-49b67bb0150aa1854457243e12289efd1c7fe408.tar.gz |
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.
Diffstat (limited to 'morphlib/sourcepool.py')
-rw-r--r-- | morphlib/sourcepool.py | 5 |
1 files 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. |