@@ -56,22 +56,16 @@ import Prelude ()
5656import Distribution.Package
5757 ( HasUnitId (.. )
5858 , Package (.. )
59- , PackageId
6059 , PackageIdentifier (.. )
61- , PackageName
62- , packageName
63- , packageVersion
6460 )
6561import qualified Distribution.Solver.Types.ComponentDeps as CD
6662import Distribution.Types.Flag (nullFlagAssignment )
6763
6864import Distribution.Client.Types
6965 ( UnresolvedPkgLoc
7066 )
71- import Distribution.Version
72- ( Version
73- )
7467
68+ import Distribution.Solver.Types.PackagePath (QPN )
7569import Distribution.Solver.Types.ResolverPackage
7670import Distribution.Solver.Types.SolverId
7771import Distribution.Solver.Types.SolverPackage
@@ -189,7 +183,7 @@ data SolverPlanProblem
189183 SolverPlanPackage
190184 [PackageIdentifier ]
191185 | PackageCycle [SolverPlanPackage ]
192- | PackageInconsistency PackageName [(PackageIdentifier , Version )]
186+ | PackageInconsistency QPN [(SolverId , SolverId )]
193187 | PackageStateInvalid SolverPlanPackage SolverPlanPackage
194188
195189showPlanProblem :: SolverPlanProblem -> String
@@ -210,7 +204,7 @@ showPlanProblem (PackageInconsistency name inconsistencies) =
210204 [ " package "
211205 ++ prettyShow pkg
212206 ++ " requires "
213- ++ prettyShow ( PackageIdentifier name ver)
207+ ++ prettyShow ver
214208 | (pkg, ver) <- inconsistencies
215209 ]
216210showPlanProblem (PackageStateInvalid pkg pkg') =
@@ -267,7 +261,7 @@ problems index =
267261-- for them here.
268262dependencyInconsistencies
269263 :: SolverPlanIndex
270- -> [(PackageName , [(PackageIdentifier , Version )])]
264+ -> [(QPN , [(SolverId , SolverId )])]
271265dependencyInconsistencies index =
272266 concatMap dependencyInconsistencies' subplans
273267 where
@@ -318,6 +312,8 @@ rootSets index = [libRoots] ++ setupRoots index
318312--
319313-- The library roots are the set of packages with no reverse dependencies
320314-- (no reverse library dependencies but also no reverse setup dependencies).
315+ --
316+ -- FIXME: misleading name, this includes executables too!
321317libraryRoots :: SolverPlanIndex -> [SolverId ]
322318libraryRoots index =
323319 map (nodeKey . toPkgId) roots
@@ -345,9 +341,14 @@ setupRoots =
345341-- distinct.
346342dependencyInconsistencies'
347343 :: SolverPlanIndex
348- -> [(PackageName , [(PackageIdentifier , Version )])]
344+ -> [(QPN , [(SolverId , SolverId )])]
349345dependencyInconsistencies' index =
350- [ (name, [(pid, packageVersion dep) | (dep, pids) <- uses, pid <- pids])
346+ [ ( name
347+ , [ (sid, solverId dep)
348+ | (dep, sids) <- uses
349+ , sid <- sids
350+ ]
351+ )
351352 | (name, ipid_map) <- Map. toList inverseIndex
352353 , let uses = Map. elems ipid_map
353354 , length uses > 1
@@ -357,11 +358,11 @@ dependencyInconsistencies' index =
357358 -- and each installed ID of that package
358359 -- the associated package instance
359360 -- and a list of reverse dependencies (as source IDs)
360- inverseIndex :: Map PackageName (Map SolverId (SolverPlanPackage , [PackageId ]))
361+ inverseIndex :: Map QPN (Map SolverId (SolverPlanPackage , [SolverId ]))
361362 inverseIndex =
362363 Map. fromListWith
363364 (Map. unionWith (\ (a, b) (_, b') -> (a, b ++ b')))
364- [ (packageName dep, Map. fromList [(sid, (dep, [packageId pkg]))])
365+ [ (solverQPN dep, Map. fromList [(sid, (dep, [solverId pkg]))])
365366 | -- For each package @pkg@
366367 pkg <- Foldable. toList index
367368 , -- Find out which @sid@ @pkg@ depends on
0 commit comments