Extend HcPkg.init support for dir-style package dbs
The HcPkgInfo useSingleFileDb is split into two: supportsDirDbs and requiresDirDbs. Then rather than HcPkg.init callers having to do the writeFile [] thing, HcPkg.init does it itself automatically based on the HcPkgInfo. In the case that supportsDirDbs is True but requiresDirDbs is False then we have a choice, to use dir style or file style. For compatability reasons, when using ghc/ghc-pkg for the inplace package db we want to use the old file style, even though dir style is supported. However in other circumstances (e.g. in places in cabal-install) we would like to use the dir style if it's supported, and there are no backwards compat issues. So HcPkg.init gains a new Bool arg to request using the file style if it's still supported. Only this mode is used within Cabal itself, but the non-compat mode is available for other users. The compiler-independent initPackageDB is left with the same old behaviour, but a new createPackageDB has the extra compat argument (which is only passed to hc-pkg for ghc-pkg).
Showing
- Cabal/Distribution/Simple/Build.hs 1 addition, 3 deletionsCabal/Distribution/Simple/Build.hs
- Cabal/Distribution/Simple/GHC.hs 2 additions, 1 deletionCabal/Distribution/Simple/GHC.hs
- Cabal/Distribution/Simple/GHCJS.hs 2 additions, 1 deletionCabal/Distribution/Simple/GHCJS.hs
- Cabal/Distribution/Simple/LHC.hs 2 additions, 1 deletionCabal/Distribution/Simple/LHC.hs
- Cabal/Distribution/Simple/Program/HcPkg.hs 10 additions, 4 deletionsCabal/Distribution/Simple/Program/HcPkg.hs
- Cabal/Distribution/Simple/Register.hs 16 additions, 8 deletionsCabal/Distribution/Simple/Register.hs
Loading
Please register or sign in to comment