[commit: ghc] master: ghc-pkg: Restore old behavior in colored version; fixes 6119 (3d55e41)

git at git.haskell.org git at git.haskell.org
Mon Dec 7 11:14:46 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3d55e41e72dc32281744c52afea380c1db577ee1/ghc

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

commit 3d55e41e72dc32281744c52afea380c1db577ee1
Author: Sibi Prabakaran <sibi at psibi.in>
Date:   Mon Dec 7 11:16:15 2015 +0100

    ghc-pkg: Restore old behavior in colored version; fixes 6119
    
    The behavior is changed to this:
    ```
    ghc-pkg list blahblah
    /home/sibi/ghc/inplace/lib/package.conf.d
        (no packages)
    ```
    instead of:
    ```
    ghc-pkg list blahblah
    /home/sibi/ghc/inplace/lib/package.conf.d
    ```
    
    Reviewers: austin, thomie, bgamari
    
    Reviewed By: thomie, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1575
    
    GHC Trac Issues: #6119


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

3d55e41e72dc32281744c52afea380c1db577ee1
 utils/ghc-pkg/Main.hs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 993aa12..b089e7b 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -1271,10 +1271,13 @@ listPackages verbosity my_flags mPackageName mModuleName = do
     mapM_ show_normal stack
 #else
     let
-       show_colour withF db =
-           mconcat $ map (<#> termText "\n") $
-               (termText (location db) :
-                  map (termText "   " <#>) (map pp_pkg (packages db)))
+       show_colour withF db at PackageDB{ packages = pkg_confs } =
+           if null pkg_confs
+           then termText (location db) <#> termText "\n    (no packages)\n"
+           else
+               mconcat $ map (<#> termText "\n") $
+                           (termText (location db) :
+                                     map (termText "   " <#>) (map pp_pkg pkg_confs))
           where
                    pp_pkg p
                      | installedComponentId p `elem` broken = withF Red  doc



More information about the ghc-commits mailing list