[commit: packages/Cabal] ghc-head: Use a subdir of 'dist' as build dir for building add-source deps. (e1af62f)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:24: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=e1af62f41050760ba21ea5941b8a632023d62f94

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

commit e1af62f41050760ba21ea5941b8a632023d62f94
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Sun May 5 19:18:30 2013 +0200

    Use a subdir of 'dist' as build dir for building add-source deps.
    
    Works better with 'cabal clean'.


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

e1af62f41050760ba21ea5941b8a632023d62f94
 cabal-install/Distribution/Client/Sandbox.hs |    8 +++++++-
 cabal-install/Main.hs                        |    3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/cabal-install/Distribution/Client/Sandbox.hs b/cabal-install/Distribution/Client/Sandbox.hs
index 5a7d45a..9b3bcd8 100644
--- a/cabal-install/Distribution/Client/Sandbox.hs
+++ b/cabal-install/Distribution/Client/Sandbox.hs
@@ -30,6 +30,7 @@ module Distribution.Client.Sandbox (
     maybeUpdateSandboxConfig,
 
     tryGetIndexFilePath,
+    sandboxBuildDir,
 
     -- FIXME: move somewhere else
     configPackageDB', configCompilerAux'
@@ -111,6 +112,11 @@ import System.FilePath                        ( (</>), getSearchPath
 snapshotDirectoryName :: FilePath
 snapshotDirectoryName = "snapshots"
 
+-- | Non-standard build dir that is used for building add-source deps instead of
+-- "dist". Fixes surprising behaviour in some cases (see issue #1281).
+sandboxBuildDir :: FilePath
+sandboxBuildDir = "dist/sandbox-dist"
+
 --
 -- * Basic sandbox functions.
 --
@@ -443,7 +449,7 @@ reinstallAddSourceDeps :: Verbosity
 reinstallAddSourceDeps verbosity config configFlags' configExFlags
                        installFlags globalFlags sandboxDir = do
   let configFlags       = configFlags'
-                          { configDistPref = Flag "sandbox-dist" }
+                          { configDistPref = Flag sandboxBuildDir }
   indexFile            <- tryGetIndexFilePath config
   buildTreeRefs        <- Index.listBuildTreeRefs verbosity
                           Index.DontListIgnored indexFile
diff --git a/cabal-install/Main.hs b/cabal-install/Main.hs
index 79a2d1b..bafb13e 100644
--- a/cabal-install/Main.hs
+++ b/cabal-install/Main.hs
@@ -86,6 +86,7 @@ import Distribution.Client.Sandbox            (sandboxInit
                                               ,reinstallAddSourceDeps
                                               ,maybeUpdateSandboxConfig
                                               ,tryGetIndexFilePath
+                                              ,sandboxBuildDir
 
                                               ,configCompilerAux'
                                               ,configPackageDB')
@@ -461,7 +462,7 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
   let configFlags'   =
         let flags    = savedConfigureFlags   config `mappend` configFlags
         in if isUseSandbox useSandbox
-           then flags {configDistPref = Flag "sandbox-dist"}
+           then flags {configDistPref = Flag sandboxBuildDir }
            else flags
 
       configExFlags' = defaultConfigExFlags         `mappend`





More information about the ghc-commits mailing list