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