[commit: packages/Cabal] ghc-head: Set 'haddockDistPref' to the right value when working inside a sandbox. (b8309fd)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:25:27 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=b8309fdecd3d95701543b79948d619b3faffa63a

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

commit b8309fdecd3d95701543b79948d619b3faffa63a
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Fri May 17 22:16:24 2013 +0200

    Set 'haddockDistPref' to the right value when working inside a sandbox.
    
    Fixes #1332.


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

b8309fdecd3d95701543b79948d619b3faffa63a
 cabal-install/Distribution/Client/Sandbox.hs |   12 ++++++++----
 cabal-install/Main.hs                        |   20 ++++++++++++--------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/cabal-install/Distribution/Client/Sandbox.hs b/cabal-install/Distribution/Client/Sandbox.hs
index fdbab38..2e9a570 100644
--- a/cabal-install/Distribution/Client/Sandbox.hs
+++ b/cabal-install/Distribution/Client/Sandbox.hs
@@ -72,7 +72,8 @@ import Distribution.Simple.Configure          ( configCompilerAux
                                               , getPackageDBContents )
 import Distribution.Simple.PreProcess         ( knownSuffixHandlers )
 import Distribution.Simple.Program            ( ProgramConfiguration )
-import Distribution.Simple.Setup              ( Flag(..), fromFlagOrDefault )
+import Distribution.Simple.Setup              ( Flag(..), HaddockFlags(..)
+                                              , fromFlagOrDefault )
 import Distribution.Simple.SrcDist            ( prepareTree )
 import Distribution.Simple.Utils              ( die, debug, notice, info, warn
                                               , debugNoWrap, defaultPackageDesc
@@ -467,8 +468,11 @@ reinstallAddSourceDeps :: Verbosity
                           -> IO WereDepsReinstalled
 reinstallAddSourceDeps verbosity config configFlags' configExFlags
                        installFlags globalFlags sandboxDir = topHandler' $ do
-  let configFlags       = configFlags'
-                          { configDistPref = Flag (sandboxBuildDir sandboxDir) }
+  let sandboxDistPref   = sandboxBuildDir sandboxDir
+      configFlags       = configFlags'
+                          { configDistPref  = Flag sandboxDistPref }
+      haddockFlags      = mempty
+                          { haddockDistPref = Flag sandboxDistPref }
   indexFile            <- tryGetIndexFilePath config
   buildTreeRefs        <- Index.listBuildTreeRefs verbosity
                           Index.DontListIgnored Index.OnlyLinks indexFile
@@ -494,7 +498,7 @@ reinstallAddSourceDeps verbosity config configFlags' configExFlags
                      ,(globalRepos globalFlags)
                      ,comp, platform, conf, Just sandboxPkgInfo
                      ,globalFlags, configFlags, configExFlags, installFlags
-                     ,mempty)
+                     ,haddockFlags)
 
           -- This can actually be replaced by a call to 'install', but we use a
           -- lower-level API because of layer separation reasons. Additionally,
diff --git a/cabal-install/Main.hs b/cabal-install/Main.hs
index 203b397..3fbe0e2 100644
--- a/cabal-install/Main.hs
+++ b/cabal-install/Main.hs
@@ -470,13 +470,17 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
                           (configUserInstall configFlags)
   targets <- readUserTargets verbosity extraArgs
 
-  let configFlags'   = savedConfigureFlags   config `mappend` configFlags
-      configExFlags' = defaultConfigExFlags         `mappend`
-                       savedConfigureExFlags config `mappend` configExFlags
-      installFlags'  = defaultInstallFlags          `mappend`
-                       savedInstallFlags     config `mappend` installFlags
+  let sandboxDistPref = case useSandbox of
+        NoSandbox             -> NoFlag
+        UseSandbox sandboxDir -> Flag $ sandboxBuildDir sandboxDir
+      configFlags'    = savedConfigureFlags   config `mappend` configFlags
+      configExFlags'  = defaultConfigExFlags         `mappend`
+                        savedConfigureExFlags config `mappend` configExFlags
+      installFlags'   = defaultInstallFlags          `mappend`
+                        savedInstallFlags     config `mappend` installFlags
                        { installUseSandbox = useSandbox }
-      globalFlags'   = savedGlobalFlags      config `mappend` globalFlags
+      globalFlags'    = savedGlobalFlags      config `mappend` globalFlags
+      haddockFlags'   = haddockFlags { haddockDistPref = sandboxDistPref }
   (comp, platform, conf) <- configCompilerAux' configFlags'
 
   -- If we're working inside a sandbox and the user has set the -w option, we
@@ -486,7 +490,7 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
         NoSandbox               -> configAbsolutePaths $ configFlags'
         (UseSandbox sandboxDir) ->
           return $ (setPackageDB sandboxDir comp platform configFlags') {
-            configDistPref = Flag (sandboxBuildDir sandboxDir)
+            configDistPref = sandboxDistPref
             }
 
   whenUsingSandbox useSandbox $ \sandboxDir -> do
@@ -514,7 +518,7 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
             (globalRepos globalFlags')
             comp platform conf
             Nothing -- FIXME
-            globalFlags' configFlags'' configExFlags' installFlags' haddockFlags
+            globalFlags' configFlags'' configExFlags' installFlags' haddockFlags'
             targets
 
 testAction :: (TestFlags, BuildExFlags) -> [String] -> GlobalFlags -> IO ()





More information about the ghc-commits mailing list