summaryrefslogtreecommitdiff
path: root/compiler/main/Packages.hs
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2016-08-30 16:59:17 -0400
committerBen Gamari <ben@smart-cactus.org>2016-08-30 17:50:51 -0400
commitef784c551ef9b64c3c0b32c73f54bbdb747a8188 (patch)
tree47b9404e0e1e24f69ba6f1c0500d6b95e5e76cb0 /compiler/main/Packages.hs
parenta25bf2673d0f6db5f454619ddf91f974cace4e8b (diff)
downloadhaskell-ef784c551ef9b64c3c0b32c73f54bbdb747a8188.tar.gz
Fix handling of package-db entries in .ghc.environment files, etc.
Previously interpreting the content of the .ghc.env files was done after the step that loaded the available package dbs. This meant that setting the package db flags was ineffective. This patch moves interpreting the env files before loading of the package dbs. Also, the package-db entries refer to files. Allow spaces in these file names. Also treat as comments lines beginning with "--". These are pretty minor fixes in a feature that up 'til now has been essentially unused (witness no bug report about it), so there's very low risk here. If we can get this into 8.0.2 then cabal can start generating the .ghc.environment files, otherwise it cannot as it needs the working package-db entries, to be able to refer to local package dbs in the build tree (or cabal nix store). Test Plan: Manually create example .ghc.env files run ghci; :show packages Done this. It works. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2476
Diffstat (limited to 'compiler/main/Packages.hs')
-rw-r--r--compiler/main/Packages.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index ecec982422..0c91af284d 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -339,7 +339,8 @@ listPackageConfigMap dflags = eltsUDFM (pkgIdMap (pkgState dflags))
-- 'pkgState' in 'DynFlags' and return a list of packages to
-- link in.
initPackages :: DynFlags -> IO (DynFlags, [UnitId])
-initPackages dflags = do
+initPackages dflags0 = do
+ dflags <- interpretPackageEnv dflags0
pkg_db <-
case pkgDatabase dflags of
Nothing -> readPackageConfigs dflags
@@ -879,9 +880,7 @@ mkPackageState
UnitId) -- this package, might be modified if the current
-- package is a wired-in package.
-mkPackageState dflags0 dbs preload0 = do
- dflags <- interpretPackageEnv dflags0
-
+mkPackageState dflags dbs preload0 = do
-- Compute the unit id
let this_package = thisPackage dflags