[commit: packages/Cabal] ghc-head: Initialise all subfields of 'install-dirs' in 'sandbox init'. (a20fa9d)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:28:32 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=a20fa9da332ce95e19a8cbe3349fa3781bd8a525

>---------------------------------------------------------------

commit a20fa9da332ce95e19a8cbe3349fa3781bd8a525
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Wed Jul 17 20:47:49 2013 +0200

    Initialise all subfields of 'install-dirs' in 'sandbox init'.
    
    Inheriting e.g. 'libsubdir' from '~/.cabal/config' can break things if it set to
    an empty string.
    
    Fixes #1389.


>---------------------------------------------------------------

a20fa9da332ce95e19a8cbe3349fa3781bd8a525
 .../Distribution/Client/Sandbox/PackageEnvironment.hs         |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs b/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
index e882912..c9d6eb1 100644
--- a/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
+++ b/cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs
@@ -36,8 +36,9 @@ import Distribution.Client.Setup       ( GlobalFlags(..), ConfigExFlags(..)
                                        , InstallFlags(..)
                                        , defaultSandboxLocation )
 import Distribution.Simple.Compiler    ( Compiler, PackageDB(..)
-                                       , showCompilerId )
+                                       , compilerFlavor, showCompilerId )
 import Distribution.Simple.InstallDirs ( InstallDirs(..), PathTemplate
+                                       , defaultInstallDirs, combineInstallDirs
                                        , fromPathTemplate, toPathTemplate )
 import Distribution.Simple.Setup       ( Flag(..), ConfigFlags(..),
                                          fromFlagOrDefault, toFlag )
@@ -175,9 +176,15 @@ basePackageEnvironment =
 initialPackageEnvironment :: FilePath -> Compiler -> Platform
                              -> IO PackageEnvironment
 initialPackageEnvironment sandboxDir compiler platform = do
+  defInstallDirs <- defaultInstallDirs (compilerFlavor compiler)
+                    {- userInstall= -} False {- _hasLibs= -} False
   let initialConfig = commonPackageEnvironmentConfig sandboxDir
+      installDirs   = combineInstallDirs (\d f -> Flag $ fromFlagOrDefault d f)
+                      defInstallDirs (savedUserInstallDirs initialConfig)
   return $ mempty {
     pkgEnvSavedConfig = initialConfig {
+       savedUserInstallDirs   = installDirs,
+       savedGlobalInstallDirs = installDirs,
        savedGlobalFlags = (savedGlobalFlags initialConfig) {
           globalLocalRepos = [sandboxDir </> "packages"]
           },





More information about the ghc-commits mailing list