From fcc4c1b2f20fd1e19f7443923f779ef4e5b9c5d0 Mon Sep 17 00:00:00 2001
From: Erik Schnetter <schnetter@gmail.com>
Date: Tue, 17 May 2016 15:13:28 -0400
Subject: [PATCH] Remove duplicate providers that can concretize to the same
 result

Patch generously provided by @becker33.

Closes #928.
---
 lib/spack/spack/spec.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 89a023a750..470353c4f6 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1071,6 +1071,11 @@ def _find_provider(self, vdep, provider_index):
         # If there is a provider for the vpkg, then use that instead of
         # the virtual package.
         if providers:
+            # Remove duplicate providers that can concretize to the same result.
+            for provider in providers:
+                for spec in providers:
+                    if spec is not provider and provider.satisfies(spec):
+                        providers.remove(spec)
             # Can't have multiple providers for the same thing in one spec.
             if len(providers) > 1:
                 raise MultipleProviderError(vdep, providers)
-- 
GitLab