Skip to content

Commit 6910769

Browse files
committed
qualifications
1 parent 90cb80c commit 6910769

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

cabal-install/src/Distribution/Client/SolverInstallPlan.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ module Distribution.Client.SolverInstallPlan
4848
, reverseDependencyClosure
4949
, topologicalOrder
5050
, reverseTopologicalOrder
51+
, libraryRoots
52+
, setupRoots
53+
, rootSets
54+
, nonSetupClosure
55+
, qualifications
56+
57+
, dependencyInconsistencies
58+
, dependencyInconsistencies'
5159
) where
5260

5361
import Distribution.Client.Compat.Prelude hiding (toList)
@@ -72,6 +80,7 @@ import Distribution.Version
7280
( Version
7381
)
7482

83+
import Distribution.Solver.Types.PackagePath (PackagePath, Qualified(..))
7584
import Distribution.Solver.Types.ResolverPackage
7685
import Distribution.Solver.Types.SolverId
7786
import Distribution.Solver.Types.SolverPackage
@@ -80,9 +89,12 @@ import Data.Array ((!))
8089
import qualified Data.Foldable as Foldable
8190
import qualified Data.Graph as OldGraph
8291
import qualified Data.Map as Map
92+
import qualified Data.Set as Set
8393
import Distribution.Compat.Graph (Graph, IsNode (..))
8494
import qualified Distribution.Compat.Graph as Graph
8595

96+
97+
8698
type SolverPlanPackage = ResolverPackage UnresolvedPkgLoc
8799

88100
type SolverPlanIndex = Graph SolverPlanPackage
@@ -314,6 +326,13 @@ rootSets index = [libRoots] ++ setupRoots index
314326
libRoots :: [SolverId]
315327
libRoots = libraryRoots index
316328

329+
qualifications :: SolverPlanIndex -> Map PackagePath (Set SolverId)
330+
qualifications g = Map.fromListWith (<>)
331+
[ (pp, Set.singleton (solverId spp))
332+
| spp <- Graph.toList g
333+
, let Q pp _pn = solverQPN spp
334+
]
335+
317336
-- | Compute the library roots of a plan
318337
--
319338
-- The library roots are the set of packages with no reverse dependencies

0 commit comments

Comments
 (0)