Skip to content
  • Duncan Coutts's avatar
    Extend HcPkg.init support for dir-style package dbs · 12b222af
    Duncan Coutts authored
    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).
    12b222af