Commit 950b47cb authored by Edward Z. Yang's avatar Edward Z. Yang Committed by GitHub
Browse files

Merge pull request #4039 from grayjay/solver-duplicate-packages

Deduplicate packages in the install plan after the solver removes qualifiers.
parents 7e3ce23b 9378165b
......@@ -9,8 +9,14 @@ module Distribution.Solver.Modular
-- and finally, we have to convert back the resulting install
-- plan.
import Data.Function
( on )
import Data.List
( nubBy )
import Data.Map as M
( fromListWith )
import Distribution.Compat.Graph
( IsNode(..) )
import Distribution.Solver.Modular.Assignment
( toCPs )
import Distribution.Solver.Modular.ConfiguredConversion
......@@ -44,8 +50,12 @@ modularResolver sc (Platform arch os) cinfo iidx sidx pkgConfigDB pprefs pcs pns
pair lpc = (pcName $ unlabelPackageConstraint lpc, [lpc])
-- Results have to be converted into an install plan.
postprocess a rdm = map (convCP iidx sidx) (toCPs a rdm)
-- Results have to be converted into an install plan. 'convCP' removes
-- package qualifiers, which means that linked packages become duplicates
-- and can be removed.
-- TODO: Use ordNubBy instead of nubBy.
postprocess a rdm = nubBy ((==) `on` nodeKey) $
map (convCP iidx sidx) (toCPs a rdm)
-- Helper function to extract the PN from a constraint.
pcName :: PackageConstraint -> PN
Markdown is supported
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