Commit 77208c63 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

s/conf/progdb/

parent a708401c
......@@ -76,17 +76,17 @@ import System.IO (hClose, hPutStrLn)
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramDb -> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath hcPkgPath conf = do
configure verbosity hcPath hcPkgPath progdb = do
(lhcProg, lhcVersion, conf') <-
(lhcProg, lhcVersion, progdb') <-
requireProgramVersion verbosity lhcProgram
(orLaterVersion (Version [0,7] []))
(userMaybeSpecifyPath "lhc" hcPath conf)
(userMaybeSpecifyPath "lhc" hcPath progdb)
(lhcPkgProg, lhcPkgVersion, conf'') <-
(lhcPkgProg, lhcPkgVersion, progdb'') <-
requireProgramVersion verbosity lhcPkgProgram
(orLaterVersion (Version [0,7] []))
(userMaybeSpecifyPath "lhc-pkg" hcPkgPath conf')
(userMaybeSpecifyPath "lhc-pkg" hcPkgPath progdb')
when (lhcVersion /= lhcPkgVersion) $ die $
"Version mismatch between lhc and lhc-pkg: "
......@@ -104,9 +104,9 @@ configure verbosity hcPath hcPkgPath conf = do
compilerExtensions = extensions,
compilerProperties = Map.empty
}
conf''' = configureToolchain lhcProg conf'' -- configure gcc and ld
progdb''' = configureToolchain lhcProg progdb'' -- configure gcc and ld
compPlatform = Nothing
return (comp, compPlatform, conf''')
return (comp, compPlatform, progdb''')
-- | Adjust the way we find and configure gcc and ld
--
......@@ -195,9 +195,9 @@ getExtensions verbosity lhcProg = do
getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf = do
getInstalledPackages verbosity packagedbs progdb = do
checkPackageDbStack packagedbs
pkgss <- getInstalledPackages' lhcPkg verbosity packagedbs conf
pkgss <- getInstalledPackages' lhcPkg verbosity packagedbs progdb
let indexes = [ PackageIndex.fromList (map (substTopDir topDir) pkgs)
| (_, pkgs) <- pkgss ]
return $! (mconcat indexes)
......@@ -206,8 +206,8 @@ getInstalledPackages verbosity packagedbs conf = 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
Just ghcProg = lookupProgram lhcProgram conf
Just lhcPkg = lookupProgram lhcPkgProgram conf
Just ghcProg = lookupProgram lhcProgram progdb
Just lhcPkg = lookupProgram lhcPkgProgram progdb
compilerDir = takeDirectory (programPath ghcProg)
topDir = takeDirectory compilerDir
......@@ -223,10 +223,10 @@ checkPackageDbStack _ =
getInstalledPackages' :: ConfiguredProgram -> Verbosity
-> [PackageDB] -> ProgramDb
-> IO [(PackageDB, [InstalledPackageInfo])]
getInstalledPackages' lhcPkg verbosity packagedbs conf
getInstalledPackages' lhcPkg verbosity packagedbs progdb
=
sequenceA
[ do str <- getDbProgramOutput verbosity lhcPkgProgram conf
[ do str <- getDbProgramOutput verbosity lhcPkgProgram progdb
["dump", packageDbGhcPkgFlag packagedb]
`catchExit` \_ -> die $ "ghc-pkg dump failed"
case parsePackages str of
......@@ -758,14 +758,14 @@ registerPackage verbosity progdb packageDbs installedPkgInfo =
(Right installedPkgInfo)
hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = lhcPkgProg
, HcPkg.noPkgDbStack = False
, HcPkg.noVerboseFlag = False
, HcPkg.flagPackageConf = False
, HcPkg.supportsDirDbs = True
, HcPkg.requiresDirDbs = True
, HcPkg.nativeMultiInstance = False -- ?
, HcPkg.recacheMultiInstance = False -- ?
}
hcPkgInfo progdb = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = lhcPkgProg
, HcPkg.noPkgDbStack = False
, HcPkg.noVerboseFlag = False
, HcPkg.flagPackageConf = False
, HcPkg.supportsDirDbs = True
, HcPkg.requiresDirDbs = True
, HcPkg.nativeMultiInstance = False -- ?
, HcPkg.recacheMultiInstance = False -- ?
}
where
Just lhcPkgProg = lookupProgram lhcPkgProgram conf
Just lhcPkgProg = lookupProgram lhcPkgProgram progdb
......@@ -248,7 +248,7 @@ userSpecifyPaths :: [(String, FilePath)]
-> ProgramDb
-> ProgramDb
userSpecifyPaths paths progdb =
foldl' (\conf' (prog, path) -> userSpecifyPath prog path conf') progdb paths
foldl' (\progdb' (prog, path) -> userSpecifyPath prog path progdb') progdb paths
-- | Like 'userSpecifyPath' but for a list of progs and their args.
......@@ -257,7 +257,7 @@ userSpecifyArgss :: [(String, [ProgArg])]
-> ProgramDb
-> ProgramDb
userSpecifyArgss argss progdb =
foldl' (\conf' (prog, args) -> userSpecifyArgs prog args conf') progdb argss
foldl' (\progdb' (prog, args) -> userSpecifyArgs prog args progdb') progdb argss
-- | Get the path that has been previously specified for a program, if any.
......@@ -402,13 +402,13 @@ requireProgram :: Verbosity -> Program -> ProgramDb
requireProgram verbosity prog progdb = do
-- If it's not already been configured, try to configure it now
conf' <- case lookupProgram prog progdb of
progdb' <- case lookupProgram prog progdb of
Nothing -> configureProgram verbosity prog progdb
Just _ -> return progdb
case lookupProgram prog conf' of
case lookupProgram prog progdb' of
Nothing -> die notFound
Just configuredProg -> return (configuredProg, conf')
Just configuredProg -> return (configuredProg, progdb')
where notFound = "The program '" ++ programName prog
++ "' is required but it could not be found."
......
......@@ -47,12 +47,12 @@ import System.FilePath
configure :: Verbosity -> Maybe FilePath -> Maybe FilePath
-> ProgramDb -> IO (Compiler, Maybe Platform, ProgramDb)
configure verbosity hcPath _hcPkgPath conf = do
configure verbosity hcPath _hcPkgPath progdb = do
(_uhcProg, uhcVersion, conf') <-
(_uhcProg, uhcVersion, progdb') <-
requireProgramVersion verbosity uhcProgram
(orLaterVersion (Version [1,0,2] []))
(userMaybeSpecifyPath "uhc" hcPath conf)
(userMaybeSpecifyPath "uhc" hcPath progdb)
let comp = Compiler {
compilerId = CompilerId UHC uhcVersion,
......@@ -63,7 +63,7 @@ configure verbosity hcPath _hcPkgPath conf = do
compilerProperties = Map.empty
}
compPlatform = Nothing
return (comp, compPlatform, conf')
return (comp, compPlatform, progdb')
uhcLanguages :: [(Language, C.Flag)]
uhcLanguages = [(Haskell98, "")]
......@@ -91,9 +91,9 @@ uhcLanguageExtensions =
getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack -> ProgramDb
-> IO InstalledPackageIndex
getInstalledPackages verbosity comp packagedbs conf = do
getInstalledPackages verbosity comp packagedbs progdb = do
let compilerid = compilerId comp
systemPkgDir <- getGlobalPackageDir verbosity conf
systemPkgDir <- getGlobalPackageDir verbosity progdb
userPkgDir <- getUserPackageDir
let pkgDirs = nub (concatMap (packageDbPaths userPkgDir systemPkgDir) packagedbs)
-- putStrLn $ "pkgdirs: " ++ show pkgDirs
......@@ -109,9 +109,9 @@ getInstalledPackages verbosity comp packagedbs conf = do
return (fromList iPkgs)
getGlobalPackageDir :: Verbosity -> ProgramDb -> IO FilePath
getGlobalPackageDir verbosity conf = do
getGlobalPackageDir verbosity progdb = do
output <- getDbProgramOutput verbosity
uhcProgram conf ["--meta-pkgdir-system"]
uhcProgram progdb ["--meta-pkgdir-system"]
-- call to "lines" necessary, because pkgdir contains an extra newline at the end
let [pkgdir] = lines output
return pkgdir
......
......@@ -207,8 +207,8 @@ data SuiteConfig = SuiteConfig
}
getProgram :: ProgramDb -> Program -> ConfiguredProgram
getProgram conf program = prog
where Just prog = lookupProgram program conf -- invariant!
getProgram progdb program = prog
where Just prog = lookupProgram program progdb -- invariant!
getBootProgram :: SuiteConfig -> Program -> ConfiguredProgram
getBootProgram suite = getProgram (bootProgramsConfig suite)
......
......@@ -111,12 +111,12 @@ configure :: Verbosity
-> ConfigExFlags
-> [String]
-> IO ()
configure verbosity packageDBs repoCtxt comp platform conf
configure verbosity packageDBs repoCtxt comp platform progdb
configFlags configExFlags extraArgs = do
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs conf
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs progdb
sourcePkgDb <- getSourcePackages verbosity repoCtxt
pkgConfigDb <- readPkgConfigDb verbosity conf
pkgConfigDb <- readPkgConfigDb verbosity progdb
checkConfigExFlags verbosity installedPkgIndex
(packageIndex sourcePkgDb) configExFlags
......@@ -159,7 +159,7 @@ configure verbosity packageDBs repoCtxt comp platform conf
packageDBs
comp
platform
conf
progdb
(fromFlagOrDefault
(useDistPref defaultSetupScriptOptions)
(configDistPref configFlags))
......@@ -185,7 +185,7 @@ configureSetupScript :: PackageDBStack
configureSetupScript packageDBs
comp
platform
conf
progdb
distPref
cabalVersion
lock
......@@ -199,7 +199,7 @@ configureSetupScript packageDBs
, usePlatform = Just platform
, usePackageDB = packageDBs'
, usePackageIndex = index'
, useProgramDb = conf
, useProgramDb = progdb
, useDistPref = distPref
, useLoggingHandle = Nothing
, useWorkingDir = Nothing
......
......@@ -79,14 +79,14 @@ fetch :: Verbosity
fetch verbosity _ _ _ _ _ _ _ [] =
notice verbosity "No packages requested. Nothing to do."
fetch verbosity packageDBs repoCtxt comp platform conf
fetch verbosity packageDBs repoCtxt comp platform progdb
globalFlags fetchFlags userTargets = do
mapM_ checkTarget userTargets
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs conf
installedPkgIndex <- getInstalledPackages verbosity comp packageDBs progdb
sourcePkgDb <- getSourcePackages verbosity repoCtxt
pkgConfigDb <- readPkgConfigDb verbosity conf
pkgConfigDb <- readPkgConfigDb verbosity progdb
pkgSpecifiers <- resolveUserTargets verbosity repoCtxt
(fromFlag $ globalWorldFile globalFlags)
......
Markdown is supported
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