From 19123b4c48d0929a380fcf9321c35541230abd99 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 16 Jul 2015 01:40:43 -0700 Subject: Fix ProviderIndex.update(), which didn't remove stale providers. --- lib/spack/spack/virtual.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2