diff --git a/Cabal/Distribution/Simple/Build.hs b/Cabal/Distribution/Simple/Build.hs index e4920446b2872aa874fb0f49aacb30db937151ea..d6ced9824a360c924b1f99a472d8d2438d56be46 100644 --- a/Cabal/Distribution/Simple/Build.hs +++ b/Cabal/Distribution/Simple/Build.hs @@ -450,15 +450,17 @@ createInternalPackageDB verbosity lbi distPref = do LHC -> createWith $ LHC.hcPkgInfo (withPrograms lbi) _ -> return packageDB where - dbDir = distPref </> "package.conf.inplace" - packageDB = SpecificPackageDB dbDir + dbPath = distPref </> "package.conf.inplace" + packageDB = SpecificPackageDB dbPath createWith hpi = do - dir_exists <- doesDirectoryExist dbDir + dir_exists <- doesDirectoryExist dbPath if dir_exists - then removeDirectoryRecursive dbDir - else do file_exists <- doesFileExist dbDir - when file_exists $ removeFile dbDir - HcPkg.init hpi verbosity dbDir + then removeDirectoryRecursive dbPath + else do file_exists <- doesFileExist dbPath + when file_exists $ removeFile dbPath + if HcPkg.useSingleFileDb hpi + then writeFile dbPath "[]" + else HcPkg.init hpi verbosity dbPath return packageDB addInternalBuildTools :: PackageDescription -> LocalBuildInfo -> BuildInfo diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index 69588dd72b4411a9d704a7023e27cd03f7e23392..a630e503a6a5c261ad63ffac5d473756c5fe3019 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -1039,6 +1039,7 @@ hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcPkgProg , HcPkg.noPkgDbStack = v < [6,9] , HcPkg.noVerboseFlag = v < [6,11] , HcPkg.flagPackageConf = v < [7,5] + , HcPkg.useSingleFileDb = v < [7,9] } where v = versionBranch ver diff --git a/Cabal/Distribution/Simple/GHCJS.hs b/Cabal/Distribution/Simple/GHCJS.hs index dc84419e5779c2a716286c96a4aee569e8fd3b9f..94807bd37b625a49f5b9c86fd07b197df95088f7 100644 --- a/Cabal/Distribution/Simple/GHCJS.hs +++ b/Cabal/Distribution/Simple/GHCJS.hs @@ -879,9 +879,12 @@ hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = ghcjsPkgProg , HcPkg.noPkgDbStack = False , HcPkg.noVerboseFlag = False , HcPkg.flagPackageConf = False + , HcPkg.useSingleFileDb = v < [7,9] } where + v = versionBranch ver Just ghcjsPkgProg = lookupProgram ghcjsPkgProgram conf + Just ver = programVersion ghcjsPkgProg -- | Get the JavaScript file name and command and arguments to run a -- program compiled by GHCJS diff --git a/Cabal/Distribution/Simple/LHC.hs b/Cabal/Distribution/Simple/LHC.hs index fd115e87b3ac8f23325926f2d8fc4a46679b6c0a..c0bc5952e7439d46adeb5d2b1d67ac3af2e9ea2b 100644 --- a/Cabal/Distribution/Simple/LHC.hs +++ b/Cabal/Distribution/Simple/LHC.hs @@ -794,6 +794,7 @@ hcPkgInfo conf = HcPkg.HcPkgInfo { HcPkg.hcPkgProgram = lhcPkgProg , HcPkg.noPkgDbStack = False , HcPkg.noVerboseFlag = False , HcPkg.flagPackageConf = False + , HcPkg.useSingleFileDb = True } where Just lhcPkgProg = lookupProgram lhcPkgProgram conf diff --git a/Cabal/Distribution/Simple/Program/HcPkg.hs b/Cabal/Distribution/Simple/Program/HcPkg.hs index 4eae5241ecc0a663bb3f1514d04d38a3b7d2c43a..a2276fff11234e2120992d9ff1da34572ae3cf51 100644 --- a/Cabal/Distribution/Simple/Program/HcPkg.hs +++ b/Cabal/Distribution/Simple/Program/HcPkg.hs @@ -73,6 +73,7 @@ data HcPkgInfo = HcPkgInfo , noPkgDbStack :: Bool -- ^ no package DB stack supported , noVerboseFlag :: Bool -- ^ hc-pkg does not support verbosity flags , flagPackageConf :: Bool -- ^ use package-conf option instead of package-db + , useSingleFileDb :: Bool -- ^ requires single file package database } -- | Call @hc-pkg@ to initialise a package database at the location {path}.