summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-08-14 12:53:12 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-08-14 12:53:12 +0000
commit0202ff18c5c6c612a7a0518a1e0bdb54d879a1f7 (patch)
tree9e9cc3854998d0db01b658e9e82911eac13116fe
parenteacfbdedf46dcc3105de1bbf642cf2572526c705 (diff)
downloadhaskell-0202ff18c5c6c612a7a0518a1e0bdb54d879a1f7.tar.gz
add --no-user-package-conf
-rw-r--r--utils/ghc-pkg/Main.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 2296c670dc..0f02698226 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -102,6 +102,7 @@ data Flag
| FlagSimpleOutput
| FlagNamesOnly
| FlagIgnoreCase
+ | FlagNoUserDb
deriving Eq
flags :: [OptDescr Flag]
@@ -114,6 +115,8 @@ flags = [
"use the specified package config file",
Option [] ["global-conf"] (ReqArg FlagGlobalConfig "FILE")
"location of the global package config",
+ Option [] ["no-user-package-conf"] (NoArg FlagNoUserDb)
+ "never read the user package database",
Option [] ["force"] (NoArg FlagForce)
"ignore missing dependencies, directories, and libraries",
Option [] ["force-files"] (NoArg FlagForceFiles)
@@ -397,11 +400,14 @@ getPkgDatabases modify my_flags = do
, isSuffixOf ".conf" file]
else return []
+ let no_user_db = FlagNoUserDb `elem` my_flags
+
-- get the location of the user package database, and create it if necessary
-- getAppUserDataDirectory can fail (e.g. if $HOME isn't set)
appdir <- try $ getAppUserDataDirectory "ghc"
mb_user_conf <-
+ if no_user_db then return Nothing else
case appdir of
Right dir -> do
let subdir = targetARCH ++ '-':targetOS ++ '-':Version.version