Repository navigation
Use configured compiler for cabal sandbox hc-pkg - #2859
Conversation
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 haskell#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.
There was a problem hiding this comment.
I wonder if this function can be also used in other places in this file.
There was a problem hiding this comment.
I wondered this too, which is why I factored it out as a separate function. But I haven't really investigated the other uses of configCompilerAux', configCompilerAuxEx, and so on...
|
Looks OK. |
|
Hmm, it doesn't appear to quite work correctly for GHCJS. Packages end up in the correct package db, but I'll investigate a bit more. |
|
Oh I was looking at the wrong thing, it is using |
|
Erm, next time I should build the correct branch first |
|
|
|
I'm on it. |
The GHC[JS]_PACKAGE_PATH and CABAL_SANDBOX_PACKAGE_PATH environment variables contain colon-separated lists of package DBs, so it doesn't make sense to call doesDirectoryExist on the colon-separated list. Instead, this just checks for the existence of the sandbox package DB.
|
Now |
|
Works ok here with GHCJS / ghcjs-pkg. I'd be happy to merge this if no one objects. |
|
LGTM, merging. |
Use configured compiler for cabal sandbox hc-pkg
|
Merged, thanks! |
For most commands (e.g.
cabal install), thepackage-dbfield incabal.sandbox.configis ignored, and the path is reconstructed from theprefixand 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 makescabal sandbox hc-pkgbehave 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.
I think the
package-dbfield should probably be removed fromcabal.sandbox.configcompletely, but I haven't yet investigated this.@luite hopefully this will make
cabal configure -w ghcjs && cabal sandbox hc-pkg listjust do the right thing; please yell if not!