Commit 0f2087d2 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Switch install to use resolveDependenciesWithProgress

And show progress messages at verbosity level 2.
parent 25d7929a
......@@ -29,7 +29,6 @@ import Hackage.Types
import Hackage.Dependency (resolveDependencies)
import qualified Hackage.IndexUtils as IndexUtils
import qualified Hackage.InstallPlan as InstallPlan
import Hackage.Utils (showDependencies)
import Hackage.HttpUtils (getHTTP)
import Distribution.Package
......
......@@ -26,7 +26,8 @@ import System.Directory
( getTemporaryDirectory, doesFileExist )
import System.FilePath ((</>),(<.>))
import Hackage.Dependency (resolveDependencies, upgradableDependencies)
import Hackage.Dependency (resolveDependenciesWithProgress, upgradableDependencies)
import Hackage.Dependency.Types (Progress(..), foldProgress)
import Hackage.Fetch (fetchPackage)
-- import qualified Hackage.Info as Info
import qualified Hackage.IndexUtils as IndexUtils
......@@ -112,7 +113,7 @@ upgrade verbosity packageDB repos comp =
type Planner = Maybe (PackageIndex InstalledPackageInfo)
-> PackageIndex AvailablePackage
-> IO (Either String (InstallPlan BuildResult))
-> IO (Progress String String (InstallPlan BuildResult))
-- |Installs the packages generated by a planner.
installWithPlanner ::
......@@ -129,9 +130,11 @@ installWithPlanner planner verbosity packageDB repos comp conf configFlags insta
installed <- getInstalledPackages verbosity comp packageDB conf
available <- fmap mconcat (mapM (IndexUtils.readRepoIndex verbosity) repos)
maybePlan <- planner installed available
progress <- planner installed available
info verbosity "Resolving dependencies..."
maybePlan <- foldProgress (\message rest -> info verbosity message >> rest)
(return . Left) (return . Right) progress
case maybePlan of
Left message -> die message
Right installPlan -> do
......@@ -188,7 +191,7 @@ planLocalPackage verbosity comp configFlags installed available = do
depFlags = Cabal.configConfigurationsFlags configFlags
}
return $ resolveDependencies buildOS buildArch (compilerId comp)
return $ resolveDependenciesWithProgress buildOS buildArch (compilerId comp)
installed' available' [localPkgDep]
-- | Make an 'InstallPlan' for the given dependencies.
......@@ -196,12 +199,12 @@ planLocalPackage verbosity comp configFlags installed available = do
planRepoPackages :: Compiler -> [UnresolvedDependency] -> Planner
planRepoPackages comp deps installed available = do
deps' <- IndexUtils.disambiguateDependencies available deps
return $ resolveDependencies buildOS buildArch (compilerId comp)
return $ resolveDependenciesWithProgress buildOS buildArch (compilerId comp)
installed available deps'
planUpgradePackages :: Compiler -> Planner
planUpgradePackages comp (Just installed) available = return $
resolveDependencies buildOS buildArch (compilerId comp) (Just installed) available
resolveDependenciesWithProgress buildOS buildArch (compilerId comp) (Just installed) available
[ UnresolvedDependency dep []
| dep <- upgradableDependencies installed available ]
planUpgradePackages comp _ _ =
......
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