Commit 33809c5d authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Move ConfiguredPackage type into Types module

It's not actually specific to the InstallPlan.
parent 06892ecb
......@@ -32,7 +32,7 @@ import Hackage.Setup (InstallFlags(..))
import Hackage.Tar (extractTarGzFile)
import Hackage.Types as Available
( UnresolvedDependency(..), AvailablePackage(..)
, AvailablePackageSource(..), Repo )
, AvailablePackageSource(..), Repo, ConfiguredPackage(..) )
import Hackage.Utils (showDependencies)
import Hackage.SetupWrapper
( setupWrapper, SetupScriptOptions(..) )
......
......@@ -41,7 +41,7 @@ module Hackage.InstallPlan (
) where
import Hackage.Types
( AvailablePackage(packageDescription) )
( AvailablePackage(packageDescription), ConfiguredPackage(..) )
import Distribution.Package
( PackageIdentifier(..), Package(..), PackageFixedDeps(..)
, packageName, Dependency(..) )
......@@ -52,7 +52,7 @@ import Distribution.InstalledPackageInfo
import Distribution.PackageDescription
( GenericPackageDescription(genPackageFlags)
, PackageDescription(buildDepends)
, Flag(flagName), FlagName(..), FlagAssignment )
, Flag(flagName), FlagName(..) )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.Simple.PackageIndex
......@@ -114,24 +114,6 @@ import Control.Exception
-- also in the set. It is consistent if for every package in the set, all
-- dependencies which target that package have the same version.
-- | A 'ConfiguredPackage' is a not-yet-installed package along with the
-- total configuration information. The configuration information is total in
-- the sense that it provides all the configuration information and so the
-- final configure process will be independent of the environment.
--
data ConfiguredPackage = ConfiguredPackage
AvailablePackage -- ^ package info, including repo
FlagAssignment -- ^ complete flag assignment for the package
[PackageIdentifier] -- ^ exact dependencies, must be consistent with the
-- version constraints in the package info
deriving Show
instance Package ConfiguredPackage where
packageId (ConfiguredPackage pkg _ _) = packageId pkg
instance PackageFixedDeps ConfiguredPackage where
depends (ConfiguredPackage _ _ deps) = deps
data PlanPackage buildResult = PreExisting InstalledPackageInfo
| Configured ConfiguredPackage
| Installed ConfiguredPackage
......
......@@ -13,13 +13,33 @@
module Hackage.Types where
import Distribution.Package
( PackageIdentifier(..), Package(..), Dependency )
( PackageIdentifier(..), Package(..), PackageFixedDeps(..)
, Dependency )
import Distribution.PackageDescription
( GenericPackageDescription, FlagAssignment )
newtype Username = Username { unUsername :: String }
newtype Password = Password { unPassword :: String }
-- | A 'ConfiguredPackage' is a not-yet-installed package along with the
-- total configuration information. The configuration information is total in
-- the sense that it provides all the configuration information and so the
-- final configure process will be independent of the environment.
--
data ConfiguredPackage = ConfiguredPackage
AvailablePackage -- ^ package info, including repo
FlagAssignment -- ^ complete flag assignment for the package
[PackageIdentifier] -- ^ exact dependencies, must be consistent with the
-- version constraints in the package info
deriving Show
instance Package ConfiguredPackage where
packageId (ConfiguredPackage pkg _ _) = packageId pkg
instance PackageFixedDeps ConfiguredPackage where
depends (ConfiguredPackage _ _ deps) = deps
-- | We re-use @GenericPackageDescription@ and use the @package-url@
-- field to store the tarball URL.
data AvailablePackage = AvailablePackage {
......
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