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 ( ...@@ -65,6 +65,7 @@ module Distribution.Simple.GHC (
buildLib, buildExe, buildLib, buildExe,
installLib, installExe, installLib, installExe,
libAbiHash, libAbiHash,
initPackageDB,
registerPackage, registerPackage,
componentGhcOptions, componentGhcOptions,
ghcLibDir, ghcLibDir,
...@@ -1105,10 +1106,15 @@ updateLibArchive verbosity lbi path ...@@ -1105,10 +1106,15 @@ updateLibArchive verbosity lbi path
rawSystemProgram verbosity ranlib [path] rawSystemProgram verbosity ranlib [path]
| otherwise = return () | otherwise = return ()
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Registering -- 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 registerPackage
:: Verbosity :: Verbosity
-> InstalledPackageInfo -> InstalledPackageInfo
......
...@@ -57,6 +57,7 @@ module Distribution.Simple.Register ( ...@@ -57,6 +57,7 @@ module Distribution.Simple.Register (
register, register,
unregister, unregister,
initPackageDB,
registerPackage, registerPackage,
generateRegistrationInfo, generateRegistrationInfo,
inplaceInstalledPackageInfo, inplaceInstalledPackageInfo,
...@@ -73,11 +74,12 @@ import qualified Distribution.Simple.LHC as LHC ...@@ -73,11 +74,12 @@ import qualified Distribution.Simple.LHC as LHC
import qualified Distribution.Simple.Hugs as Hugs import qualified Distribution.Simple.Hugs as Hugs
import qualified Distribution.Simple.UHC as UHC import qualified Distribution.Simple.UHC as UHC
import Distribution.Simple.Compiler import Distribution.Simple.Compiler
( compilerVersion, CompilerFlavor(..), compilerFlavor ( compilerVersion, Compiler, CompilerFlavor(..), compilerFlavor
, PackageDBStack, registrationPackageDB ) , PackageDBStack, registrationPackageDB )
import Distribution.Simple.Program import Distribution.Simple.Program
( ConfiguredProgram, runProgramInvocation ( ProgramConfiguration, ConfiguredProgram
, requireProgram, lookupProgram, ghcPkgProgram, lhcPkgProgram ) , runProgramInvocation, requireProgram, lookupProgram
, ghcPkgProgram, lhcPkgProgram )
import Distribution.Simple.Program.Script import Distribution.Simple.Program.Script
( invocationAsSystemScript ) ( invocationAsSystemScript )
import qualified Distribution.Simple.Program.HcPkg as HcPkg import qualified Distribution.Simple.Program.HcPkg as HcPkg
...@@ -204,6 +206,14 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace distPref = do ...@@ -204,6 +206,14 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace distPref = do
return installedPkgInfo{ IPI.installedPackageId = ipid } 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 registerPackage :: Verbosity
-> InstalledPackageInfo -> InstalledPackageInfo
-> PackageDescription -> 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