Commit e9ec08c5 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Fixups for recent cabal api changes

parent 397985f7
...@@ -19,6 +19,7 @@ import Network.Hackage.CabalInstall.Types (ConfigFlags (..), UnresolvedDependenc ...@@ -19,6 +19,7 @@ import Network.Hackage.CabalInstall.Types (ConfigFlags (..), UnresolvedDependenc
import Distribution.PackageDescription (readPackageDescription, buildDepends, import Distribution.PackageDescription (readPackageDescription, buildDepends,
GenericPackageDescription(..)) GenericPackageDescription(..))
import Distribution.Simple.Configure (getInstalledPackages) import Distribution.Simple.Configure (getInstalledPackages)
import Distribution.Simple.Compiler (PackageDB(..))
{-| {-|
This function behaves exactly like 'Network.Hackage.CabalInstall.Install.install' except This function behaves exactly like 'Network.Hackage.CabalInstall.Install.install' except
...@@ -26,8 +27,13 @@ import Distribution.Simple.Configure (getInstalledPackages) ...@@ -26,8 +27,13 @@ import Distribution.Simple.Configure (getInstalledPackages)
-} -}
buildDep :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO () buildDep :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO ()
buildDep cfg globalArgs deps buildDep cfg globalArgs deps
= do ipkgs <- getInstalledPackages (configCompiler cfg) (configUserIns cfg) (configVerbose cfg) = do Just ipkgs <- getInstalledPackages
apkgs <- fmap getPackages (fmap (getBuildDeps ipkgs) (resolveDependenciesAux cfg ipkgs deps)) (configVerbose cfg) (configCompiler cfg)
(if configUserIns cfg then UserPackageDB
else GlobalPackageDB)
(configPrograms cfg)
apkgs <- fmap getPackages (fmap (getBuildDeps ipkgs)
(resolveDependenciesAux cfg ipkgs deps))
mapM_ (installPkg cfg globalArgs) apkgs mapM_ (installPkg cfg globalArgs) apkgs
-- | Takes the path to a .cabal file, and installs the build-dependencies listed there. -- | Takes the path to a .cabal file, and installs the build-dependencies listed there.
......
...@@ -132,6 +132,7 @@ mkConfigFlags cfg ...@@ -132,6 +132,7 @@ mkConfigFlags cfg
outputGen <- defaultOutputGen (tempVerbose cfg) outputGen <- defaultOutputGen (tempVerbose cfg)
let config = ConfigFlags let config = ConfigFlags
{ configCompiler = comp { configCompiler = comp
, configPrograms = conf'''
, configConfDir = confDir , configConfDir = confDir
, configCacheDir = cacheDir , configCacheDir = cacheDir
, configPkgListDir = pkgListDir , configPkgListDir = pkgListDir
......
...@@ -19,12 +19,17 @@ import Network.Hackage.CabalInstall.Types (ConfigFlags(..), ResolvedPackage(..) ...@@ -19,12 +19,17 @@ import Network.Hackage.CabalInstall.Types (ConfigFlags(..), ResolvedPackage(..)
import Distribution.Package (PackageIdentifier) import Distribution.Package (PackageIdentifier)
import Distribution.Simple.Configure (getInstalledPackages) import Distribution.Simple.Configure (getInstalledPackages)
import Distribution.Simple.Compiler (PackageDB(..))
import Data.Maybe (listToMaybe) import Data.Maybe (listToMaybe)
info :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO () info :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO ()
info cfg globalArgs deps info cfg globalArgs deps
= do ipkgs <- getInstalledPackages (configCompiler cfg) (configUserIns cfg) (configVerbose cfg) = do Just ipkgs <- getInstalledPackages
(configVerbose cfg) (configCompiler cfg)
(if configUserIns cfg then UserPackageDB
else GlobalPackageDB)
(configPrograms cfg)
apkgs <- resolveDependencies cfg [] deps apkgs <- resolveDependencies cfg [] deps
mapM_ (infoPkg cfg ipkgs globalArgs) apkgs mapM_ (infoPkg cfg ipkgs globalArgs) apkgs
......
...@@ -28,6 +28,7 @@ import Network.Hackage.CabalInstall.TarUtils ...@@ -28,6 +28,7 @@ import Network.Hackage.CabalInstall.TarUtils
import Distribution.Simple.SetupWrapper (setupWrapper) import Distribution.Simple.SetupWrapper (setupWrapper)
import Distribution.Simple.Configure (getInstalledPackages) import Distribution.Simple.Configure (getInstalledPackages)
import Distribution.Simple.Compiler (PackageDB(..))
import Distribution.Package (showPackageId, PackageIdentifier) import Distribution.Package (showPackageId, PackageIdentifier)
import Distribution.Verbosity import Distribution.Verbosity
import System.FilePath ((</>), splitFileName) import System.FilePath ((</>), splitFileName)
...@@ -44,7 +45,11 @@ import System.Posix.Signals ...@@ -44,7 +45,11 @@ import System.Posix.Signals
-- |Installs the packages needed to satisfy a list of dependencies. -- |Installs the packages needed to satisfy a list of dependencies.
install :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO () install :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO ()
install cfg globalArgs deps install cfg globalArgs deps
= do ipkgs <- getInstalledPackages (configCompiler cfg) (configUserIns cfg) (configVerbose cfg) = do Just ipkgs <- getInstalledPackages
(configVerbose cfg) (configCompiler cfg)
(if configUserIns cfg then UserPackageDB
else GlobalPackageDB)
(configPrograms cfg)
resolvedDeps <- resolveDependencies cfg ipkgs deps resolvedDeps <- resolveDependencies cfg ipkgs deps
let apkgs = getPackages resolvedDeps let apkgs = getPackages resolvedDeps
if null apkgs if null apkgs
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
module Network.Hackage.CabalInstall.Types where module Network.Hackage.CabalInstall.Types where
import Distribution.Simple.Compiler (CompilerFlavor(..),Compiler) import Distribution.Simple.Compiler (CompilerFlavor(..),Compiler)
import Distribution.Simple.Program (ProgramConfiguration)
import Distribution.Package (PackageIdentifier) import Distribution.Package (PackageIdentifier)
import Distribution.Version (Dependency) import Distribution.Version (Dependency)
import Distribution.Verbosity import Distribution.Verbosity
...@@ -57,6 +58,7 @@ data TempFlags = TempFlags { ...@@ -57,6 +58,7 @@ data TempFlags = TempFlags {
data ConfigFlags = ConfigFlags { data ConfigFlags = ConfigFlags {
configCompiler :: Compiler, configCompiler :: Compiler,
configPrograms :: ProgramConfiguration,
configConfDir :: FilePath, configConfDir :: FilePath,
configCacheDir :: FilePath, configCacheDir :: FilePath,
configPkgListDir :: FilePath, configPkgListDir :: FilePath,
......
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