summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-07-16 01:40:43 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-07-16 01:41:11 -0700
commit19123b4c48d0929a380fcf9321c35541230abd99 (patch)
tree3b772dc664ec885a07436ecf58c070e57a05cba7
parente0976963903ff938e1433e6b3c71d9ada1240c2d (diff)
downloadspack-19123b4c48d0929a380fcf9321c35541230abd99.tar.gz
spack-19123b4c48d0929a380fcf9321c35541230abd99.tar.bz2
spack-19123b4c48d0929a380fcf9321c35541230abd99.tar.xz
spack-19123b4c48d0929a380fcf9321c35541230abd99.zip
Fix ProviderIndex.update(), which didn't remove stale providers.
-rw-r--r--lib/spack/spack/virtual.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/spack/spack/virtual.py b/lib/spack/spack/virtual.py
index ff5d7c9035..fa070e6bd5 100644
--- a/lib/spack/spack/virtual.py
+++ b/lib/spack/spack/virtual.py
@@ -81,7 +81,16 @@ class ProviderIndex(object):
provider_map[provided_spec] = set()
if self.restrict:
- provider_map[provided_spec].add(spec)
+ provider_set = provider_map[provided_spec]
+
+ # If this package existed in the index before,
+ # need to take the old versions out, as they're
+ # now more constrained.
+ old = set([s for s in provider_set if s.name == spec.name])
+ provider_set.difference_update(old)
+
+ # Now add the new version.
+ provider_set.add(spec)
else:
# Before putting the spec in the map, constrain it so that