Commit 44e3bc78 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Initial go at converting to the new Cabal-1.8 installed package system

It works by ignoring the possibility that there could be multiple
installed packages sharing the same source package Id. We just pick
the "top most" one which is usually ok. We make no attempt to check
that we are using consistent installed packages.
parent f785ddec
......@@ -27,12 +27,12 @@ import Distribution.Client.Dependency
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.InstallPlan (InstallPlan)
import Distribution.Client.IndexUtils as IndexUtils
( getAvailablePackages )
( getAvailablePackages, getInstalledPackages )
import Distribution.Client.Setup
( ConfigExFlags(..), configureCommand, filterConfigureFlags )
import Distribution.Client.Types as Available
( AvailablePackage(..), AvailablePackageSource(..), Repo(..)
, AvailablePackageDb(..), ConfiguredPackage(..) )
, AvailablePackageDb(..), ConfiguredPackage(..), InstalledPackage )
import Distribution.Client.SetupWrapper
( setupWrapper, SetupScriptOptions(..), defaultSetupScriptOptions )
......@@ -40,25 +40,19 @@ import Distribution.Simple.Compiler
( CompilerId(..), Compiler(compilerId)
, PackageDB(..), PackageDBStack )
import Distribution.Simple.Program (ProgramConfiguration )
import Distribution.Simple.Configure (getInstalledPackages)
import Distribution.Simple.Setup
( ConfigFlags(..), toFlag, flagToMaybe, fromFlagOrDefault )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import Distribution.Simple.Utils
( defaultPackageDesc )
import Distribution.Package
( PackageName, packageName, packageVersion
, Package(..), Dependency(..), thisPackageVersion )
import qualified Distribution.PackageDescription as PackageDescription
import Distribution.PackageDescription
( PackageDescription )
import Distribution.PackageDescription.Parse
( readPackageDescription )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Version
( VersionRange, anyVersion, thisVersion )
import Distribution.Simple.Utils as Utils
......@@ -134,7 +128,7 @@ configure verbosity packageDBs repos comp conf
--
planLocalPackage :: Verbosity -> Compiler
-> ConfigFlags -> ConfigExFlags
-> Maybe (PackageIndex InstalledPackageInfo)
-> Maybe (PackageIndex InstalledPackage)
-> AvailablePackageDb
-> IO (Progress String String InstallPlan)
planLocalPackage verbosity comp configFlags configExFlags installed
......
......@@ -29,13 +29,12 @@ module Distribution.Client.Dependency (
import Distribution.Client.Dependency.Bogus (bogusResolver)
import Distribution.Client.Dependency.TopDown (topDownResolver)
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.InstallPlan (InstallPlan)
import Distribution.Client.Types
( UnresolvedDependency(..), AvailablePackage(..) )
( UnresolvedDependency(..), AvailablePackage(..), InstalledPackage )
import Distribution.Client.Dependency.Types
( DependencyResolver, PackageConstraint(..)
, PackagePreferences(..), InstalledPreference(..)
......@@ -44,7 +43,7 @@ import Distribution.Package
( PackageIdentifier(..), PackageName(..), packageVersion, packageName
, Dependency(..), Package(..), PackageFixedDeps(..) )
import Distribution.Version
( VersionRange(AnyVersion), orLaterVersion, isAnyVersion )
( VersionRange, anyVersion, orLaterVersion, isAnyVersion )
import Distribution.Compiler
( CompilerId(..) )
import Distribution.System
......@@ -113,7 +112,7 @@ data PackagePreference
resolveDependencies :: Platform
-> CompilerId
-> Maybe (PackageIndex InstalledPackageInfo)
-> Maybe (PackageIndex InstalledPackage)
-> PackageIndex AvailablePackage
-> PackagesPreference
-> [PackageConstraint]
......@@ -127,7 +126,7 @@ resolveDependencies platform comp installed available
resolveDependenciesWithProgress :: Platform
-> CompilerId
-> Maybe (PackageIndex InstalledPackageInfo)
-> Maybe (PackageIndex InstalledPackage)
-> PackageIndex AvailablePackage
-> PackagesPreference
-> [PackageConstraint]
......@@ -152,7 +151,7 @@ hideBrokenPackages index =
dependencyResolver
:: DependencyResolver
-> Platform -> CompilerId
-> PackageIndex InstalledPackageInfo
-> PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> PackagesPreference
-> [PackageConstraint]
......@@ -195,7 +194,7 @@ interpretPackagesPreference selected (PackagesPreference defaultPref prefs) =
where
versionPref pkgname =
fromMaybe AnyVersion (Map.lookup pkgname versionPrefs)
fromMaybe anyVersion (Map.lookup pkgname versionPrefs)
versionPrefs = Map.fromList
[ (pkgname, pref)
| PackageVersionPreference pkgname pref <- prefs ]
......@@ -217,7 +216,7 @@ interpretPackagesPreference selected (PackagesPreference defaultPref prefs) =
-- | Given the list of installed packages and available packages, figure
-- out which packages can be upgraded.
--
upgradableDependencies :: PackageIndex InstalledPackageInfo
upgradableDependencies :: PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> [Dependency]
upgradableDependencies installed available =
......
......@@ -29,8 +29,8 @@ import Distribution.PackageDescription
( GenericPackageDescription(..), CondTree(..), FlagAssignment )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import Distribution.Version
( VersionRange, anyVersion, intersectVersionRanges, withinRange )
import Distribution.Simple.Utils
......
......@@ -22,16 +22,14 @@ import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.InstallPlan
( PlanPackage(..) )
import Distribution.Client.Types
( AvailablePackage(..), ConfiguredPackage(..) )
( AvailablePackage(..), ConfiguredPackage(..), InstalledPackage(..) )
import Distribution.Client.Dependency.Types
( DependencyResolver, PackageConstraint(..)
, PackagePreferences(..), InstalledPreference(..)
, Progress(..), foldProgress )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import Distribution.Package
( PackageName(..), PackageIdentifier, Package(packageId), packageVersion, packageName
, Dependency(Dependency), thisPackageVersion, notThisPackageVersion
......@@ -73,7 +71,7 @@ import Control.Exception
-- ------------------------------------------------------------
type Constraints = Constraints.Constraints
InstalledPackage UnconfiguredPackage ExclusionReason
InstalledPackageEx UnconfiguredPackage ExclusionReason
type SelectedPackages = PackageIndex SelectedPackage
-- ------------------------------------------------------------
......@@ -105,7 +103,7 @@ explore pref (ChoiceNode _ choices) =
(_, node') = maximumBy (bestByPref pkgname) choice
where
topSortNumber choice = case fst (head choice) of
InstalledOnly (InstalledPackage _ i _) -> i
InstalledOnly (InstalledPackageEx _ i _) -> i
AvailableOnly (UnconfiguredPackage _ i _) -> i
InstalledAndAvailable _ (UnconfiguredPackage _ i _) -> i
......@@ -186,7 +184,7 @@ packageConstraints = either installedConstraints availableConstraints
preferAvailable (InstalledOnly pkg) = Left pkg
preferAvailable (AvailableOnly pkg) = Right pkg
preferAvailable (InstalledAndAvailable _ pkg) = Right pkg
installedConstraints (InstalledPackage _ _ deps) =
installedConstraints (InstalledPackageEx _ _ deps) =
[ TaggedDependency InstalledConstraint (thisPackageVersion dep)
| dep <- deps ]
availableConstraints (SemiConfiguredPackage _ _ deps) =
......@@ -234,7 +232,7 @@ topDownResolver = ((((((mapMessages .).).).).).) . topDownResolver'
-- | The native resolver with detailed structured logging and failure types.
--
topDownResolver' :: Platform -> CompilerId
-> PackageIndex InstalledPackageInfo
-> PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> (PackageName -> PackagePreferences)
-> [PackageConstraint]
......@@ -248,6 +246,7 @@ topDownResolver' platform comp installed available
where
configure = configurePackage platform comp
constraintSet :: Constraints
constraintSet = Constraints.empty
(annotateInstalledPackages topSortNumber installed')
(annotateAvailablePackages constraints topSortNumber available')
......@@ -310,13 +309,13 @@ configurePackage platform comp available spkg = case spkg of
-- and its topological sort number.
--
annotateInstalledPackages :: (PackageName -> TopologicalSortNumber)
-> PackageIndex InstalledPackageInfo
-> PackageIndex InstalledPackage
-> PackageIndex InstalledPackageEx
annotateInstalledPackages dfsNumber installed = PackageIndex.fromList
[ InstalledPackage pkg (dfsNumber (packageName pkg)) (transitiveDepends pkg)
[ InstalledPackageEx pkg (dfsNumber (packageName pkg)) (transitiveDepends pkg)
| pkg <- PackageIndex.allPackages installed ]
where
transitiveDepends :: InstalledPackageInfo -> [PackageIdentifier]
transitiveDepends :: InstalledPackage -> [PackageIdentifier]
transitiveDepends = map (packageId . toPkg) . tail . Graph.reachable graph
. fromJust . toVertex . packageId
(graph, toPkg, toVertex) = PackageIndex.dependencyGraph installed
......@@ -358,7 +357,7 @@ annotateAvailablePackages constraints dfsNumber available = PackageIndex.fromLis
-- edges and even cycles, but that doesn't really matter here, it's only a
-- heuristic.
--
topologicalSortNumbering :: PackageIndex InstalledPackageInfo
topologicalSortNumbering :: PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> (PackageName -> TopologicalSortNumber)
topologicalSortNumbering installed available =
......@@ -385,17 +384,17 @@ topologicalSortNumbering installed available =
-- each index that we could possibly ever need. Do this by flattening packages
-- and looking at the names of all possible dependencies.
--
selectNeededSubset :: PackageIndex InstalledPackageInfo
selectNeededSubset :: PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> Set PackageName
-> (PackageIndex InstalledPackageInfo
-> (PackageIndex InstalledPackage
,PackageIndex AvailablePackage)
selectNeededSubset installed available = select mempty mempty
where
select :: PackageIndex InstalledPackageInfo
select :: PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> Set PackageName
-> (PackageIndex InstalledPackageInfo
-> (PackageIndex InstalledPackage
,PackageIndex AvailablePackage)
select installed' available' remaining
| Set.null remaining = (installed', available')
......@@ -442,7 +441,7 @@ finaliseSelectedPackages pref selected constraints =
Just (InstalledOnly _) -> finaliseInstalled ipkg
Just (InstalledAndAvailable _ _) -> finaliseAvailable (Just ipkg) apkg
finaliseInstalled (InstalledPackage pkg _ _) = InstallPlan.PreExisting pkg
finaliseInstalled (InstalledPackageEx pkg _ _) = InstallPlan.PreExisting pkg
finaliseAvailable mipkg (SemiConfiguredPackage pkg flags deps) =
InstallPlan.Configured (ConfiguredPackage pkg flags deps')
where
......@@ -462,7 +461,7 @@ finaliseSelectedPackages pref selected constraints =
-- Is the package already used by the installed version of this
-- package? If so we should pick that first. This stops us from doing
-- silly things like deciding to rebuild haskell98 against base 3.
isCurrent = case mipkg :: Maybe InstalledPackage of
isCurrent = case mipkg :: Maybe InstalledPackageEx of
Nothing -> \_ -> False
Just ipkg -> \p -> packageId p `elem` depends ipkg
-- If there is no upper bound on the version range then we apply a
......@@ -494,7 +493,7 @@ finaliseSelectedPackages pref selected constraints =
-- This may add additional constraints due to the dependencies of installed
-- packages on other installed packages.
--
improvePlan :: PackageIndex InstalledPackageInfo
improvePlan :: PackageIndex InstalledPackage
-> Constraints
-> PackageIndex PlanPackage
-> (PackageIndex PlanPackage, Constraints)
......@@ -521,7 +520,7 @@ improvePlan installed constraints0 selected0 =
_ -> False
tryInstalled :: PackageIndex PlanPackage -> Constraints
-> [InstalledPackageInfo]
-> [InstalledPackage]
-> Maybe (PackageIndex PlanPackage, Constraints)
tryInstalled selected constraints [] = Just (selected, constraints)
tryInstalled selected constraints (pkg:pkgs) =
......
......@@ -22,8 +22,8 @@ module Distribution.Client.Dependency.TopDown.Constraints (
) where
import Distribution.Client.Dependency.TopDown.Types
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import Distribution.Package
( PackageName, PackageIdentifier(..)
, Package(packageId), packageName, packageVersion
......
......@@ -13,9 +13,8 @@
module Distribution.Client.Dependency.TopDown.Types where
import Distribution.Client.Types
( AvailablePackage(..) )
( AvailablePackage(..), InstalledPackage )
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import Distribution.Package
( PackageIdentifier, Dependency
, Package(packageId), PackageFixedDeps(depends) )
......@@ -27,10 +26,10 @@ import Distribution.PackageDescription
-- ------------------------------------------------------------
type SelectablePackage
= InstalledOrAvailable InstalledPackage UnconfiguredPackage
= InstalledOrAvailable InstalledPackageEx UnconfiguredPackage
type SelectedPackage
= InstalledOrAvailable InstalledPackage SemiConfiguredPackage
= InstalledOrAvailable InstalledPackageEx SemiConfiguredPackage
data InstalledOrAvailable installed available
= InstalledOnly installed
......@@ -39,11 +38,11 @@ data InstalledOrAvailable installed available
type TopologicalSortNumber = Int
data InstalledPackage
= InstalledPackage
InstalledPackageInfo
data InstalledPackageEx
= InstalledPackageEx
InstalledPackage
!TopologicalSortNumber
[PackageIdentifier]
[PackageIdentifier] -- transative closure of installed deps
data UnconfiguredPackage
= UnconfiguredPackage
......@@ -58,11 +57,11 @@ data SemiConfiguredPackage
[Dependency] -- dependencies we end up with when we apply
-- the flag assignment
instance Package InstalledPackage where
packageId (InstalledPackage p _ _) = packageId p
instance Package InstalledPackageEx where
packageId (InstalledPackageEx p _ _) = packageId p
instance PackageFixedDeps InstalledPackage where
depends (InstalledPackage _ _ deps) = deps
instance PackageFixedDeps InstalledPackageEx where
depends (InstalledPackageEx _ _ deps) = deps
instance Package UnconfiguredPackage where
packageId (UnconfiguredPackage p _ _) = packageId p
......
......@@ -22,14 +22,12 @@ module Distribution.Client.Dependency.Types (
) where
import Distribution.Client.Types
( AvailablePackage(..) )
( AvailablePackage(..), InstalledPackage )
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.PackageDescription
( FlagAssignment )
import Distribution.Simple.PackageIndex
import Distribution.Client.PackageIndex
( PackageIndex )
import Distribution.Package
( PackageName )
......@@ -52,7 +50,7 @@ import Prelude hiding (fail)
--
type DependencyResolver = Platform
-> CompilerId
-> PackageIndex InstalledPackageInfo
-> PackageIndex InstalledPackage
-> PackageIndex AvailablePackage
-> (PackageName -> PackagePreferences)
-> [PackageConstraint]
......
......@@ -33,7 +33,8 @@ import Distribution.Client.Dependency
import Distribution.Client.Dependency.Types
( foldProgress )
import Distribution.Client.IndexUtils as IndexUtils
( getAvailablePackages, disambiguateDependencies )
( getAvailablePackages, disambiguateDependencies
, getInstalledPackages )
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.HttpUtils (getHTTP, isOldHackageURI)
import Distribution.Client.Utils
......@@ -41,13 +42,11 @@ import Distribution.Client.Utils
import Distribution.Package
( PackageIdentifier, packageName, packageVersion, Dependency(..) )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Simple.Compiler
( Compiler(compilerId), PackageDBStack )
import Distribution.Simple.Program
( ProgramConfiguration )
import Distribution.Simple.Configure
( getInstalledPackages )
import Distribution.Simple.Utils
( die, notice, info, debug, setupMessage
, copyFileVerbose )
......
......@@ -28,15 +28,18 @@ import Distribution.Simple.Program (haddockProgram, ProgramConfiguration
import Distribution.Version (Version(Version), orLaterVersion)
import Distribution.Verbosity (Verbosity)
import Distribution.Text (display)
import Distribution.Simple.PackageIndex(PackageIndex, allPackages,
import Distribution.Client.PackageIndex(PackageIndex, allPackages,
allPackagesByName, fromList)
import Distribution.Simple.Utils
( comparing, intercalate, debug
, installDirectoryContents, withTempDirectory )
import Distribution.InstalledPackageInfo as InstalledPackageInfo
(InstalledPackageInfo,InstalledPackageInfo_(haddockHTMLs, haddockInterfaces, exposed, package))
( InstalledPackageInfo
, InstalledPackageInfo_(haddockHTMLs, haddockInterfaces, exposed) )
import Distribution.Client.Types
( InstalledPackage(..) )
regenerateHaddockIndex :: Verbosity -> PackageIndex InstalledPackageInfo -> ProgramConfiguration -> FilePath -> IO ()
regenerateHaddockIndex :: Verbosity -> PackageIndex InstalledPackage -> ProgramConfiguration -> FilePath -> IO ()
regenerateHaddockIndex verbosity pkgs conf index = do
(paths,warns) <- haddockPackagePaths pkgs'
case warns of
......@@ -63,10 +66,11 @@ regenerateHaddockIndex verbosity pkgs conf index = do
. allPackagesByName
. fromList
. filter exposed
. map (\(InstalledPackage pkg _) -> pkg)
. allPackages
$ pkgs
haddockPackagePaths :: [InstalledPackageInfo_ m]
haddockPackagePaths :: [InstalledPackageInfo]
-> IO ([(FilePath, FilePath)], Maybe [Char])
haddockPackagePaths pkgs = do
interfaces <- sequence
......@@ -77,7 +81,7 @@ haddockPackagePaths pkgs = do
then return (pkgid, Just (interface, html))
else return (pkgid, Nothing)
Nothing -> return (pkgid, Nothing)
| pkg <- pkgs, let pkgid = InstalledPackageInfo.package pkg ]
| pkg <- pkgs, let pkgid = packageId pkg ]
let missing = [ pkgid | (pkgid, Nothing) <- interfaces ]
......
......@@ -11,6 +11,7 @@
-- Extra utils related to the package indexes.
-----------------------------------------------------------------------------
module Distribution.Client.IndexUtils (
getInstalledPackages,
getAvailablePackages,
readPackageIndexFile,
......@@ -24,21 +25,29 @@ import qualified Distribution.Client.Tar as Tar
import Distribution.Client.Types
( UnresolvedDependency(..), AvailablePackage(..)
, AvailablePackageSource(..), Repo(..), RemoteRepo(..)
, AvailablePackageDb(..) )
, AvailablePackageDb(..), InstalledPackage(..) )
import Distribution.Package
( PackageId, PackageIdentifier(..), PackageName(..), Package(..)
, Dependency(Dependency) )
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Simple.PackageIndex as PackageIndex
, Dependency(Dependency), InstalledPackageId(..) )
import Distribution.Client.PackageIndex (PackageIndex)
import qualified Distribution.Client.PackageIndex as PackageIndex
import qualified Distribution.Simple.PackageIndex as InstalledPackageIndex
import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
import Distribution.PackageDescription
( GenericPackageDescription )
import Distribution.PackageDescription.Parse
( parsePackageDescription )
import Distribution.Simple.Compiler
( Compiler, PackageDBStack )
import Distribution.Simple.Program
( ProgramConfiguration )
import qualified Distribution.Simple.Configure as Configure
( getInstalledPackages )
import Distribution.ParseUtils
( ParseResult(..) )
import Distribution.Version
( intersectVersionRanges )
( Version(Version), intersectVersionRanges )
import Distribution.Text
( display, simpleParse )
import Distribution.Verbosity (Verbosity)
......@@ -63,6 +72,40 @@ import System.Directory
import System.Time
( getClockTime, diffClockTimes, normalizeTimeDiff, TimeDiff(tdDay) )
getInstalledPackages :: Verbosity -> Compiler
-> PackageDBStack -> ProgramConfiguration
-> IO (Maybe (PackageIndex InstalledPackage))
getInstalledPackages verbosity comp packageDbs conf =
fmap (fmap convert)
(Configure.getInstalledPackages verbosity comp packageDbs conf)
where
convert :: InstalledPackageIndex.PackageIndex -> PackageIndex InstalledPackage
convert index = PackageIndex.fromList $
reverse -- because later ones mask earlier ones, but
-- InstalledPackageIndex.allPackages gives us the most preferred
-- instances first, when packages share a package id, like when
-- the same package is installed in the global & user dbs.
[ InstalledPackage ipkg (sourceDeps index ipkg)
| ipkg <- InstalledPackageIndex.allPackages index ]
-- The InstalledPackageInfo only lists dependencies by the
-- InstalledPackageId, which means we do not directly know the corresponding
-- source dependency. The only way to find out is to lookup the
-- InstalledPackageId to get the InstalledPackageInfo and look at its
-- source PackageId. But if the package is broken because it depends on
-- other packages that do not exist then we have a problem we cannot find
-- the original source package id. Instead we make up a bogus package id.
-- This should have the same effect since it should be a dependency on a
-- non-existant package.
sourceDeps index ipkg =
[ maybe (brokenPackageId depid) packageId mdep
| let depids = InstalledPackageInfo.depends ipkg
getpkg = InstalledPackageIndex.lookupInstalledPackageId index
, (depid, mdep) <- zip depids (map getpkg depids) ]
brokenPackageId (InstalledPackageId str) =
PackageIdentifier (PackageName (str ++ "-broken")) (Version [] [])
-- | Read a repository index from disk, from the local files specified by
-- a list of 'Repo's.
--
......
......@@ -44,7 +44,8 @@ import Distribution.Client.Fetch (fetchPackage)
import qualified Distribution.Client.Haddock as Haddock (regenerateHaddockIndex)
-- import qualified Distribution.Client.Info as Info
import Distribution.Client.IndexUtils as IndexUtils
( getAvailablePackages, disambiguateDependencies )
( getAvailablePackages, disambiguateDependencies
, getInstalledPackages )
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.InstallPlan (InstallPlan)
import Distribution.Client.Setup
......@@ -58,7 +59,8 @@ import Distribution.Client.Types as Available
, AvailablePackageSource(..), AvailablePackageDb(..)
, Repo(..), ConfiguredPackage(..)
, BuildResult, BuildFailure(..), BuildSuccess(..)
, DocsResult(..), TestsResult(..), RemoteRepo(..) )
, DocsResult(..), TestsResult(..), RemoteRepo(..)
, InstalledPackage )
import Distribution.Client.BuildReports.Types
( ReportLevel(..) )
import Distribution.Client.SetupWrapper
......@@ -75,10 +77,9 @@ import Distribution.Simple.Compiler
( CompilerId(..), Compiler(compilerId), compilerFlavor
, PackageDB(..), PackageDBStack )
import Distribution.Simple.Program (ProgramConfiguration, defaultProgramConfiguration)
import Distribution.Simple.Configure (getInstalledPackages)
import qualified Distribution.Simple.InstallDirs as InstallDirs
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import qualified Distribution.Client.PackageIndex as PackageIndex
import Distribution.Client.PackageIndex (PackageIndex)
import Distribution.Simple.Setup
( haddockCommand, HaddockFlags(..), emptyHaddockFlags
, buildCommand, BuildFlags(..), emptyBuildFlags
......@@ -101,8 +102,6 @@ import Distribution.PackageDescription.Parse
( readPackageDescription )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Version
( Version, VersionRange, anyVersion, thisVersion )
import Distribution.Simple.Utils as Utils
......@@ -160,7 +159,7 @@ upgrade verbosity packageDB repos comp conf
| otherwise = planRepoPackages PreferAllLatest
comp configFlags configExFlags installFlags deps
type Planner = Maybe (PackageIndex InstalledPackageInfo)
type Planner = Maybe (PackageIndex InstalledPackage)
-> AvailablePackageDb
-> IO (Progress String String InstallPlan)
......@@ -460,7 +459,7 @@ mergePackagePrefs defaultPref availablePrefs configExFlags =
++ [ PackageVersionPreference name ver
| Dependency name ver <- configPreferences configExFlags ]
printDryRun :: Verbosity -> Maybe (PackageIndex InstalledPackageInfo)
printDryRun :: Verbosity -> Maybe (PackageIndex InstalledPackage)
-> InstallPlan -> IO ()
printDryRun verbosity minstalled plan = case unfoldr next plan of
[] -> return ()
......@@ -724,7 +723,7 @@ withWin32SelfUpgrade _ _ _ _ action | buildOS /= Windows = action
withWin32SelfUpgrade verbosity configFlags compid pkg action = do
defaultDirs <- InstallDirs.defaultInstallDirs
compilerFlavor
compFlavor
(fromFlag (configUserInstall configFlags))
(PackageDescription.hasLibs pkg)
......@@ -733,7 +732,7 @@ withWin32SelfUpgrade verbosity configFlags compid pkg action = do
where
pkgid = packageId pkg
(CompilerId compilerFlavor _) = compid
(CompilerId compFlavor _) = compid
exeInstallPaths defaultDirs =
[ InstallDirs.bindir absoluteDirs </> exeName <.> exeExtension
......