summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-09-04 17:35:52 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-09 18:31:40 -0400
commit4ce9fe88e7e98178d5fd6b18ac9cba666a1f8306 (patch)
tree5d83869749424eef948d46ec3ea49d5d3336ef32
parent5aae5b325ccef857800f1840665a0e1b152e9b88 (diff)
downloadhaskell-4ce9fe88e7e98178d5fd6b18ac9cba666a1f8306.tar.gz
hadrian: Fix leakage of GHC in PATH into build
Previously hadrian would use GHC on PATH when configuring packages (or fail if there is no such GHC). Fix this. Unfortunately this runs into another bug in Cabal which we workaround.
-rw-r--r--hadrian/src/Hadrian/Oracles/Cabal/Rules.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs b/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs
index a8fe8c773a..546406ecd2 100644
--- a/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs
+++ b/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs
@@ -15,6 +15,7 @@ import Control.Monad
import Data.Maybe
import Development.Shake
import Distribution.Simple.GHC
+import Distribution.Simple.Program.Builtin
import Distribution.Simple.Program.Db
import Distribution.Verbosity
@@ -58,8 +59,13 @@ cabalOracle = do
++ quote (pkgName pkg) ++ " (" ++ show stage ++ ")..."
-- Configure the package with the GHC corresponding to the given stage
hcPath <- builderPath (Ghc CompileHs stage)
+ let progDb = userSpecifyPath "ghc" hcPath
+ $ addKnownProgram ghcProgram emptyProgramDb
(compiler, maybePlatform, _pkgdb) <- liftIO $
- configure silent (Just hcPath) Nothing emptyProgramDb
+ -- N.B. the hcPath parameter of `configure` is broken when given an
+ -- empty ProgramDb. To work around this we manually construct an
+ -- appropriate ProgramDb.
+ configure silent Nothing Nothing progDb
let platform = fromMaybe (error msg) maybePlatform
msg = "PackageConfiguration oracle: cannot detect platform"
return $ PackageConfiguration (compiler, platform)