Rename PackageDb to PackageDatabase
[hadrian.git] / src / Oracles / PackageDatabase.hs
1 module Oracles.PackageDatabase (packageDatabaseOracle) where
2
3 import qualified System.Directory as IO
4
5 import Base
6 import Context
7 import Builder
8 import GHC
9 import Rules.Actions
10 import Settings.Builders.GhcCabal
11 import Settings.Paths
12 import Settings.User
13 import Target
14
15 packageDatabaseOracle :: Rules ()
16 packageDatabaseOracle = void $
17 addOracle $ \(PackageDatabaseKey stage) -> do
18 let dir = packageDbDirectory stage
19 file = dir -/- "package.cache"
20 unlessM (liftIO $ IO.doesFileExist file) $ do
21 removeDirectory dir
22 build $ Target (vanillaContext stage ghcPkg) (GhcPkg stage) [] [dir]
23 putSuccess $ "| Successfully initialised " ++ dir