Use configured compiler for cabal sandbox hc-pkg
commita25c16692211572eb081366150a1f8380e7cbbdd
authorAdam Gundry <adam@well-typed.com>
Sun, 11 Oct 2015 08:36:50 +0000 (11 09:36 +0100)
committerAdam Gundry <adam@well-typed.com>
Sun, 11 Oct 2015 08:36:50 +0000 (11 09:36 +0100)
treed89e7a678f1165a28ff5b7cc10cdb3234e05a2ff
parent4e8733632a52d386ab4893af31d87e350a0c657c
Use configured compiler for cabal sandbox hc-pkg

For most commands (e.g. `cabal install`), the `package-db` field in
`cabal.sandbox.config` is ignored, and the path is reconstructed
from the `prefix` and current compiler instead.  This is arguably
the right behaviour, because the right package DB depends on the
arch/compiler, so it doesn't make sense to specify only one.  This
commit makes `cabal sandbox hc-pkg` behave similarly, to avoid
invoking ghc-pkg on an incompatible package DB (fixes #1935).

Moreover, the compiler version to use is now picked up from the
most recently configured compiler, if any.  Otherwise, the global
default compiler is used, as before.
cabal-install/Distribution/Client/Sandbox.hs