Skip to content
  • Duncan Coutts's avatar
    Introduce new file format for the package database binary cache · 8d7a1dcd
    Duncan Coutts authored
    The purpose of the new format is to make it possible for the compiler
    to not depend on the Cabal library. The new cache file format contains
    more or less the same information duplicated in two different sections
    using different representations.
    
    One section is basically the same as what the package db contains now,
    a list of packages using the types defined in the Cabal library. This
    section is read back by ghc-pkg, and used for things like ghc-pkg dump
    which have to produce output using the Cabal InstalledPackageInfo text
    representation.
    
    The other section is a ghc-local type which contains a subset of the
    information from the Cabal InstalledPackageInfo -- just the bits that
    the compiler cares about.
    
    The trick is that the compiler can read this second section without
    needing to know the representation (or types) of the first part. The
    ghc-pkg tool knows about both representations and writes both.
    
    This patch introduces the new cache file format but does not yet use it
    properly. More patches to follow. (As of this patch, the compiler reads
    the part intended for ghc-pkg so it still depends on Cabal and the
    ghc-local package type is not yet fully defined.)
    8d7a1dcd