From 0202ff18c5c6c612a7a0518a1e0bdb54d879a1f7 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 14 Aug 2008 12:53:12 +0000 Subject: [PATCH] add --no-user-package-conf --- utils/ghc-pkg/Main.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 2296c67..0f02698 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 -- 1.7.10.4