Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
d350003b
Commit
d350003b
authored
Jul 06, 2016
by
Edward Z. Yang
Browse files
Axe SolverPlanPackage to reuse ResolverPackage.
Signed-off-by:
Edward Z. Yang
<
ezyang@cs.stanford.edu
>
parent
42f223c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/SolverInstallPlan.hs
View file @
d350003b
...
...
@@ -19,7 +19,8 @@
-----------------------------------------------------------------------------
module
Distribution.Client.SolverInstallPlan
(
SolverInstallPlan
(
..
),
SolverPlanPackage
(
..
),
SolverPlanPackage
,
ResolverPackage
(
..
),
-- * Operations on 'SolverInstallPlan's
new
,
...
...
@@ -48,9 +49,6 @@ module Distribution.Client.SolverInstallPlan(
reverseTopologicalOrder
,
)
where
import
Distribution.Solver.Types.SolverPackage
import
Distribution.InstalledPackageInfo
(
InstalledPackageInfo
)
import
Distribution.Package
(
PackageIdentifier
(
..
),
Package
(
..
),
PackageName
(
..
)
,
HasUnitId
(
..
),
UnitId
(
..
),
PackageId
,
packageVersion
,
packageName
)
...
...
@@ -65,6 +63,7 @@ import Distribution.Version
import
Distribution.Solver.Types.PackageFixedDeps
import
Distribution.Solver.Types.Settings
import
Distribution.Solver.Types.ResolverPackage
import
Data.List
(
intercalate
)
...
...
@@ -77,35 +76,8 @@ import qualified Distribution.Compat.Graph as Graph
import
qualified
Data.Map
as
Map
import
Data.Map
(
Map
)
import
Data.Array
((
!
))
import
GHC.Generics
hiding
(
packageName
)
-- | The dependency solver produces two types of packages: pre-existing
-- packages that it selected from the installed package database, and
-- "configured" packages which need to be installed.
data
SolverPlanPackage
=
PreExisting
InstalledPackageInfo
|
Configured
(
SolverPackage
UnresolvedPkgLoc
)
deriving
(
Eq
,
Show
,
Generic
)
instance
Binary
SolverPlanPackage
instance
Package
SolverPlanPackage
where
packageId
(
PreExisting
ipkg
)
=
packageId
ipkg
packageId
(
Configured
spkg
)
=
packageId
spkg
instance
PackageFixedDeps
SolverPlanPackage
where
depends
(
PreExisting
pkg
)
=
depends
pkg
depends
(
Configured
pkg
)
=
depends
pkg
instance
HasUnitId
SolverPlanPackage
where
installedUnitId
(
PreExisting
ipkg
)
=
installedUnitId
ipkg
installedUnitId
(
Configured
spkg
)
=
installedUnitId
spkg
instance
IsNode
SolverPlanPackage
where
type
Key
SolverPlanPackage
=
UnitId
-- TODO: change me
nodeKey
=
installedUnitId
-- Use dependencies for ALL components
nodeNeighbors
=
CD
.
flatDeps
.
depends
type
SolverPlanPackage
=
ResolverPackage
UnresolvedPkgLoc
type
SolverPlanIndex
=
Graph
SolverPlanPackage
...
...
cabal-install/Distribution/Solver/Types/ResolverPackage.hs
View file @
d350003b
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveGeneric #-}
module
Distribution.Solver.Types.ResolverPackage
(
ResolverPackage
(
..
)
)
where
import
Distribution.InstalledPackageInfo
(
InstalledPackageInfo
)
import
Distribution.Solver.Types.SolverPackage
import
Distribution.Solver.Types.PackageFixedDeps
import
qualified
Distribution.Solver.Types.ComponentDeps
as
CD
import
Distribution.Compat.Binary
(
Binary
(
..
))
import
Distribution.Compat.Graph
(
IsNode
(
..
))
import
Distribution.InstalledPackageInfo
(
InstalledPackageInfo
)
import
Distribution.Package
(
UnitId
,
Package
(
..
),
HasUnitId
(
..
))
import
GHC.Generics
(
Generic
)
-- | The dependency resolver picks either pre-existing installed packages
-- or it picks source packages along with package configuration.
...
...
@@ -12,4 +21,24 @@ import Distribution.Solver.Types.SolverPackage
--
data
ResolverPackage
loc
=
PreExisting
InstalledPackageInfo
|
Configured
(
SolverPackage
loc
)
deriving
(
Eq
,
Show
,
Generic
)
instance
Binary
loc
=>
Binary
(
ResolverPackage
loc
)
instance
Package
(
ResolverPackage
loc
)
where
packageId
(
PreExisting
ipkg
)
=
packageId
ipkg
packageId
(
Configured
spkg
)
=
packageId
spkg
instance
PackageFixedDeps
(
ResolverPackage
loc
)
where
depends
(
PreExisting
pkg
)
=
depends
pkg
depends
(
Configured
pkg
)
=
depends
pkg
instance
HasUnitId
(
ResolverPackage
loc
)
where
installedUnitId
(
PreExisting
ipkg
)
=
installedUnitId
ipkg
installedUnitId
(
Configured
spkg
)
=
installedUnitId
spkg
instance
IsNode
(
ResolverPackage
loc
)
where
type
Key
(
ResolverPackage
loc
)
=
UnitId
-- TODO: change me
nodeKey
=
installedUnitId
-- Use dependencies for ALL components
nodeNeighbors
=
CD
.
flatDeps
.
depends
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment