Skip to content

Commit

Permalink
Add a ForceGlobalInstall argument to configPackageDB'.
Browse files Browse the repository at this point in the history
We use userInstallDirs in sandbox mode to prevent cabal-install from doing
unnecessary things like invoking itself via 'sudo' (see commit
7b2e363 and 'rootCmd' in D.C.Install), but in
this particular case we want userInstall to be False to prevent UserPackageDB
from being added to the package DB stack (see #1183 and interpretPackageDbFlags
in D.S.Configure).
  • Loading branch information
23Skidoo authored and tibbe committed Apr 12, 2013
1 parent 2827948 commit 3b42456
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 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' UseDefaultPackageDBStack)
(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' UseDefaultPackageDBStack)
(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 UseDefaultPackageDBStack)
(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 UseDefaultPackageDBStack)
(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 UseDefaultPackageDBStack)
(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 UseDefaultPackageDBStack)
comp
conf
initFlags
Expand Down Expand Up @@ -623,11 +626,17 @@ win32SelfUpgradeAction _ _ _ = return ()
-- Utils (transitionary)
--

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


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

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

0 comments on commit 3b42456

Please sign in to comment.