Commit be5eadab authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

s/ProgramConfiguration/ProgramDb/

parent 755d059d
......@@ -377,7 +377,7 @@ configure (pkg_descr0', pbi) cfg = do
-- building with
(comp :: Compiler,
compPlatform :: Platform,
programsConfig :: ProgramConfiguration)
programsConfig :: ProgramDb)
<- configCompilerEx
(flagToMaybe (configHcFlavor cfg))
(flagToMaybe (configHcPath cfg))
......@@ -777,7 +777,7 @@ configure (pkg_descr0', pbi) cfg = do
where
verbosity = fromFlag (configVerbosity cfg)
mkProgramsConfig :: ConfigFlags -> ProgramConfiguration -> ProgramConfiguration
mkProgramsConfig :: ConfigFlags -> ProgramDb -> ProgramDb
mkProgramsConfig cfg initialProgramsConfig = programsConfig
where
programsConfig = userSpecifyArgss (configProgramArgs cfg)
......@@ -1239,7 +1239,7 @@ reportFailedDependencies failed =
-- | List all installed packages in the given package databases.
getInstalledPackages :: Verbosity -> Compiler
-> PackageDBStack -- ^ The stack of package databases.
-> ProgramConfiguration
-> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity comp packageDBs progconf = do
when (null packageDBs) $
......@@ -1266,7 +1266,7 @@ getInstalledPackages verbosity comp packageDBs progconf = do
-- on the package database stack in question. However, when sandboxes
-- are involved these sanity checks are not desirable.
getPackageDBContents :: Verbosity -> Compiler
-> PackageDB -> ProgramConfiguration
-> PackageDB -> ProgramDb
-> IO InstalledPackageIndex
getPackageDBContents verbosity comp packageDB progconf = do
info verbosity "Reading installed packages..."
......@@ -1282,7 +1282,7 @@ getPackageDBContents verbosity comp packageDB progconf = do
--
getInstalledPackagesMonitorFiles :: Verbosity -> Compiler
-> PackageDBStack
-> ProgramConfiguration -> Platform
-> ProgramDb -> Platform
-> IO [FilePath]
getInstalledPackagesMonitorFiles verbosity comp packageDBs progconf platform =
case compilerFlavor comp of
......@@ -1383,13 +1383,13 @@ combinedConstraints constraints dependencies installedPackages = do
-- -----------------------------------------------------------------------------
-- Configuring program dependencies
configureRequiredPrograms :: Verbosity -> [Dependency] -> ProgramConfiguration
-> IO ProgramConfiguration
configureRequiredPrograms :: Verbosity -> [Dependency] -> ProgramDb
-> IO ProgramDb
configureRequiredPrograms verbosity deps conf =
foldM (configureRequiredProgram verbosity) conf deps
configureRequiredProgram :: Verbosity -> ProgramConfiguration -> Dependency
-> IO ProgramConfiguration
configureRequiredProgram :: Verbosity -> ProgramDb -> Dependency
-> IO ProgramDb
configureRequiredProgram verbosity conf
(Dependency (PackageName progName) verRange) =
case lookupKnownProgram progName conf of
......@@ -1411,8 +1411,8 @@ configureRequiredProgram verbosity conf
-- Configuring pkg-config package dependencies
configurePkgconfigPackages :: Verbosity -> PackageDescription
-> ProgramConfiguration
-> IO (PackageDescription, ProgramConfiguration)
-> ProgramDb
-> IO (PackageDescription, ProgramDb)
configurePkgconfigPackages verbosity pkg_descr conf
| null allpkgs = return (pkg_descr, conf)
| otherwise = do
......@@ -1514,7 +1514,7 @@ ccLdOptionsBuildInfo cflags ldflags =
-- Determining the compiler details
configCompilerAuxEx :: ConfigFlags
-> IO (Compiler, Platform, ProgramConfiguration)
-> IO (Compiler, Platform, ProgramDb)
configCompilerAuxEx cfg = configCompilerEx (flagToMaybe $ configHcFlavor cfg)
(flagToMaybe $ configHcPath cfg)
(flagToMaybe $ configHcPkg cfg)
......@@ -1524,8 +1524,8 @@ configCompilerAuxEx cfg = configCompilerEx (flagToMaybe $ configHcFlavor cfg)
programsConfig = mkProgramsConfig cfg defaultProgramConfiguration
configCompilerEx :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> Verbosity
-> IO (Compiler, Platform, ProgramConfiguration)
-> ProgramDb -> Verbosity
-> IO (Compiler, Platform, ProgramDb)
configCompilerEx Nothing _ _ _ _ = die "Unknown compiler"
configCompilerEx (Just hcFlavor) hcPath hcPkg conf verbosity = do
(comp, maybePlatform, programsConfig) <- case hcFlavor of
......@@ -1547,15 +1547,15 @@ configCompilerEx (Just hcFlavor) hcPath hcPkg conf verbosity = do
{-# DEPRECATED configCompiler
"'configCompiler' is deprecated. Use 'configCompilerEx' instead." #-}
configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> Verbosity
-> IO (Compiler, ProgramConfiguration)
-> ProgramDb -> Verbosity
-> IO (Compiler, ProgramDb)
configCompiler mFlavor hcPath hcPkg conf verbosity =
fmap (\(a,_,b) -> (a,b)) $ configCompilerEx mFlavor hcPath hcPkg conf verbosity
{-# DEPRECATED configCompilerAux
"configCompilerAux is deprecated. Use 'configCompilerAuxEx' instead." #-}
configCompilerAux :: ConfigFlags
-> IO (Compiler, ProgramConfiguration)
-> IO (Compiler, ProgramDb)
configCompilerAux = fmap (\(a,_,b) -> (a,b)) . configCompilerAuxEx
-- -----------------------------------------------------------------------------
......
......@@ -101,8 +101,8 @@ import qualified System.Info
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration
-> IO (Compiler, Maybe Platform, ProgramConfiguration)
-> ProgramDb
-> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath hcPkgPath conf0 = do
(ghcProg, ghcVersion, conf1) <-
......@@ -273,7 +273,7 @@ getGhcInfo verbosity ghcProg = Internal.getGhcInfo verbosity implInfo ghcProg
implInfo = ghcVersionImplInfo version
-- | Given a single package DB, return all installed packages.
getPackageDBContents :: Verbosity -> PackageDB -> ProgramConfiguration
getPackageDBContents :: Verbosity -> PackageDB -> ProgramDb
-> IO InstalledPackageIndex
getPackageDBContents verbosity packagedb conf = do
pkgss <- getInstalledPackages' verbosity [packagedb] conf
......@@ -281,7 +281,7 @@ getPackageDBContents verbosity packagedb conf = do
-- | Given a package DB stack, return all installed packages.
getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack
-> ProgramConfiguration
-> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity comp packagedbs conf = do
checkPackageDbStack comp packagedbs
......@@ -305,7 +305,7 @@ getInstalledPackages verbosity comp packagedbs conf = do
-- 'getInstalledPackages'.
toPackageIndex :: Verbosity
-> [(PackageDB, [InstalledPackageInfo])]
-> ProgramConfiguration
-> ProgramDb
-> IO InstalledPackageIndex
toPackageIndex verbosity pkgss conf = do
-- On Windows, various fields have $topdir/foo rather than full
......@@ -392,7 +392,7 @@ removeMingwIncludeDir pkg =
-- | Get the packages from specific PackageDBs, not cumulative.
--
getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramConfiguration
getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramDb
-> IO [(PackageDB, [InstalledPackageInfo])]
getInstalledPackages' verbosity packagedbs conf
| ghcVersion >= Version [6,9] [] =
......@@ -436,7 +436,7 @@ getInstalledPackages' verbosity packagedbs conf = do
failToRead file = die $ "cannot read ghc package database " ++ file
getInstalledPackagesMonitorFiles :: Verbosity -> Platform
-> ProgramConfiguration
-> ProgramDb
-> [PackageDB]
-> IO [FilePath]
getInstalledPackagesMonitorFiles verbosity platform progdb =
......@@ -753,7 +753,7 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
runGhcProg ghcSharedLinkArgs
-- | Start a REPL without loading any source files.
startInterpreter :: Verbosity -> ProgramConfiguration -> Compiler -> Platform
startInterpreter :: Verbosity -> ProgramDb -> Compiler -> Platform
-> PackageDBStack -> IO ()
startInterpreter verbosity conf comp platform packageDBs = do
let replOpts = mempty {
......@@ -1188,7 +1188,7 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir _pkg lib clbi = do
-- -----------------------------------------------------------------------------
-- Registering
hcPkgInfo :: ProgramConfiguration -> HcPkg.HcPkgInfo
hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg
, HcPkg.noPkgDbStack = v < [6,9]
, HcPkg.noVerboseFlag = v < [6,11]
......@@ -1205,7 +1205,7 @@ hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg
registerPackage
:: Verbosity
-> ProgramConfiguration
-> ProgramDb
-> HcPkg.MultiInstance
-> PackageDBStack
-> InstalledPackageInfo
......
......@@ -71,8 +71,8 @@ targetPlatform ghcInfo = platformFromTriple =<< lookup "Target platform" ghcInfo
configureToolchain :: GhcImplInfo
-> ConfiguredProgram
-> Map String String
-> ProgramConfiguration
-> ProgramConfiguration
-> ProgramDb
-> ProgramDb
configureToolchain _implInfo ghcProg ghcInfo =
addKnownProgram gccProgram {
programFindLocation = findProg gccProgramName extraGccPath,
......
......@@ -53,24 +53,24 @@ import System.FilePath ( (</>), (<.>), takeExtension
import Distribution.Compat.Environment ( lookupEnv )
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration
-> IO (Compiler, Maybe Platform, ProgramConfiguration)
configure verbosity hcPath hcPkgPath conf0 = do
(ghcjsProg, ghcjsVersion, conf1) <-
-> ProgramDb
-> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath hcPkgPath progdb0 = do
(ghcjsProg, ghcjsVersion, progdb1) <-
requireProgramVersion verbosity ghcjsProgram
(orLaterVersion (Version [0,1] []))
(userMaybeSpecifyPath "ghcjs" hcPath conf0)
(userMaybeSpecifyPath "ghcjs" hcPath progdb0)
Just ghcjsGhcVersion <- findGhcjsGhcVersion verbosity (programPath ghcjsProg)
let implInfo = ghcjsVersionImplInfo ghcjsVersion ghcjsGhcVersion
-- This is slightly tricky, we have to configure ghcjs first, then we use the
-- location of ghcjs to help find ghcjs-pkg in the case that the user did not
-- specify the location of ghc-pkg directly:
(ghcjsPkgProg, ghcjsPkgVersion, conf2) <-
(ghcjsPkgProg, ghcjsPkgVersion, progdb2) <-
requireProgramVersion verbosity ghcjsPkgProgram {
programFindLocation = guessGhcjsPkgFromGhcjsPath ghcjsProg
}
anyVersion (userMaybeSpecifyPath "ghcjs-pkg" hcPkgPath conf1)
anyVersion (userMaybeSpecifyPath "ghcjs-pkg" hcPkgPath progdb1)
Just ghcjsPkgGhcjsVersion <- findGhcjsPkgGhcjsVersion
verbosity (programPath ghcjsPkgProg)
......@@ -98,7 +98,7 @@ configure verbosity hcPath hcPkgPath conf0 = do
haddockProgram' =
haddockProgram { programFindLocation =
guessHaddockFromGhcjsPath ghcjsProg }
conf3 = addKnownPrograms [ hsc2hsProgram', c2hsProgram', haddockProgram' ] conf2
progdb3 = addKnownPrograms [ hsc2hsProgram', c2hsProgram', haddockProgram' ] progdb2
languages <- Internal.getLanguages verbosity implInfo ghcjsProg
extensions <- Internal.getExtensions verbosity implInfo ghcjsProg
......@@ -117,11 +117,11 @@ configure verbosity hcPath hcPkgPath conf0 = do
}
compPlatform = Internal.targetPlatform ghcInfo
-- configure gcc and ld
let conf4 = if ghcjsNativeToo comp
let progdb4 = if ghcjsNativeToo comp
then Internal.configureToolchain implInfo
ghcjsProg ghcInfoMap conf3
else conf3
return (comp, compPlatform, conf4)
ghcjsProg ghcInfoMap progdb3
else progdb3
return (comp, compPlatform, progdb4)
ghcjsNativeToo :: Compiler -> Bool
ghcjsNativeToo = Internal.ghcLookupProperty "Native Too"
......@@ -179,29 +179,29 @@ guessToolFromGhcjsPath tool ghcjsProg verbosity searchpath
reverse
-- | Given a single package DB, return all installed packages.
getPackageDBContents :: Verbosity -> PackageDB -> ProgramConfiguration
getPackageDBContents :: Verbosity -> PackageDB -> ProgramDb
-> IO InstalledPackageIndex
getPackageDBContents verbosity packagedb conf = do
pkgss <- getInstalledPackages' verbosity [packagedb] conf
toPackageIndex verbosity pkgss conf
getPackageDBContents verbosity packagedb progdb = do
pkgss <- getInstalledPackages' verbosity [packagedb] progdb
toPackageIndex verbosity pkgss progdb
-- | Given a package DB stack, return all installed packages.
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf = do
getInstalledPackages verbosity packagedbs progdb = do
checkPackageDbStack packagedbs
envPackageDBs <- maybe []
(map SpecificPackageDB . unintersperse searchPathSeparator)
<$> lookupEnv "GHCJS_PACKAGE_PATH"
pkgss <- getInstalledPackages' verbosity (envPackageDBs ++ packagedbs) conf
index <- toPackageIndex verbosity pkgss conf
pkgss <- getInstalledPackages' verbosity (envPackageDBs ++ packagedbs) progdb
index <- toPackageIndex verbosity pkgss progdb
return $! index
toPackageIndex :: Verbosity
-> [(PackageDB, [InstalledPackageInfo])]
-> ProgramConfiguration
-> ProgramDb
-> IO InstalledPackageIndex
toPackageIndex verbosity pkgss conf = do
toPackageIndex verbosity pkgss progdb = do
-- On Windows, various fields have $topdir/foo rather than full
-- paths. We need to substitute the right value in so that when
-- we, for example, call gcc, we have proper paths to give it.
......@@ -211,7 +211,7 @@ toPackageIndex verbosity pkgss conf = do
return $! (mconcat indices)
where
Just ghcjsProg = lookupProgram ghcjsProgram conf
Just ghcjsProg = lookupProgram ghcjsProgram progdb
checkPackageDbStack :: PackageDBStack -> IO ()
checkPackageDbStack (GlobalPackageDB:rest)
......@@ -225,11 +225,11 @@ checkPackageDbStack _ =
die $ "If the global package db is specified, it must be "
++ "specified first and cannot be specified multiple times"
getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramConfiguration
getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramDb
-> IO [(PackageDB, [InstalledPackageInfo])]
getInstalledPackages' verbosity packagedbs conf =
getInstalledPackages' verbosity packagedbs progdb =
sequenceA
[ do pkgs <- HcPkg.dump (hcPkgInfo conf) verbosity packagedb
[ do pkgs <- HcPkg.dump (hcPkgInfo progdb) verbosity packagedb
return (packagedb, pkgs)
| packagedb <- packagedbs ]
......@@ -489,15 +489,15 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
runGhcjsProg ghcSharedLinkArgs
-- | Start a REPL without loading any source files.
startInterpreter :: Verbosity -> ProgramConfiguration -> Compiler -> Platform
startInterpreter :: Verbosity -> ProgramDb -> Compiler -> Platform
-> PackageDBStack -> IO ()
startInterpreter verbosity conf comp platform packageDBs = do
startInterpreter verbosity progdb comp platform packageDBs = do
let replOpts = mempty {
ghcOptMode = toFlag GhcModeInteractive,
ghcOptPackageDBs = packageDBs
}
checkPackageDbStack packageDBs
(ghcjsProg, _) <- requireProgram verbosity ghcjsProgram conf
(ghcjsProg, _) <- requireProgram verbosity ghcjsProgram progdb
runGHC verbosity ghcjsProg comp platform replOpts
buildExe, replExe :: Verbosity -> Cabal.Flag (Maybe Int)
......@@ -799,7 +799,7 @@ adjustExts hiSuf objSuf opts =
}
registerPackage :: Verbosity
-> ProgramConfiguration
-> ProgramDb
-> HcPkg.MultiInstance
-> PackageDBStack
-> InstalledPackageInfo
......@@ -847,31 +847,31 @@ findGhcjsPkgGhcjsVersion verbosity pgm =
-- -----------------------------------------------------------------------------
-- Registering
hcPkgInfo :: ProgramConfiguration -> HcPkg.HcPkgInfo
hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcjsPkgProg
, HcPkg.noPkgDbStack = False
, HcPkg.noVerboseFlag = False
, HcPkg.flagPackageConf = False
, HcPkg.supportsDirDbs = True
, HcPkg.requiresDirDbs = v >= [7,10]
, HcPkg.nativeMultiInstance = v >= [7,10]
, HcPkg.recacheMultiInstance = True
}
hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
hcPkgInfo progdb = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcjsPkgProg
, HcPkg.noPkgDbStack = False
, HcPkg.noVerboseFlag = False
, HcPkg.flagPackageConf = False
, HcPkg.supportsDirDbs = True
, HcPkg.requiresDirDbs = v >= [7,10]
, HcPkg.nativeMultiInstance = v >= [7,10]
, HcPkg.recacheMultiInstance = True
}
where
v = versionBranch ver
Just ghcjsPkgProg = lookupProgram ghcjsPkgProgram conf
Just ghcjsPkgProg = lookupProgram ghcjsPkgProgram progdb
Just ver = programVersion ghcjsPkgProg
-- | Get the JavaScript file name and command and arguments to run a
-- program compiled by GHCJS
-- the exe should be the base program name without exe extension
runCmd :: ProgramConfiguration -> FilePath
runCmd :: ProgramDb -> FilePath
-> (FilePath, FilePath, [String])
runCmd conf exe =
runCmd progdb exe =
( script
, programPath ghcjsProg
, programDefaultArgs ghcjsProg ++ programOverrideArgs ghcjsProg ++ ["--run"]
)
where
script = exe <.> "jsexe" </> "all" <.> "js"
Just ghcjsProg = lookupProgram ghcjsProgram conf
Just ghcjsProg = lookupProgram ghcjsProgram progdb
......@@ -24,7 +24,7 @@ import Distribution.Simple.Program.Builtin
configure
:: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
-> ProgramDb -> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity mbHcPath hcPkgPath conf0 = do
-- We have no idea how a haskell-suite tool is named, so we require at
......@@ -117,7 +117,7 @@ getLanguages verbosity prog = do
-- Other compilers do some kind of a packagedb stack check here. Not sure
-- if we need something like that as well.
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf =
liftM (PackageIndex.fromList . concat) $ for packagedbs $ \packagedb ->
......@@ -202,7 +202,7 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir pkg lib _clbi = do
registerPackage
:: Verbosity
-> ProgramConfiguration
-> ProgramDb
-> PackageDBStack
-> InstalledPackageInfo
-> IO ()
......@@ -214,7 +214,7 @@ registerPackage verbosity progdb packageDbs installedPkgInfo = do
["update", packageDbOpt $ last packageDbs])
{ progInvokeInput = Just $ showInstalledPackageInfo installedPkgInfo }
initPackageDB :: Verbosity -> ProgramConfiguration -> FilePath -> IO ()
initPackageDB :: Verbosity -> ProgramDb -> FilePath -> IO ()
initPackageDB verbosity conf dbPath =
runDbProgram verbosity haskellSuitePkgProgram conf
["init", dbPath]
......
......@@ -49,7 +49,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS.Char8
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
-> ProgramDb -> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath _hcPkgPath conf = do
(jhcProg, _, conf') <- requireProgramVersion verbosity
......@@ -84,7 +84,7 @@ jhcLanguageExtensions =
,(DisableExtension CPP , "-fno-cpp")
]
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity _packageDBs conf = do
-- jhc --list-libraries lists all available libraries.
......
......@@ -75,7 +75,7 @@ import System.IO (hClose, hPutStrLn)
-- Configuring
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramConfiguration -> IO (Compiler, Maybe Platform, ProgramConfiguration)
-> ProgramDb -> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath hcPkgPath conf = do
(lhcProg, lhcVersion, conf') <-
......@@ -110,8 +110,8 @@ configure verbosity hcPath hcPkgPath conf = do
-- | Adjust the way we find and configure gcc and ld
--
configureToolchain :: ConfiguredProgram -> ProgramConfiguration
-> ProgramConfiguration
configureToolchain :: ConfiguredProgram -> ProgramDb
-> ProgramDb
configureToolchain lhcProg =
addKnownProgram gccProgram {
programFindLocation = findProg gccProgram (baseDir </> "gcc.exe"),
......@@ -193,7 +193,7 @@ getExtensions verbosity lhcProg = do
return $ [ (ext, "-X" ++ display ext)
| Just ext <- map readExtension (lines exts) ]
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf = do
checkPackageDbStack packagedbs
......@@ -221,7 +221,7 @@ checkPackageDbStack _ =
-- | Get the packages from specific PackageDBs, not cumulative.
--
getInstalledPackages' :: ConfiguredProgram -> Verbosity
-> [PackageDB] -> ProgramConfiguration
-> [PackageDB] -> ProgramDb
-> IO [(PackageDB, [InstalledPackageInfo])]
getInstalledPackages' lhcPkg verbosity packagedbs conf
=
......@@ -749,7 +749,7 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
registerPackage
:: Verbosity
-> ProgramConfiguration
-> ProgramDb
-> PackageDBStack
-> InstalledPackageInfo
-> IO ()
......@@ -757,7 +757,7 @@ registerPackage verbosity progdb packageDbs installedPkgInfo =
HcPkg.reregister (hcPkgInfo progdb) verbosity packageDbs
(Right installedPkgInfo)
hcPkgInfo :: ProgramConfiguration -> HcPkg.HcPkgInfo
hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = lhcPkgProg
, HcPkg.noPkgDbStack = False
, HcPkg.noVerboseFlag = False
......
......@@ -11,10 +11,10 @@
-- 'ConfiguredProgram' is a 'Program' that has been found on the current
-- machine and is ready to be run (possibly with some user-supplied default
-- args). Configuring a program involves finding its location and if necessary
-- finding its version. There is also a 'ProgramConfiguration' type which holds
-- finding its version. There is also a 'ProgramDb' type which holds
-- configured and not-yet configured programs. It is the parameter to lots of
-- actions elsewhere in Cabal that need to look up and run programs. If we had
-- a Cabal monad, the 'ProgramDb' would probably be a reader or
-- state component of it.
--
-- The module also defines all the known built-in 'Program's and the
......@@ -63,10 +63,10 @@ module Distribution.Simple.Program (
, builtinPrograms
-- * The collection of configured programs we can run
, ProgramConfiguration
, emptyProgramConfiguration
, defaultProgramConfiguration
, restoreProgramConfiguration
, ProgramDb
, defaultProgramDb
, emptyProgramDb
, restoreProgramDb
, addKnownProgram
, addKnownPrograms
, lookupKnownProgram
......@@ -118,6 +118,10 @@ module Distribution.Simple.Program (
, hpcProgram
-- * deprecated
, ProgramConfiguration
, emptyProgramConfiguration
, defaultProgramConfiguration
, restoreProgramConfiguration
, rawSystemProgram
, rawSystemProgramStdout
, rawSystemProgramConf
......
......@@ -21,7 +21,7 @@ import Distribution.Version
import System.FilePath (takeBaseName)
runStrip :: Verbosity -> ProgramConfiguration -> FilePath -> [String] -> IO ()
runStrip :: Verbosity -> ProgramDb -> FilePath -> [String] -> IO ()
runStrip verbosity progConf path args =
case lookupProgram stripProgram progConf of
Just strip -> runProgram verbosity strip (path:args)
......@@ -32,7 +32,7 @@ runStrip verbosity progConf path args =
++ (takeBaseName path)
++ "' (missing the 'strip' program)"
stripExe :: Verbosity -> Platform -> ProgramConfiguration -> FilePath -> IO ()
stripExe :: Verbosity -> Platform -> ProgramDb -> FilePath -> IO ()
stripExe verbosity (Platform _arch os) conf path =
runStrip verbosity conf path args
where
......@@ -43,7 +43,7 @@ stripExe verbosity (Platform _arch os) conf path =
-- The -x flag fixes that.
_ -> []
stripLib :: Verbosity -> Platform -> ProgramConfiguration -> FilePath -> IO ()
stripLib :: Verbosity -> Platform -> ProgramDb -> FilePath -> IO ()
stripLib verbosity (Platform arch os) conf path = do
case os of
OSX -> -- '--strip-unneeded' is not supported on OS X, iOS, AIX, or
......
......@@ -269,12 +269,12 @@ relocRegistrationInfo verbosity pkg lib lbi clbi abi_hash packageDb =
_ -> die "Distribution.Simple.Register.relocRegistrationInfo: \
\not implemented for this compiler"
initPackageDB :: Verbosity -> Compiler -> ProgramConfiguration -> FilePath -> IO ()
initPackageDB :: Verbosity -> Compiler -> ProgramDb -> FilePath -> IO ()
initPackageDB verbosity comp progdb dbPath =
createPackageDB verbosity comp progdb False dbPath
-- | Create an empty package DB at the specified location.
createPackageDB :: Verbosity -> Compiler -> ProgramConfiguration -> Bool
createPackageDB :: Verbosity -> Compiler -> ProgramDb -> Bool
-> FilePath -> IO ()
createPackageDB verbosity comp progdb preferCompat dbPath =
case compilerFlavor comp of
......@@ -305,13 +305,13 @@ deletePackageDB dbPath = do
-- | Run @hc-pkg@ using a given package DB stack, directly forwarding the
-- provided command-line arguments to it.
invokeHcPkg :: Verbosity -> Compiler -> ProgramConfiguration -> PackageDBStack
invokeHcPkg :: Verbosity -> Compiler -> ProgramDb -> PackageDBStack
-> [String] -> IO ()
invokeHcPkg verbosity comp conf dbStack extraArgs =
withHcPkg "invokeHcPkg" comp conf
(\hpi -> HcPkg.invoke hpi verbosity dbStack extraArgs)
withHcPkg :: String -> Compiler -> ProgramConfiguration
withHcPkg :: String -> Compiler -> ProgramDb
-> (HcPkg.HcPkgInfo -> IO a) -> IO a
withHcPkg name comp conf f =
case compilerFlavor comp of
......@@ -323,7 +323,7 @@ withHcPkg name comp conf f =
registerPackage :: Verbosity
-> Compiler
-> ProgramConfiguration
-> ProgramDb
-> HcPkg.MultiInstance
-> PackageDBStack
-> InstalledPackageInfo
......