Commit 3de1049b authored by refold's avatar refold
Browse files

Add an 'initPackageDB' function to D.S.Register.

Creates an empty package DB at the specified location.
parent 1cc68780
......@@ -65,6 +65,7 @@ module Distribution.Simple.GHC (
buildLib, buildExe,
installLib, installExe,
libAbiHash,
initPackageDB,
registerPackage,
componentGhcOptions,
ghcLibDir,
......@@ -1105,10 +1106,15 @@ updateLibArchive verbosity lbi path
rawSystemProgram verbosity ranlib [path]
| otherwise = return ()
-- -----------------------------------------------------------------------------
-- Registering
-- | Create an empty package DB at the specified location.
initPackageDB :: Verbosity -> ProgramConfiguration -> FilePath -> IO ()
initPackageDB verbosity conf dbPath = HcPkg.init verbosity ghcPkgProg dbPath
where
Just ghcPkgProg = lookupProgram ghcPkgProgram conf
registerPackage
:: Verbosity
-> InstalledPackageInfo
......
......@@ -57,6 +57,7 @@ module Distribution.Simple.Register (
register,
unregister,
initPackageDB,
registerPackage,
generateRegistrationInfo,
inplaceInstalledPackageInfo,
......@@ -73,11 +74,12 @@ import qualified Distribution.Simple.LHC as LHC
import qualified Distribution.Simple.Hugs as Hugs
import qualified Distribution.Simple.UHC as UHC
import Distribution.Simple.Compiler
( compilerVersion, CompilerFlavor(..), compilerFlavor
( compilerVersion, Compiler, CompilerFlavor(..), compilerFlavor
, PackageDBStack, registrationPackageDB )
import Distribution.Simple.Program
( ConfiguredProgram, runProgramInvocation
, requireProgram, lookupProgram, ghcPkgProgram, lhcPkgProgram )
( ProgramConfiguration, ConfiguredProgram
, runProgramInvocation, requireProgram, lookupProgram
, ghcPkgProgram, lhcPkgProgram )
import Distribution.Simple.Program.Script
( invocationAsSystemScript )
import qualified Distribution.Simple.Program.HcPkg as HcPkg
......@@ -204,6 +206,14 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace distPref = do
return installedPkgInfo{ IPI.installedPackageId = ipid }
-- | Create an empty package DB at the specified location.
initPackageDB :: Verbosity -> Compiler -> ProgramConfiguration -> FilePath
-> IO ()
initPackageDB verbosity comp conf dbPath =
case (compilerFlavor comp) of
GHC -> GHC.initPackageDB verbosity conf dbPath
_ -> die "initPackageDB is not implemented for this compiler"
registerPackage :: Verbosity
-> InstalledPackageInfo
-> PackageDescription
......
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