Commit 25123866 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Edward Z. Yang
Browse files

Don't report dependency inconsistencies for multiply instantiated packages.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 14b50f3c
...@@ -639,24 +639,30 @@ dependencyGraph index = (graph, vertex_to_pkg, id_to_vertex) ...@@ -639,24 +639,30 @@ dependencyGraph index = (graph, vertex_to_pkg, id_to_vertex)
-- depend on it and the versions they require. These are guaranteed to be -- depend on it and the versions they require. These are guaranteed to be
-- distinct. -- distinct.
-- --
dependencyInconsistencies :: PackageInstalled a => PackageIndex a dependencyInconsistencies :: InstalledPackageIndex
-> [(PackageName, [(PackageId, Version)])] -> [(PackageName, [(PackageId, Version)])]
dependencyInconsistencies index = dependencyInconsistencies index =
[ (name, [ (pid,packageVersion dep) | (dep,pids) <- uses, pid <- pids]) [ (name, [ (pid,packageVersion dep) | (dep,pids) <- uses, pid <- pids])
| (name, ipid_map) <- Map.toList inverseIndex | (name, cid_map) <- Map.toList inverseIndex
, let uses = Map.elems ipid_map , let uses = Map.elems cid_map
, reallyIsInconsistent (map fst uses) ] , reallyIsInconsistent (map fst uses) ]
where -- for each PackageName, where -- for each PackageName,
-- for each package with that name, -- for each package with that name,
-- the InstalledPackageInfo and the package Ids of packages -- the InstalledPackageInfo and the package Ids of packages
-- that depend on it. -- that depend on it.
--
-- NB: we use ComponentId here, not UnitId, because there might
-- be multiple occurrences of a package name with different
-- instantiations. However, the component IDs will always be
-- consistent!
inverseIndex = Map.fromListWith (Map.unionWith (\(a,b) (_,b') -> (a,b++b'))) inverseIndex = Map.fromListWith (Map.unionWith (\(a,b) (_,b') -> (a,b++b')))
[ (packageName dep, [ (packageName dep,
Map.fromList [(ipid,(dep,[packageId pkg]))]) Map.fromList [(cid,(dep,[packageId pkg]))])
| pkg <- allPackages index | pkg <- allPackages index
, ipid <- installedDepends pkg , ipid <- installedDepends pkg
, Just dep <- [lookupUnitId index ipid] , Just dep <- [lookupUnitId index ipid]
, let cid = IPI.installedComponentId dep
] ]
-- Added in 991e52a474e2b8280432257c1771dc474a320a30, -- Added in 991e52a474e2b8280432257c1771dc474a320a30,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment