Improve an error message.

See #1397.
Show the error message only if the error actually occurred.
Improve an error message.

See #1362.
If we can't list sources, assume that the dependency hasn't changed.

Fixes #1397.
Tweak an error message.
Split the cabal_macros.h generation into a helper and wrapper

Makes it easier to reuse this code in other contexts, for example if we
want to build without a .cabal file using all the packages in the
environment.
Add a list command to the HcPkg module

Only useful for getting the source package ids. Does not get the
installed package ids or any other details. Most use cases should
still use dump.
Don't completely override 'local-repo' in 'cabal.sandbox.config'.

Instead, just append '/path/to/.cabal-sandbox/packages' at the end.

See the discussion in #1402.
Revert "Try harder to pick the correct version in cabalLibVersionToUse."

This reverts commit a17491d70741d28d9b6037640e6fb2b041fc81bc.

That commit made the logic much more convoluted and broke the following use case
(for sandboxed packages with build-type Custom):

$ cabal configure -w /path/to/ghc
$ cabal build
Merge pull request #1399 from dcoutts/cabal_macros.h-util

Split the cabal_macros.h generation into a helper and wrapper
Merge pull request #1400 from dcoutts/hc-pkg-list

Add a list command to the HcPkg module
Make absolute haddock paths proper URLs

Fixes #1064, #1406
Merge pull request #1407 from feuerbach/haddock-urls

Make absolute haddock paths proper URLs
Merge branch 'master' into ghcjs