Skip to content

Commit

Permalink
Add a ForceGlobalInstall argument to configPackageDB'.
Browse files Browse the repository at this point in the history
In sandbox mode userInstallDirs = globalInstallDirs and we set userInstall to
False to prevent UserPackageDB from being added to the package DB stack (see haskell#1183).
  • Loading branch information
23Skidoo committed Mar 24, 2013
1 parent 0c9284f commit a2d98b8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions cabal-install/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ configureAction (configFlags, configExFlags) extraArgs globalFlags = do
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAux configFlags'
configure verbosity
(configPackageDB' configFlags') (globalRepos globalFlags')
(configPackageDB' configFlags' DontForceGlobalInstall)
(globalRepos globalFlags')
comp platform conf configFlags' configExFlags' extraArgs

buildAction :: BuildFlags -> [String] -> GlobalFlags -> IO ()
Expand Down Expand Up @@ -376,7 +377,8 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAux' configFlags'
install verbosity
(configPackageDB' configFlags') (globalRepos globalFlags')
(configPackageDB' configFlags' DontForceGlobalInstall)
(globalRepos globalFlags')
comp platform conf globalFlags' configFlags' configExFlags'
installFlags' haddockFlags
targets
Expand Down Expand Up @@ -423,7 +425,7 @@ listAction listFlags extraArgs globalFlags = do
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, _, conf) <- configCompilerAux' configFlags
list verbosity
(configPackageDB' configFlags)
(configPackageDB' configFlags DontForceGlobalInstall)
(globalRepos globalFlags')
comp
conf
Expand All @@ -439,7 +441,7 @@ infoAction infoFlags extraArgs globalFlags = do
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, _, conf) <- configCompilerAux configFlags
info verbosity
(configPackageDB' configFlags)
(configPackageDB' configFlags DontForceGlobalInstall)
(globalRepos globalFlags')
comp
conf
Expand Down Expand Up @@ -480,7 +482,8 @@ fetchAction fetchFlags extraArgs globalFlags = do
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAux' configFlags
fetch verbosity
(configPackageDB' configFlags) (globalRepos globalFlags')
(configPackageDB' configFlags DontForceGlobalInstall)
(globalRepos globalFlags')
comp platform conf globalFlags' fetchFlags
targets

Expand Down Expand Up @@ -582,7 +585,7 @@ initAction initFlags _extraArgs globalFlags = do
let configFlags = savedConfigureFlags config
(comp, _, conf) <- configCompilerAux' configFlags
initCabal verbosity
(configPackageDB' configFlags)
(configPackageDB' configFlags DontForceGlobalInstall)
comp
conf
initFlags
Expand Down Expand Up @@ -623,11 +626,16 @@ win32SelfUpgradeAction _ _ _ = return ()
-- Utils (transitionary)
--

configPackageDB' :: ConfigFlags -> PackageDBStack
configPackageDB' cfg =
data ForceGlobalInstall = DontForceGlobalInstall
| ForceGlobalInstall

configPackageDB' :: ConfigFlags -> ForceGlobalInstall -> PackageDBStack
configPackageDB' cfg force =
interpretPackageDbFlags userInstall (configPackageDBs cfg)
where
userInstall = fromFlagOrDefault True (configUserInstall cfg)
userInstall = case force of
ForceGlobalInstall -> False
DontForceGlobalInstall -> fromFlagOrDefault True (configUserInstall cfg)

configCompilerAux' :: ConfigFlags
-> IO (Compiler, Platform, ProgramConfiguration)
Expand Down

0 comments on commit a2d98b8

Please sign in to comment.