summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-02-17 08:39:35 -0600
committerAustin Seipp <austin@well-typed.com>2015-02-17 09:06:11 -0600
commite7fab334b31dc516d2e8f2285630cbffe9825b76 (patch)
tree48a8a41371d2d374bc261fd114aaa4338d53b1c9 /utils/ghc-pkg
parenta82364c9410d35fa9cb5031d553212267c3628c5 (diff)
downloadhaskell-e7fab334b31dc516d2e8f2285630cbffe9825b76.tar.gz
Improve outdated ghc-pkg cache warning (#9606)
Summary: No more frustration. Test Plan: I tested it. Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D658 GHC Trac Issues: #9606
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index b2815b80a5..53bc43b071 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -706,7 +706,7 @@ readParseDatabase verbosity mb_user_conf modify use_cache path
then do
warn ("WARNING: cache does not exist: " ++ cache)
warn ("ghc will fail to read this package db. " ++
- "Use 'ghc-pkg recache' to fix.")
+ recacheAdvice)
else do
warn ("WARNING: cache cannot be read: " ++ show ex)
warn "ghc will fail to read this package db."
@@ -736,7 +736,7 @@ readParseDatabase verbosity mb_user_conf modify use_cache path
whenReportCacheErrors $ do
warn ("WARNING: cache is out of date: " ++ cache)
warn ("ghc will see an old view of this " ++
- "package db. Use 'ghc-pkg recache' to fix.")
+ "package db. " ++ recacheAdvice)
ignore_cache compareTimestampToCache
where
ignore_cache :: (FilePath -> IO ()) -> IO PackageDB
@@ -753,6 +753,12 @@ readParseDatabase verbosity mb_user_conf modify use_cache path
when ( verbosity > Normal
|| verbosity >= Normal && not modify)
where
+ recacheAdvice
+ | Just (user_conf, True) <- mb_user_conf, path == user_conf
+ = "Use 'ghc-pkg recache --user' to fix."
+ | otherwise
+ = "Use 'ghc-pkg recache' to fix."
+
mkPackageDB pkgs = do
path_abs <- absolutePath path
return PackageDB {