[commit: ghc] master: ghc-pkg: don't print ignored errors when verbosity=0 (5c372fe)

git at git.haskell.org git at git.haskell.org
Fri Sep 4 16:19:53 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5c372fe50412b8d2606b98ad953d3b0a121f9d9b/ghc

>---------------------------------------------------------------

commit 5c372fe50412b8d2606b98ad953d3b0a121f9d9b
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Fri Sep 4 16:59:44 2015 +0200

    ghc-pkg: don't print ignored errors when verbosity=0
    
    Lines like the following are filling up the build logs:
    
      binary-0.7.5.0: cannot find any of
      ["Data/Binary.hi","Data/Binary.p_hi","Data/Binary.dyn_hi"] (ignoring)


>---------------------------------------------------------------

5c372fe50412b8d2606b98ad953d3b0a121f9d9b
 utils/ghc-pkg/Main.hs | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index fbd7dae..4ee0d01 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -973,7 +973,7 @@ registerPackage input verbosity my_flags multi_instance
       infoLn "done."
 
   -- report any warnings from the parse phase
-  _ <- reportValidateErrors [] ws
+  _ <- reportValidateErrors verbosity [] ws
          (display (sourcePackageId pkg) ++ ": Warning: ") Nothing
 
   -- validate the expanded pkg, but register the unexpanded
@@ -1465,13 +1465,13 @@ checkConsistency verbosity my_flags = do
                                                        True True
          if null es
             then do when (not simple_output) $ do
-                      _ <- reportValidateErrors [] ws "" Nothing
+                      _ <- reportValidateErrors verbosity [] ws "" Nothing
                       return ()
                     return []
             else do
               when (not simple_output) $ do
                   reportError ("There are problems in package " ++ display (sourcePackageId p) ++ ":")
-                  _ <- reportValidateErrors es ws "  " Nothing
+                  _ <- reportValidateErrors verbosity es ws "  " Nothing
                   return ()
               return [p]
 
@@ -1550,9 +1550,9 @@ liftIO :: IO a -> Validate a
 liftIO k = V (k >>= \a -> return (a,[],[]))
 
 -- returns False if we should die
-reportValidateErrors :: [ValidateError] -> [ValidateWarning]
+reportValidateErrors :: Verbosity -> [ValidateError] -> [ValidateWarning]
                      -> String -> Maybe Force -> IO Bool
-reportValidateErrors es ws prefix mb_force = do
+reportValidateErrors verbosity es ws prefix mb_force = do
   mapM_ (warn . (prefix++)) ws
   oks <- mapM report es
   return (and oks)
@@ -1560,7 +1560,8 @@ reportValidateErrors es ws prefix mb_force = do
     report (f,s)
       | Just force <- mb_force
       = if (force >= f)
-           then do reportError (prefix ++ s ++ " (ignoring)")
+           then do when (verbosity >= Normal) $
+                        reportError (prefix ++ s ++ " (ignoring)")
                    return True
            else if f < CannotForce
                    then do reportError (prefix ++ s ++ " (use --force to override)")
@@ -1584,7 +1585,8 @@ validatePackageConfig pkg verbosity db_stack
   (_,es,ws) <- runValidate $
                  checkPackageConfig pkg verbosity db_stack
                                     multi_instance update
-  ok <- reportValidateErrors es ws (display (sourcePackageId pkg) ++ ": ") (Just force)
+  ok <- reportValidateErrors verbosity es ws
+          (display (sourcePackageId pkg) ++ ": ") (Just force)
   when (not ok) $ exitWith (ExitFailure 1)
 
 checkPackageConfig :: InstalledPackageInfo



More information about the ghc-commits mailing list